Whamcloud - gitweb
LU-3280 ldlm: suppress useless lock RPC for layout
[fs/lustre-release.git] / lustre / llite / file.c
index c3dade8..cfb48ca 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2012, Intel Corporation.
+ * Copyright (c) 2011, 2013, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -3328,6 +3328,9 @@ static int ll_layout_lock_set(struct lustre_handle *lockh, ldlm_mode_t mode,
        LDLM_DEBUG(lock, "File %p/"DFID" being reconfigured: %d.\n",
                inode, PFID(&lli->lli_fid), reconf);
 
+       /* in case this is a caching lock and reinstate with new inode */
+       md_set_lock_data(sbi->ll_md_exp, &lockh->cookie, inode, NULL);
+
        lock_res_and_lock(lock);
        lvb_ready = !!(lock->l_flags & LDLM_FL_LVB_READY);
        unlock_res_and_lock(lock);
@@ -3496,8 +3499,6 @@ again:
 
        ll_finish_md_op_data(op_data);
 
-       md_set_lock_data(sbi->ll_md_exp, &it.d.lustre.it_lock_handle, inode, NULL);
-
        mode = it.d.lustre.it_lock_mode;
        it.d.lustre.it_lock_mode = 0;
        ll_intent_drop_lock(&it);