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: Patrick Farrell <paf@cray.com>
Change-Id: Ie231166756e60c228370f8f1a019ccfe14dfda6a
Reviewed-on: https://review.whamcloud.com/33754
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
};
int idx;
+ data->lmd_lock = NULL;
+
for (idx = 0; idx < LCK_MODE_NUM; idx++) {
struct ldlm_interval_tree *tree = &res->lr_itree[idx];
interval_search(tree->lit_root, &ext,
itree_overlap_cb, data);
+ if (data->lmd_lock)
+ return data->lmd_lock;
}
- return data->lmd_lock;
+
+ return NULL;
}
struct ldlm_lock *lock;
int rc;
+ data->lmd_lock = NULL;
+
list_for_each_entry(lock, queue, l_res_link) {
rc = lock_matches(lock, data);
if (rc == INTERVAL_ITER_STOP)
return data->lmd_lock;
}
+
return NULL;
}