/* statahead.c */
#define LL_SA_RPC_MIN 8
-#define LL_SA_RPC_DEF 32
+#define LL_SA_RPC_DEF 128
#define LL_SA_RPC_MAX 2048
/* XXX: If want to support more concurrent statahead instances,
#define LL_SA_RUNNING_DEF 16
#define LL_SA_BATCH_MAX 1024
-#define LL_SA_BATCH_DEF 0
+#define LL_SA_BATCH_DEF 64
#define LL_SA_CACHE_BIT 5
#define LL_SA_CACHE_SIZE (1 << LL_SA_CACHE_BIT)
try_bits |= MDS_INODELOCK_DOM;
}
+ /*
+ * To avoid possible deadlock between batched statahead RPC
+ * and rename()/migrate() operation, it should use trylock to
+ * obtain the DLM PR ibits lock for file attributes in a
+ * batched statahead RPC. A failed trylock means that other
+ * users maybe modify the directory simultaneously as in current
+ * Lustre design the server only grants read lock to a client.
+ *
+ * When a trylock failed, the MDT reports the conflict with
+ * error code -EBUSY, and stops statahead immediately.
+ */
+ if (info->mti_batch_env) {
+ /*
+ * This is a sub stat-ahead request in a batched RPC.
+ * However, the @child is a remote object, we just
+ * return -EREMOTE here to forbid stat-ahead on it.
+ */
+ if (mdt_object_remote(child))
+ GOTO(out_child, rc = -EREMOTE);
+ try_bits |= child_bits;
+ child_bits = 0;
+ }
+
if (try_bits != 0) {
/* try layout lock, it may fail to be granted due to
* contention at LOOKUP or UPDATE */
}
if (unlikely(rc != 0))
GOTO(out_child, rc);
+ if (info->mti_batch_env && child_bits == 0) {
+ if (!is_resent)
+ mdt_object_unlock(info, child, lhc, 1);
+ GOTO(out_child, rc = -EBUSY);
+ }
}
if (fscrypt_md)