From: phil Date: Sun, 3 Aug 2003 21:04:09 +0000 (+0000) Subject: * Landing fix on HEAD, originally committed to b_devel X-Git-Tag: 0.9.1~389 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=90f6092564ec613408b3e351d164db9ef31b7e7c;p=fs%2Flustre-release.git * Landing fix on HEAD, originally committed to b_devel b=1625 r=adilger Avoid dereferencing 'lock' after we LDLM_LOCK_PUT, by saving a copy of the namespace pointer and using that to unlock. Alternatively, we could drop the NS lock and then do the PUT, but this is an equally low-impact fix. --- diff --git a/lustre/ldlm/ldlm_lock.c b/lustre/ldlm/ldlm_lock.c index 3995e95..ba98b1a 100644 --- a/lustre/ldlm/ldlm_lock.c +++ b/lustre/ldlm/ldlm_lock.c @@ -330,6 +330,7 @@ void ldlm_lock2handle(struct ldlm_lock *lock, struct lustre_handle *lockh) struct ldlm_lock *__ldlm_handle2lock(struct lustre_handle *handle, int flags) { + struct ldlm_namespace *ns; struct ldlm_lock *lock = NULL, *retval = NULL; ENTRY; @@ -340,9 +341,10 @@ struct ldlm_lock *__ldlm_handle2lock(struct lustre_handle *handle, int flags) RETURN(NULL); LASSERT(lock->l_resource != NULL); - LASSERT(lock->l_resource->lr_namespace != NULL); + ns = lock->l_resource->lr_namespace; + LASSERT(ns != NULL); - l_lock(&lock->l_resource->lr_namespace->ns_lock); + l_lock(&ns->ns_lock); /* It's unlikely but possible that someone marked the lock as * destroyed after we did handle2object on it */ @@ -363,7 +365,7 @@ struct ldlm_lock *__ldlm_handle2lock(struct lustre_handle *handle, int flags) retval = lock; EXIT; out: - l_unlock(&lock->l_resource->lr_namespace->ns_lock); + l_unlock(&ns->ns_lock); return retval; }