From b22e6340828b9caaeac517ff3af4c38541ba39cb Mon Sep 17 00:00:00 2001 From: Jinshan Xiong Date: Wed, 28 Nov 2012 10:04:42 -0800 Subject: [PATCH] LU-1650 obdclass: find the lock by index of subpage In check_and_discard_cb(), subpage's index should be used to find if there exists another lock to cover the same page. Signed-off-by: Jinshan Xiong Change-Id: Id8e1da89ef81fad4c7917360d591fc7bd1309a00 Reviewed-on: http://review.whamcloud.com/4673 Tested-by: Hudson Reviewed-by: Bobi Jam Tested-by: Maloo Reviewed-by: Johann Lombardi --- lustre/include/cl_object.h | 1 + lustre/obdclass/cl_lock.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lustre/include/cl_object.h b/lustre/include/cl_object.h index b4f7917..64370c2 100644 --- a/lustre/include/cl_object.h +++ b/lustre/include/cl_object.h @@ -2871,6 +2871,7 @@ static inline struct cl_lock *cl_lock_at_page(const struct lu_env *env, struct cl_lock *except, int pending, int canceld) { + LASSERT(cl_object_header(obj) == cl_object_header(page->cp_obj)); return cl_lock_at_pgoff(env, obj, page->cp_index, except, pending, canceld); } diff --git a/lustre/obdclass/cl_lock.c b/lustre/obdclass/cl_lock.c index 72f8a1a..5dcccbb 100644 --- a/lustre/obdclass/cl_lock.c +++ b/lustre/obdclass/cl_lock.c @@ -1923,9 +1923,9 @@ static int check_and_discard_cb(const struct lu_env *env, struct cl_io *io, if (index >= info->clt_fn_index) { struct cl_lock *tmp; - /* refresh non-overlapped index */ - tmp = cl_lock_at_page(env, lock->cll_descr.cld_obj, page, lock, - 1, 0); + /* refresh non-overlapped index */ + tmp = cl_lock_at_pgoff(env, lock->cll_descr.cld_obj, index, + lock, 1, 0); if (tmp != NULL) { /* Cache the first-non-overlapped index so as to skip * all pages within [index, clt_fn_index). This -- 1.8.3.1