From 23c05e821da13c6942453be1c9e167c5cafc40e7 Mon Sep 17 00:00:00 2001 From: Lai Siyao Date: Sat, 10 Oct 2020 22:34:19 +0800 Subject: [PATCH] LU-13437 mdc: remote object support getattr from cache For historical reason, IT_GETATTR lock revalidate matches LOOKUP|UPDATE|PERM lock bits because for MDS < 2.4, permission is protected by LOOKUP lock, but this will cause remote object not able to match the cached lock because LOOKUP and UPDATE lock are fetched separately. Add sanity 803b, and rename 803 to 803a. Lustre-change: https://review.whamcloud.com/40218 Lustre-commit: 72a1ca996e3a35ce3e4b7e517f77ff7ac83ccdd5 Signed-off-by: Lai Siyao Change-Id: I3ac38fe34472736849307bb7f1eebb5de9343a5c Reviewed-by: Andreas Dilger Reviewed-by: Mike Pershin Signed-off-by: Minh Diep Reviewed-on: https://review.whamcloud.com/40451 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/mdc/mdc_locks.c | 1 - lustre/tests/sanity.sh | 36 ++++++++++++++++++++++++++++++++++-- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/lustre/mdc/mdc_locks.c b/lustre/mdc/mdc_locks.c index 3269664..caffee4 100644 --- a/lustre/mdc/mdc_locks.c +++ b/lustre/mdc/mdc_locks.c @@ -1143,7 +1143,6 @@ int mdc_revalidate_lock(struct obd_export *exp, struct lookup_intent *it, * but for old MDTs (< 2.4), permission is covered * by LOOKUP lock, so it needs to match all bits here.*/ policy.l_inodebits.bits = MDS_INODELOCK_UPDATE | - MDS_INODELOCK_LOOKUP | MDS_INODELOCK_PERM; break; case IT_READDIR: diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 1f3c10c..e89913b 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -21105,7 +21105,7 @@ test_802() { } run_test 802 "simulate readonly device" -test_803() { +test_803a() { [[ $MDSCOUNT -lt 2 ]] && skip_env "needs >= 2 MDTs" [ $MDS1_VERSION -lt $(version_code 2.10.54) ] && skip "MDS needs to be newer than 2.10.54" @@ -21153,7 +21153,39 @@ test_803() { [ $after_used -le $((before_used + 1)) ] || error "after ($after_used) > before ($before_used) + 1" } -run_test 803 "verify agent object for remote object" +run_test 803a "verify agent object for remote object" + +test_803b() { + [[ $MDSCOUNT -lt 2 ]] && skip_env "needs >= 2 MDTs" + [ $MDS1_VERSION -lt $(version_code 2.13.56) ] && + skip "MDS needs to be newer than 2.13.56" + [ $PARALLEL == "yes" ] && skip "skip parallel run" + + for i in $(seq 0 $((MDSCOUNT - 1))); do + $LFS mkdir -i $i $DIR/$tdir.$i || error "mkdir $tdir.$i" + done + + local before=0 + local after=0 + + local tmp + + stat $DIR/$tdir.* >/dev/null || error "stat $tdir.*" + for i in $(seq 0 $((MDSCOUNT - 1))); do + tmp=$(do_facet mds$i $LCTL get_param mdt.*-MDT000$i.md_stats | + awk '/getattr/ { print $2 }') + before=$((before + tmp)) + done + stat $DIR/$tdir.* >/dev/null || error "stat $tdir.*" + for i in $(seq 0 $((MDSCOUNT - 1))); do + tmp=$(do_facet mds$i $LCTL get_param mdt.*-MDT000$i.md_stats | + awk '/getattr/ { print $2 }') + after=$((after + tmp)) + done + + [ $before -eq $after ] || error "getattr count $before != $after" +} +run_test 803b "remote object can getattr from cache" test_804() { [[ $MDSCOUNT -lt 2 ]] && skip_env "needs >= 2 MDTs" -- 1.8.3.1