Whamcloud - gitweb
LU-14549 llite: refresh layout after mirror merge/split 16/43716/3
authorBobi Jam <bobijam@whamcloud.com>
Mon, 17 May 2021 09:14:33 +0000 (17:14 +0800)
committerOleg Drokin <green@whamcloud.com>
Thu, 27 May 2021 18:18:40 +0000 (18:18 +0000)
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 <bobijam@whamcloud.com>
Change-Id: I7671efe2fe5354ba0e1503b146045165608e042c
Reviewed-on: https://review.whamcloud.com/43716
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Wang Shilong <wshilong@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/llite/file.c
lustre/tests/sanity-flr.sh

index c032e19..2a3f726 100644 (file)
@@ -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)
index c26c203..49566ec 100644 (file)
@@ -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