LU-15546 mdt: mdt_reint_open lookup before locking
This patch is an optimization of 33dc40d ("LU-10262 mdt:
mdt_reint_open: check EEXIST without lock").
The current behavior is to take a LCK_PR on parent to verify if the
file exist and then take a LCK_PW to create the file.
Here we do a lookup to determine the mode before tacking a lock.
This avoid to re-lock each time for create cases.
Most of the time we have:
1. lookup the child in parent directory
2. take the parent lock: file_exist ? LCK_PR : LCK_PW
3. re-lookup the child
In a race senario (create/unlink) we have:
1. lookup child in parent directory -> file exists
2. take a LCK_PR on the parent
3. re-lookup the child -> file doesn't exist
2. take a LCK_PW on the parent
4. re-lookup the child
This patch fix the "SKIP" condition for sanityn 41i/43k/45j and clear
the LRU locks cache for sanityn 43k/45j.
Lustre-change: https://review.whamcloud.com/46679
Lustre-commit:
f14090e56c9d94e3cfaa6f13f357173d6d570547
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.
Lustre-change: https://review.whamcloud.com/47506
Lustre-commit: TBD (
a15b4e389aa6d2a30d9b79a20f0884e3725c70d7)
Fixes: 33dc40d ("LU-10262 mdt: mdt_reint_open: check EEXIST without lock")
Signed-off-by: Etienne AUJAMES <eaujames@ddn.com>
Change-Id: I121abd4babfb516d7a64682b054a6443d38590ef
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Yingjin Qian <qian@ddn.com>
Reviewed-on: https://review.whamcloud.com/47810
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>