Whamcloud - gitweb
LU-13437 mdc: remote object support getattr from cache 18/40218/4
authorLai Siyao <lai.siyao@whamcloud.com>
Sat, 10 Oct 2020 14:34:19 +0000 (22:34 +0800)
committerOleg Drokin <green@whamcloud.com>
Thu, 29 Oct 2020 04:30:41 +0000 (04:30 +0000)
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 <lai.siyao@whamcloud.com>
Change-Id: I3ac38fe34472736849307bb7f1eebb5de9343a5c
Reviewed-on: https://review.whamcloud.com/40218
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Mike Pershin <mpershin@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/mdc/mdc_locks.c
lustre/tests/sanity.sh

index 788a301..496110b 100644 (file)
@@ -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:
index e9b944d..70a40dd 100755 (executable)
@@ -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"