Whamcloud - gitweb
LU-15609 flr: Don't assume RDONLY implies SOM 66/46666/5
authorPatrick Farrell <pfarrell@whamcloud.com>
Mon, 7 Mar 2022 20:29:26 +0000 (15:29 -0500)
committerOleg Drokin <green@whamcloud.com>
Mon, 27 Jun 2022 04:37:43 +0000 (04:37 +0000)
In lov_io_slice_mirror_init, the client code assumes that
the LCM_FL_RDONLY flag in the layout implies SOM and skips
glimpse if it sees one.  The RDONLY flag means the mirrors
are in sync, which has historically implied SOM is valid.

To start with, using LCM_FL_RDONLY to imply SOM is sort of
a layering violation.  SOM is only communicated from the
MDS when it is valid, and the client already skips glimpse
in that case, so this duplicates functionality from the
higher layers.

More seriously, patch:
"LU-14526 flr: mirror split downgrade SOM"
(https://review.whamcloud.com/43168/)
Made it possible to have LCM_FL_RDONLY but not strict SOM,
so this assumption is no longer correct.

The fix is to not look at LCM_FL_RDONLY when deciding
whether to glimpse a file for size.

Fixes: d87b6f4d1c ("LU-14526 flr: mirror split downgrade SOM")
Signed-off-by: Patrick Farrell <pfarrell@whamcloud.com>
Change-Id: I5ed0a2124005bc58c1ed11681c9bd642cffcd1b5
Reviewed-on: https://review.whamcloud.com/46666
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: John L. Hammond <jhammond@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/obd_support.h
lustre/lov/lov_io.c
lustre/tests/sanity-flr.sh

index a927d2c..2e2ad79 100644 (file)
@@ -684,7 +684,6 @@ extern char obd_jobid_var[];
 #define OBD_FAIL_UNKNOWN_LMV_STRIPE            0x1901
 
 /* FLR */
-#define OBD_FAIL_FLR_GLIMPSE_IMMUTABLE         0x1A00
 #define OBD_FAIL_FLR_LV_DELAY                  0x1A01
 #define OBD_FAIL_FLR_LV_INC                    0x1A02
 #define OBD_FAIL_FLR_RANDOM_PICK_MIRROR        0x1A03
index 381ae56..cc95993 100644 (file)
@@ -551,11 +551,6 @@ static int lov_io_slice_init(struct lov_io *lio,
        case CIT_GLIMPSE:
                lio->lis_pos = 0;
                lio->lis_endpos = OBD_OBJECT_EOF;
-
-               if (lov_flr_state(obj) == LCM_FL_RDONLY &&
-                   !OBD_FAIL_CHECK(OBD_FAIL_FLR_GLIMPSE_IMMUTABLE))
-                       /* SoM is accurate, no need glimpse */
-                       GOTO(out, result = 1);
                break;
 
        case CIT_MISC:
index 4d14a8f..e50979d 100644 (file)
@@ -1061,9 +1061,6 @@ test_31() {
        $LFS mirror create -N -o 0 -N -o 1 $tf ||
                error "creating mirrored file $tf failed"
 
-       #define OBD_FAIL_GLIMPSE_IMMUTABLE 0x1A00
-       $LCTL set_param fail_loc=0x1A00
-
        local ost_idx
        for ((ost_idx = 1; ost_idx <= 2; ost_idx++)); do
                cancel_lru_locks osc
@@ -2173,6 +2170,48 @@ test_44c() {
 }
 run_test 44c "lfs mirror split reduces block size of a file"
 
+test_44d() {
+       local tf=$DIR/$tdir/$tfile
+       local size1
+       local size2
+       local size3
+       local size4
+
+       stack_trap "rm -f $tf"
+
+       mkdir -p $DIR/$tdir || error "create directroy failed"
+
+       dd if=/dev/zero of=$tf bs=1M count=10 || error "dd write $tfile failed"
+       sync
+       size1=$(stat -c "%s" $tf)
+       echo " ** before mirror ops, file size=$size1"
+
+       $LFS mirror extend -N2 -c1 $tf || error "mirror extend $tfile failed"
+       sync
+       size2=$(stat -c "%s" $tf)
+       echo " ** after mirror extend, file size=$size2"
+
+       (($size1 == $size2)) ||
+               error "mirror extend should not change size, before: $size1, after $size2"
+
+       $LFS mirror split -d --mirror-id=2 $tf ||
+               error "mirror split $tfile failed"
+
+       size2=$(stat -c "%s" $tf)
+       echo " ** after mirror split, file size=$size2"
+       (($size1 == $size2)) ||
+               error "mirror split should not change size, before: $size1, after $size2"
+
+       # Remount client to clear cached size information
+       remount_client $MOUNT
+       size2=$(stat -c "%s" $tf)
+       echo " ** after mirror split & remount, file size=$size2"
+       (($size1 == $size2)) ||
+               error "mirror extend should not change size, before: $size1, after $size2"
+
+}
+run_test 44d "lfs mirror split does not break size"
+
 test_45() {
        [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"