From: Lai Siyao Date: Sat, 10 Oct 2020 14:34:19 +0000 (+0800) Subject: LU-13437 mdc: remote object support getattr from cache X-Git-Tag: 2.13.57~115 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=72a1ca996e3a35ce3e4b7e517f77ff7ac83ccdd5 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. Signed-off-by: Lai Siyao Change-Id: I3ac38fe34472736849307bb7f1eebb5de9343a5c Reviewed-on: https://review.whamcloud.com/40218 Tested-by: jenkins Reviewed-by: Andreas Dilger Reviewed-by: Mike Pershin Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/mdc/mdc_locks.c b/lustre/mdc/mdc_locks.c index 788a301..496110b 100644 --- a/lustre/mdc/mdc_locks.c +++ b/lustre/mdc/mdc_locks.c @@ -1242,7 +1242,6 @@ int mdc_revalidate_lock(struct obd_export *exp, struct lookup_intent *it, * 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 e9b944d..70a40dd 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -23843,7 +23843,7 @@ test_802b() { } run_test 802b "be able to set MDTs to readonly" -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" @@ -23891,7 +23891,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"