Whamcloud - gitweb
b=18618
[fs/lustre-release.git] / lustre / ldlm / l_lock.c
index 53aa09d..cb08f5b 100644 (file)
@@ -16,8 +16,8 @@
  * in the LICENSE file that accompanied this code).
  *
  * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see [sun.com URL with a
- * copy of GPLv2].
+ * version 2 along with this program; If not, see
+ * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
  *
  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  * CA 95054 USA or visit www.sun.com if you need additional information or
  */
 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;
 }