Whamcloud - gitweb
Branch: HEAD
authorwangdi <wangdi>
Wed, 16 Sep 2009 20:20:21 +0000 (20:20 +0000)
committerwangdi <wangdi>
Wed, 16 Sep 2009 20:20:21 +0000 (20:20 +0000)
b=20305
separate glimpse lock with other locks. (glimpse lock only match with glimpse
lock), otherwise pages might be added to some doomed(detached) locks, and they might
not be flushed later when the lock is deleted.
i=Jay, Ericm

lustre/lclient/lcommon_cl.c
lustre/osc/osc_lock.c

index a66d91d..9eb6bbb 100644 (file)
@@ -624,7 +624,8 @@ int ccc_lock_fits_into(const struct lu_env *env,
          * doesn't enqueue CLM_WRITE sub-locks.
          */
         if (cio->cui_glimpse)
-                result = descr->cld_mode != CLM_WRITE;
+                result = descr->cld_mode == CLM_PHANTOM;
+
         /*
          * Also, don't match incomplete write locks for read, otherwise read
          * would enqueue missing sub-locks in the write mode.
index 136f7ff..b224bdd 100644 (file)
@@ -1569,6 +1569,18 @@ static int osc_lock_print(const struct lu_env *env, void *cookie,
         return 0;
 }
 
+static int osc_lock_fits_into(const struct lu_env *env,
+                              const struct cl_lock_slice *slice,
+                              const struct cl_lock_descr *need,
+                              const struct cl_io *io)
+{
+
+        if (need->cld_mode == CLM_PHANTOM)
+                return need->cld_mode == slice->cls_lock->cll_descr.cld_mode;
+
+        return 1;
+}
+
 static const struct cl_lock_operations osc_lock_ops = {
         .clo_fini    = osc_lock_fini,
         .clo_enqueue = osc_lock_enqueue,
@@ -1579,7 +1591,8 @@ static const struct cl_lock_operations osc_lock_ops = {
         .clo_state   = osc_lock_state,
         .clo_cancel  = osc_lock_cancel,
         .clo_weigh   = osc_lock_weigh,
-        .clo_print   = osc_lock_print
+        .clo_print   = osc_lock_print,
+        .clo_fits_into = osc_lock_fits_into,
 };
 
 static int osc_lock_lockless_enqueue(const struct lu_env *env,