Whamcloud - gitweb
LU-13599 mdt: add test for rs_lock limit exceeding 94/39194/4
authorMikhail Pershin <mpershin@whamcloud.com>
Fri, 26 Jun 2020 17:19:05 +0000 (20:19 +0300)
committerOleg Drokin <green@whamcloud.com>
Tue, 8 Sep 2020 18:09:18 +0000 (18:09 +0000)
The check conditions in mdt_link_parents_lock() considers there
can be total 6 local locks but in fact when object has hard links
then it is regular file and it may have maximum 5 local locks.

Patch updates that check conditions for rs_locks as small
improvement and ports test for rs_locks limit from 2.12.

Signed-off-by: Mikhail Pershin <mpershin@whamcloud.com>
Change-Id: I98cca84825ce5789094fbceb5d1f7975410d134b
Reviewed-on: https://review.whamcloud.com/39194
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Lai Siyao <lai.siyao@whamcloud.com>
Reviewed-by: Stephane Thiell <sthiell@stanford.edu>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/mdt/mdt_reint.c
lustre/tests/sanity.sh

index ad225ae..35eac50 100644 (file)
@@ -1801,15 +1801,20 @@ static int mdt_link_parents_lock(struct mdt_thread_info *info,
 
        EXIT;
 out:
-       if (rc)
+       if (rc) {
                mdt_unlock_list(info, link_locks, rc);
-       else if (local_lnkp_cnt > RS_MAX_LOCKS - 6)
+       } else if (local_lnkp_cnt > RS_MAX_LOCKS - 5) {
+               CDEBUG(D_INFO, "Too many links (%d), sync operations\n",
+                      local_lnkp_cnt);
                /*
                 * parent may have 3 local objects: master object and 2 stripes
-                * (if it's being migrated too); source may have 2 local
-                * objects: master and 1 stripe; target has 1 local object.
+                * (if it's being migrated too); source may have 1 local objects
+                * as regular file; target has 1 local object.
+                * Note, source may have 2 local locks if it is directory but it
+                * can't have hardlinks, so it is not considered here.
                 */
                rc = 1;
+       }
        return rc;
 }
 
index d69da54..f509d96 100755 (executable)
@@ -18309,6 +18309,41 @@ test_230q() {
 }
 run_test 230q "dir auto split"
 
+test_230r() {
+       [[ $PARALLEL != "yes" ]] || skip "skip parallel run"
+       [[ $MDSCOUNT -ge 2 ]] || skip_env "needs >= 2 MDTs"
+       [[ $MDS1_VERSION -ge $(version_code 2.13.54) ]] ||
+               skip "Need MDS version at least 2.13.54"
+
+       # maximum amount of local locks:
+       # parent striped dir - 2 locks
+       # new stripe in parent to migrate to - 1 lock
+       # source and target - 2 locks
+       # Total 5 locks for regular file
+       mkdir -p $DIR/$tdir
+       $LFS mkdir -i1 -c2 $DIR/$tdir/dir1
+       touch $DIR/$tdir/dir1/eee
+
+       # create 4 hardlink for 4 more locks
+       # Total: 9 locks > RS_MAX_LOCKS (8)
+       $LFS mkdir -i1 -c1 $DIR/$tdir/dir2
+       $LFS mkdir -i1 -c1 $DIR/$tdir/dir3
+       $LFS mkdir -i1 -c1 $DIR/$tdir/dir4
+       $LFS mkdir -i1 -c1 $DIR/$tdir/dir5
+       ln $DIR/$tdir/dir1/eee $DIR/$tdir/dir2/eee
+       ln $DIR/$tdir/dir1/eee $DIR/$tdir/dir3/eee
+       ln $DIR/$tdir/dir1/eee $DIR/$tdir/dir4/eee
+       ln $DIR/$tdir/dir1/eee $DIR/$tdir/dir5/eee
+
+       cancel_lru_locks mdc
+
+       $LFS migrate -m1 -c1 $DIR/$tdir/dir1 ||
+               error "migrate dir fails"
+
+       rm -rf $DIR/$tdir || error "rm dir failed after migration"
+}
+run_test 230r "migrate with too many local locks"
+
 test_231a()
 {
        # For simplicity this test assumes that max_pages_per_rpc