From 0a2aa83c17295785e5568b59d717446b3f7157de Mon Sep 17 00:00:00 2001 From: Vitaly Fertman Date: Wed, 12 May 2010 15:04:16 +0400 Subject: [PATCH] b=22573 do not skip previously granted locks in osc_lock_enqueue_wait(). i=eric.mei i=wangdi as CLIO adds new locks to the tail, walk through the head of the queue to cancel overlapping conflicting locks on enqueue. --- lustre/osc/osc_lock.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lustre/osc/osc_lock.c b/lustre/osc/osc_lock.c index 26a2d2d..5685124 100644 --- a/lustre/osc/osc_lock.c +++ b/lustre/osc/osc_lock.c @@ -1037,7 +1037,7 @@ static int osc_lock_enqueue_wait(const struct lu_env *env, struct cl_lock *lock = olck->ols_cl.cls_lock; struct cl_lock_descr *descr = &lock->cll_descr; struct cl_object_header *hdr = cl_object_header(descr->cld_obj); - struct cl_lock *scan = lock; + struct cl_lock *scan; struct cl_lock *conflict= NULL; int lockless = osc_lock_is_lockless(olck); int rc = 0; @@ -1052,10 +1052,13 @@ static int osc_lock_enqueue_wait(const struct lu_env *env, return 0; cfs_spin_lock(&hdr->coh_lock_guard); - cfs_list_for_each_entry_continue(scan, &hdr->coh_locks, cll_linkage) { + cfs_list_for_each_entry(scan, &hdr->coh_locks, cll_linkage) { struct cl_lock_descr *cld = &scan->cll_descr; const struct osc_lock *scan_ols; + if (scan == lock) + break; + if (scan->cll_state < CLS_QUEUING || scan->cll_state == CLS_FREEING || cld->cld_start > descr->cld_end || -- 1.8.3.1