From: adilger Date: Mon, 8 Mar 2004 20:33:26 +0000 (+0000) Subject: Copy the extent lock policy data only in the completion callback, or in the X-Git-Tag: v1_7_100~2506 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=7ff01fc9e03faeb8c23182e50b6b85107c598628 Copy the extent lock policy data only in the completion callback, or in the 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 --- diff --git a/lustre/ChangeLog b/lustre/ChangeLog index 21c3e3f..4a27abb 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -2,6 +2,7 @@ tbd Cluster File Systems, Inc. * 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. * version 1.2.0 diff --git a/lustre/ldlm/ldlm_lockd.c b/lustre/ldlm/ldlm_lockd.c index b1c265d..886097f 100644 --- a/lustre/ldlm/ldlm_lockd.c +++ b/lustre/ldlm/ldlm_lockd.c @@ -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"); } - 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)); + LDLM_DEBUG(lock, "completion AST, new policy data"); + } ldlm_resource_unlink_lock(lock); if (memcmp(&dlm_req->lock_desc.l_resource.lr_name, diff --git a/lustre/ldlm/ldlm_request.c b/lustre/ldlm/ldlm_request.c index 01e4562..a996da6 100644 --- a/lustre/ldlm/ldlm_request.c +++ b/lustre/ldlm/ldlm_request.c @@ -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); - 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 @@ -372,7 +361,14 @@ int ldlm_cli_enqueue(struct obd_export *exp, } 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; diff --git a/lustre/tests/acceptance-small.sh b/lustre/tests/acceptance-small.sh index 6a32076..abe38c8 100755 --- a/lustre/tests/acceptance-small.sh +++ b/lustre/tests/acceptance-small.sh @@ -157,10 +157,10 @@ if [ "$CONF_SANITY" != "no" ]; then 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 [ "$REPLAY_OST_SINGLE" != "no" ]; then + sh replay-ost-single.sh +fi diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 84b645a..358f954d 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -1244,16 +1244,21 @@ stop_kupdated() { 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 - 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 }