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.
struct ldlm_lock *__ldlm_handle2lock(struct lustre_handle *handle, int flags)
{
+ struct ldlm_namespace *ns;
struct ldlm_lock *lock = NULL, *retval = NULL;
ENTRY;
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 */
retval = lock;
EXIT;
out:
- l_unlock(&lock->l_resource->lr_namespace->ns_lock);
+ l_unlock(&ns->ns_lock);
return retval;
}