Whamcloud - gitweb
LU-15529 mdt: optimize dir migration locking 91/40891/25
authorLai Siyao <lai.siyao@whamcloud.com>
Sun, 16 May 2021 06:46:21 +0000 (14:46 +0800)
committerOleg Drokin <green@whamcloud.com>
Wed, 10 May 2023 21:38:25 +0000 (21:38 +0000)
commit1d6b96a1cf0468bc81949960aa649cde8f927008
treed45ef35bbca29a7142cf662b755e93c840aef256
parentc2e5181fe1faec6f375ea7512f60edd802e33946
LU-15529 mdt: optimize dir migration locking

Optimize dir migration locking and fix some deadlocks:
* don't lock all stripes of parent, but source and target parent
  stripes only.
* use mdt_rename_source_lock() to lock source, because directory
  stripes are not changed in migration.
* refactor migrate links locking code.
* pass spobj and tpobj to mdo_migrate() interface to avoid parsing
  parent directory layout in MDD layer again.
* never lock the same FID twice, which may lead to deadlock:
  . if link parent is local, don't hold local LOOKUP lock, but revoke
    only, because later we need to lock other ibits of sobj.
  . if sobj is plain directory, unlock sobj before locking tobj,
    because sobj will become a stripe of tobj during migration.
* enable striped directory migration in racer test.

Also update sanityn 80b to migrate directory and access it for one
minute and verify filesystem is not broken, though both migration and
directory access may fail in this period.

Test-Parameters: env=SLOW=y mdscount=2 mdtcount=4 testlist=racer,racer,racer
Signed-off-by: Lai Siyao <lai.siyao@whamcloud.com>
Change-Id: Ie9859df244529c986c2f3f032a49e3f9c89a2747
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/40891
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Qian Yingjin <qian@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
12 files changed:
lustre/include/md_object.h
lustre/mdd/mdd_dir.c
lustre/mdt/mdt_handler.c
lustre/mdt/mdt_internal.h
lustre/mdt/mdt_lib.c
lustre/mdt/mdt_reint.c
lustre/mdt/mdt_restripe.c
lustre/mdt/mdt_xattr.c
lustre/tests/racer.sh
lustre/tests/racer/dir_migrate.sh
lustre/tests/racer/racer.sh
lustre/tests/sanityn.sh