Whamcloud - gitweb
LU-1650 obdclass: find the lock by index of subpage
authorJinshan Xiong <jinshan.xiong@intel.com>
Wed, 28 Nov 2012 18:04:42 +0000 (10:04 -0800)
committerOleg Drokin <green@whamcloud.com>
Tue, 4 Dec 2012 01:16:39 +0000 (20:16 -0500)
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 <jinshan.xiong@intel.com>
Change-Id: Id8e1da89ef81fad4c7917360d591fc7bd1309a00
Reviewed-on: http://review.whamcloud.com/4673
Tested-by: Hudson
Reviewed-by: Bobi Jam <bobijam@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Johann Lombardi <johann.lombardi@intel.com>
lustre/include/cl_object.h
lustre/obdclass/cl_lock.c

index b4f7917..64370c2 100644 (file)
@@ -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);
 }
index 72f8a1a..5dcccbb 100644 (file)
@@ -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