Whamcloud - gitweb
LU-3042 build: fix 'NULL pointer dereference' errors
[fs/lustre-release.git] / lustre / ldlm / l_lock.c
index 8831b39..e4a688d 100644 (file)
@@ -26,6 +26,8 @@
 /*
  * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
+ *
+ * Copyright (c) 2012, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
 struct ldlm_resource *lock_res_and_lock(struct ldlm_lock *lock)
 {
        /* on server-side resource of lock doesn't change */
-       if (!lock->l_ns_srv)
+       if ((lock->l_flags & LDLM_FL_NS_SRV) == 0)
                spin_lock(&lock->l_lock);
 
        lock_res(lock->l_resource);
 
-       lock->l_res_locked = 1;
+       lock->l_flags |= LDLM_FL_RES_LOCKED;
        return lock->l_resource;
 }
 EXPORT_SYMBOL(lock_res_and_lock);
@@ -69,10 +71,10 @@ EXPORT_SYMBOL(lock_res_and_lock);
 void unlock_res_and_lock(struct ldlm_lock *lock)
 {
        /* on server-side resource of lock doesn't change */
-       lock->l_res_locked = 0;
+       lock->l_flags &= ~LDLM_FL_RES_LOCKED;
 
        unlock_res(lock->l_resource);
-       if (!lock->l_ns_srv)
+       if ((lock->l_flags & LDLM_FL_NS_SRV) == 0)
                spin_unlock(&lock->l_lock);
 }
 EXPORT_SYMBOL(unlock_res_and_lock);