Whamcloud - gitweb
LU-7988 hsm: run HSM coordinator once per second at most
[fs/lustre-release.git] / lustre / mdt / mdt_lvb.c
index 95ff632..d4c5097 100644 (file)
@@ -21,7 +21,7 @@
  * GPL HEADER END
  */
 /*
- * Copyright (c) 2012, 2013, Intel Corporation.
+ * Copyright (c) 2012, 2015, Intel Corporation.
  * Use is subject to license terms.
  *
  * lustre/mdt/mdt_lvb.c
@@ -114,7 +114,8 @@ static int mdt_lvbo_fill(struct ldlm_lock *lock, void *lvb, int lvblen)
                RETURN(rc);
        }
 
-       if (!ldlm_has_layout(lock))
+       /* Only fill layout if layout lock is granted */
+       if (!ldlm_has_layout(lock) || lock->l_granted_mode != lock->l_req_mode)
                RETURN(0);
 
        /* layout lock will be granted to client, fill in lvb with layout */
@@ -196,9 +197,9 @@ static int mdt_lvbo_free(struct ldlm_resource *res)
 }
 
 struct ldlm_valblock_ops mdt_lvbo = {
-       lvbo_init:      mdt_lvbo_init,
-       lvbo_update:    mdt_lvbo_update,
-       lvbo_size:      mdt_lvbo_size,
-       lvbo_fill:      mdt_lvbo_fill,
-       lvbo_free:      mdt_lvbo_free
+       .lvbo_init      = mdt_lvbo_init,
+       .lvbo_update    = mdt_lvbo_update,
+       .lvbo_size      = mdt_lvbo_size,
+       .lvbo_fill      = mdt_lvbo_fill,
+       .lvbo_free      = mdt_lvbo_free
 };