Whamcloud - gitweb
LU-15907 mdt: fix the OBD_FAIL_MDS_REINT_OPEN2 race 06/47506/2
authorEtienne AUJAMES <etienne.aujames@cea.fr>
Wed, 1 Jun 2022 14:41:54 +0000 (16:41 +0200)
committerEtienne AUJAMES <etienne.aujames@cea.fr>
Wed, 1 Jun 2022 15:06:10 +0000 (17:06 +0200)
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 <eaujames@ddn.com>
Change-Id: Ifb9a44dcad610281c9d7d2a90bb8704420379819

lustre/mdt/mdt_open.c

index eccefec..589ff49 100644 (file)
@@ -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);