From 80f1de7c27e3e85100f903c6d84a4b64ec6cd034 Mon Sep 17 00:00:00 2001 From: yury Date: Fri, 19 Sep 2008 19:01:22 +0000 Subject: [PATCH] b=16777 16776 r=shadow, adilger, vitaly, robert - new clas_hash and using it for connections, held locks on server, etc --- lustre/ldlm/ldlm_request.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/lustre/ldlm/ldlm_request.c b/lustre/ldlm/ldlm_request.c index 63db00a..4282192 100644 --- a/lustre/ldlm/ldlm_request.c +++ b/lustre/ldlm/ldlm_request.c @@ -371,6 +371,7 @@ int ldlm_cli_enqueue_fini(struct obd_export *exp, struct ptlrpc_request *req, { struct ldlm_namespace *ns = exp->exp_obd->obd_namespace; int is_replay = *flags & LDLM_FL_REPLAY; + struct lustre_handle old_hash_key; struct ldlm_lock *lock; struct ldlm_reply *reply; int cleanup_phase = 1; @@ -422,7 +423,15 @@ int ldlm_cli_enqueue_fini(struct obd_export *exp, struct ptlrpc_request *req, cleanup_phase = 0; lock_res_and_lock(lock); + old_hash_key = lock->l_remote_handle; lock->l_remote_handle = reply->lock_handle; + + /* Key change rehash lock in per-export hash with new key */ + if (exp->exp_lock_hash) + lustre_hash_rehash_key(exp->exp_lock_hash, &old_hash_key, + &lock->l_remote_handle, + &lock->l_exp_hash); + *flags = reply->lock_flags; lock->l_flags |= reply->lock_flags & LDLM_INHERIT_FLAGS; /* move NO_TIMEOUT flag to the lock to force ldlm_lock_match() @@ -1871,15 +1880,16 @@ static int ldlm_chain_lock_for_replay(struct ldlm_lock *lock, void *closure) static int replay_lock_interpret(struct ptlrpc_request *req, struct ldlm_async_args *aa, int rc) { - struct ldlm_lock *lock; - struct ldlm_reply *reply; + struct lustre_handle old_hash_key; + struct ldlm_lock *lock; + struct ldlm_reply *reply; + struct obd_export *exp; ENTRY; atomic_dec(&req->rq_import->imp_replay_inflight); if (rc != ELDLM_OK) GOTO(out, rc); - reply = lustre_swab_repbuf(req, DLM_LOCKREPLY_OFF, sizeof(*reply), lustre_swab_ldlm_reply); if (reply == NULL) { @@ -1897,7 +1907,16 @@ static int replay_lock_interpret(struct ptlrpc_request *req, GOTO(out, rc = -ESTALE); } + old_hash_key = lock->l_remote_handle; lock->l_remote_handle = reply->lock_handle; + + /* Key change rehash lock in per-export hash with new key */ + exp = req->rq_export; + if (exp && exp->exp_lock_hash) + lustre_hash_rehash_key(exp->exp_lock_hash, &old_hash_key, + &lock->l_remote_handle, + &lock->l_exp_hash); + LDLM_DEBUG(lock, "replayed lock:"); ptlrpc_import_recovery_state_machine(req->rq_import); LDLM_LOCK_PUT(lock); -- 1.8.3.1