X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fldlm%2Fl_lock.c;h=cb08f5b257ab914ab2be0eb6f9c5393af63a395e;hp=ac268ecd8320067bb765f959778f6691371f8c32;hb=cf45b9d3ec9aa0872d3654a72f1b5cc9c5fff373;hpb=6869932b552ac705f411de3362f01bd50c1f6f7d diff --git a/lustre/ldlm/l_lock.c b/lustre/ldlm/l_lock.c index ac268ec..cb08f5b 100644 --- a/lustre/ldlm/l_lock.c +++ b/lustre/ldlm/l_lock.c @@ -52,16 +52,15 @@ */ struct ldlm_resource * lock_res_and_lock(struct ldlm_lock *lock) { - struct ldlm_resource *res = lock->l_resource; - - if (ns_is_server(res->lr_namespace)) { - /* on server-side resource of lock doesn't change */ - lock_res(res); - return res; - } + struct ldlm_resource *res = NULL; spin_lock(&lock->l_lock); res = lock->l_resource; + + if (ns_is_server(res->lr_namespace)) + /* on server-side resource of lock doesn't change */ + spin_unlock(&lock->l_lock); + lock_res(res); return res; }