From: Etienne AUJAMES Date: Wed, 1 Jun 2022 14:41:54 +0000 (+0200) Subject: LU-15907 mdt: fix the OBD_FAIL_MDS_REINT_OPEN2 race X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F06%2F47506%2F2;p=fs%2Flustre-release.git LU-15907 mdt: fix the OBD_FAIL_MDS_REINT_OPEN2 race This patch fixes the sanityn test_41i OBD_FAIL_MDS_REINT_OPEN2 race scenario. With the "LU-15546 mdt: mdt_reint_open lookup before locking" patch, we have to force taking a LCK_PR for OBD_FAIL_MDS_REINT_OPEN2 to test the full lock cycle: - take PR parent lock - lockup child (do not exist) - take PW parent lock - re-lookup - create child Otherwise cfs_race() timeouts because PW lock requests from the 2 threads conflict with each other. Fixes: f14090e ("LU-15546 mdt: mdt_reint_open lookup before locking") Test-Parameters: trivial testlist=sanityn Signed-off-by: Etienne AUJAMES Change-Id: Ifb9a44dcad610281c9d7d2a90bb8704420379819 --- diff --git a/lustre/mdt/mdt_open.c b/lustre/mdt/mdt_open.c index eccefec..589ff49 100644 --- a/lustre/mdt/mdt_open.c +++ b/lustre/mdt/mdt_open.c @@ -1296,6 +1296,10 @@ static inline enum ldlm_mode mdt_open_lock_mode(struct mdt_thread_info *info, if (!(open_flags & MDS_OPEN_CREAT)) return LCK_PR; + /* Force a full lock cycle: LCK_PR -> LCK_PW */ + if (OBD_FAIL_PRECHECK(OBD_FAIL_MDS_REINT_OPEN2)) + return LCK_PR; + result = mdo_lookup(info->mti_env, mdt_object_child(p), name, &fid, &info->mti_spec);