Whamcloud - gitweb
Copy the extent lock policy data only in the completion callback, or in the
authoradilger <adilger>
Mon, 8 Mar 2004 20:33:26 +0000 (20:33 +0000)
committeradilger <adilger>
Mon, 8 Mar 2004 20:33:26 +0000 (20:33 +0000)
enqueue reply if the extent was changed and granted immediately.  This
avoids overwriting the policy data if it was updated in the completion callback
before the reply was processed.
b=2901
r=phil

lustre/ChangeLog
lustre/ldlm/ldlm_lockd.c
lustre/ldlm/ldlm_request.c
lustre/tests/acceptance-small.sh
lustre/tests/sanity.sh

index 21c3e3f..4a27abb 100644 (file)
@@ -2,6 +2,7 @@ tbd  Cluster File Systems, Inc. <info@clusterfs.com>
        * version 1.2.1
        * bug fixes
        - fixes for glimpse AST timeouts / incorrectly 0-sized files (2818)
        * version 1.2.1
        * bug fixes
        - fixes for glimpse AST timeouts / incorrectly 0-sized files (2818)
+       - don't overwrite extent policy data in reply if lock was blocked (2901)
 
 2004-03-04  Cluster File Systems, Inc. <info@clusterfs.com>
        * version 1.2.0
 
 2004-03-04  Cluster File Systems, Inc. <info@clusterfs.com>
        * version 1.2.0
index b1c265d..886097f 100644 (file)
@@ -843,9 +843,12 @@ static void ldlm_handle_cp_callback(struct ptlrpc_request *req,
                 lock->l_req_mode = dlm_req->lock_desc.l_granted_mode;
                 LDLM_DEBUG(lock, "completion AST, new lock mode");
         }
                 lock->l_req_mode = dlm_req->lock_desc.l_granted_mode;
                 LDLM_DEBUG(lock, "completion AST, new lock mode");
         }
-        if (lock->l_resource->lr_type != LDLM_PLAIN)
+
+        if (lock->l_resource->lr_type != LDLM_PLAIN) {
                 memcpy(&lock->l_policy_data, &dlm_req->lock_desc.l_policy_data,
                        sizeof(lock->l_policy_data));
                 memcpy(&lock->l_policy_data, &dlm_req->lock_desc.l_policy_data,
                        sizeof(lock->l_policy_data));
+                LDLM_DEBUG(lock, "completion AST, new policy data");
+        }
 
         ldlm_resource_unlink_lock(lock);
         if (memcmp(&dlm_req->lock_desc.l_resource.lr_name,
 
         ldlm_resource_unlink_lock(lock);
         if (memcmp(&dlm_req->lock_desc.l_resource.lr_name,
index 01e4562..a996da6 100644 (file)
@@ -333,17 +333,6 @@ int ldlm_cli_enqueue(struct obd_export *exp,
 
         CDEBUG(D_INFO, "local: %p, remote cookie: "LPX64", flags: 0x%x\n",
                lock, reply->lock_handle.cookie, *flags);
 
         CDEBUG(D_INFO, "local: %p, remote cookie: "LPX64", flags: 0x%x\n",
                lock, reply->lock_handle.cookie, *flags);
-        if (type == LDLM_EXTENT) {
-                CDEBUG(D_INFO, "requested extent: "LPU64" -> "LPU64", got "
-                       "extent "LPU64" -> "LPU64"\n",
-                       body->lock_desc.l_policy_data.l_extent.start,
-                       body->lock_desc.l_policy_data.l_extent.end,
-                       reply->lock_desc.l_policy_data.l_extent.start,
-                       reply->lock_desc.l_policy_data.l_extent.end);
-        }
-        if (policy != NULL)
-                memcpy(&lock->l_policy_data, &reply->lock_desc.l_policy_data,
-                       sizeof(reply->lock_desc.l_policy_data));
 
         /* If enqueue returned a blocked lock but the completion handler has
          * already run, then it fixed up the resource and we don't need to do it
 
         /* If enqueue returned a blocked lock but the completion handler has
          * already run, then it fixed up the resource and we don't need to do it
@@ -372,7 +361,14 @@ int ldlm_cli_enqueue(struct obd_export *exp,
                         }
                         LDLM_DEBUG(lock, "client-side enqueue, new resource");
                 }
                         }
                         LDLM_DEBUG(lock, "client-side enqueue, new resource");
                 }
+                if (policy != NULL)
+                        memcpy(&lock->l_policy_data,
+                               &reply->lock_desc.l_policy_data,
+                               sizeof(reply->lock_desc.l_policy_data));
+                if (type != LDLM_PLAIN)
+                        LDLM_DEBUG(lock,"client-side enqueue, new policy data");
         }
         }
+
         if ((*flags) & LDLM_FL_AST_SENT) {
                 l_lock(&ns->ns_lock);
                 lock->l_flags |= LDLM_FL_CBPENDING;
         if ((*flags) & LDLM_FL_AST_SENT) {
                 l_lock(&ns->ns_lock);
                 lock->l_flags |= LDLM_FL_CBPENDING;
index 6a32076..abe38c8 100755 (executable)
@@ -157,10 +157,10 @@ if [ "$CONF_SANITY" != "no" ]; then
         sh conf-sanity.sh
 fi
 
         sh conf-sanity.sh
 fi
 
-if [ "$REPLAY_OST_SINGLE" != "no" ]; then
-        sh replay-ost-single.sh
-fi
-
 if [ "$RECOVERY_SMALL" != "no" ]; then
         sh recovery-small.sh
 fi
 if [ "$RECOVERY_SMALL" != "no" ]; then
         sh recovery-small.sh
 fi
+
+if [ "$REPLAY_OST_SINGLE" != "no" ]; then
+        sh replay-ost-single.sh
+fi
index 84b645a..358f954 100644 (file)
@@ -1244,16 +1244,21 @@ stop_kupdated() {
        trap start_kupdated EXIT
 }
 
        trap start_kupdated EXIT
 }
 
+# ensure that all stripes have some grant before we test client-side cache
+for i in `seq -f $DIR/f42-%g 1 $STRIPECOUNT`; do
+       dd if=/dev/zero of=$i bs=4k count=1
+done
+
 # Tests 42* verify that our behaviour is correct WRT caching, file closure,
 # file truncation, and file removal.
 test_42a() {
        cancel_lru_locks OSC
        stop_kupdated
 # Tests 42* verify that our behaviour is correct WRT caching, file closure,
 # file truncation, and file removal.
 test_42a() {
        cancel_lru_locks OSC
        stop_kupdated
-        sync # just to be safe
-        BEFOREWRITES=`count_ost_writes`
-        dd if=/dev/zero of=$DIR/f42a bs=1024 count=100
-        AFTERWRITES=`count_ost_writes`
-        [ $BEFOREWRITES -eq $AFTERWRITES ] || \
+       sync; sleep 1; sync # just to be safe
+       BEFOREWRITES=`count_ost_writes`
+       dd if=/dev/zero of=$DIR/f42a bs=1024 count=100
+       AFTERWRITES=`count_ost_writes`
+       [ $BEFOREWRITES -eq $AFTERWRITES ] || \
                error "$BEFOREWRITES < $AFTERWRITES"
        start_kupdated
 }
                error "$BEFOREWRITES < $AFTERWRITES"
        start_kupdated
 }