Commit 4ddd1965 authored by Patrick Farrell's avatar Patrick Farrell Committed by Oleg Drokin
Browse files

LU-11719 ldlm: Adjust search_* functions

The search_itree and search_queue functions should both
return either a pointer to a found lock or NULL.

Currently, search_itree just returns the contents of
data->lmd_lock, whether or not a lock was found.

search_queue will do the same under certain cirumstances.

Zero lmd_lock in both search_* functions, and also stop
searching in search_itree once a lock is found.

cray-bug-id: LUS-6783
Signed-off-by: default avatarPatrick Farrell <>
Change-Id: Ie231166756e60c228370f8f1a019ccfe14dfda6a

Tested-by: Jenkins
Reviewed-by: default avatarAndreas Dilger <>
Tested-by: default avatarMaloo <>
Reviewed-by: default avatarJames Simmons <>
Reviewed-by: default avatarOleg Drokin <>

Tested-by: default avatarjenkins <>
parent af49e96b
......@@ -1285,6 +1285,8 @@ struct ldlm_lock *search_itree(struct ldlm_resource *res,
int idx;
data->lmd_lock = NULL;
for (idx = 0; idx < LCK_MODE_NUM; idx++) {
struct ldlm_interval_tree *tree = &res->lr_itree[idx];
......@@ -1296,8 +1298,11 @@ struct ldlm_lock *search_itree(struct ldlm_resource *res,
interval_search(tree->lit_root, &ext,
itree_overlap_cb, data);
if (data->lmd_lock)
return data->lmd_lock;
return data->lmd_lock;
return NULL;
......@@ -1316,11 +1321,14 @@ static struct ldlm_lock *search_queue(struct list_head *queue,
struct ldlm_lock *lock;
int rc;
data->lmd_lock = NULL;
list_for_each_entry(lock, queue, l_res_link) {
rc = lock_matches(lock, data);
return data->lmd_lock;
return NULL;
......@@ -590,7 +590,7 @@ int osc_ldlm_glimpse_ast(struct ldlm_lock *dlmlock, void *data)
dlmlock = NULL;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment