From bd7a20f8be4644ebce6a7225560ae933204f543d Mon Sep 17 00:00:00 2001 From: Bobi Jam Date: Mon, 17 May 2021 17:14:33 +0800 Subject: [PATCH] LU-14549 llite: refresh layout after mirror merge/split mirror merge/split updates file's LOVEA and revokes client's layout lock, but the client issuing the layout change needs to refresh its layout (lov->lsm) as well. Signed-off-by: Bobi Jam Change-Id: I7671efe2fe5354ba0e1503b146045165608e042c Reviewed-on: https://review.whamcloud.com/43716 Tested-by: jenkins Reviewed-by: Wang Shilong Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- lustre/llite/file.c | 2 ++ lustre/tests/sanity-flr.sh | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/lustre/llite/file.c b/lustre/llite/file.c index c032e19..2a3f726 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -3589,6 +3589,8 @@ out: case LL_LEASE_LAYOUT_SPLIT: if (layout_file) fput(layout_file); + + ll_layout_refresh(inode, &fd->fd_layout_version); break; case LL_LEASE_PCC_ATTACH: if (!rc) diff --git a/lustre/tests/sanity-flr.sh b/lustre/tests/sanity-flr.sh index c26c203..49566ec 100644 --- a/lustre/tests/sanity-flr.sh +++ b/lustre/tests/sanity-flr.sh @@ -2657,6 +2657,40 @@ test_60a() { } run_test 60a "mirror extend sets correct size on sparse file" +get_flr_layout_gen() { + getfattr -n lustre.lov --only-values $tf 2>/dev/null | + od -tx4 | awk '/000000/ { print "0x"$4; exit; }' +} + +check_layout_gen() { + local tf=$1 + + local v1=$(get_flr_layout_gen $tf) + local v2=$($LFS getstripe -v $tf | awk '/lcm_layout_gen/ { print $2 }') + + [[ $v1 -eq $v2 ]] || + error "$tf in-memory layout gen $v1 != $v2 after $2" +} + +test_60b() { + local tf=$DIR/$tdir/$tfile + + test_mkdir $DIR/$tdir + + $LFS setstripe -Eeof $tf || error "setstripe $tf failed" + + for ((i = 0; i < 20; i++)); do + $LFS mirror extend -N $tf || + error "extending mirror for $tf failed" + check_layout_gen $tf "extend" + + $LFS mirror split -d --mirror-id=$((i+1)) $tf || + error "split $tf failed" + check_layout_gen $tf "split" + done +} +run_test 60b "mirror merge/split cancel client's in-memory layout gen" + test_70() { local tf=$DIR/$tdir/$tfile -- 1.8.3.1