Whamcloud - gitweb
LU-12040 mdc: reset lmm->lmm_stripe_offset in mdc_save_lovea 71/34371/7
authorAlexey Lyashkov <c17817@cray.com>
Mon, 4 Mar 2019 14:46:33 +0000 (17:46 +0300)
committerOleg Drokin <green@whamcloud.com>
Tue, 30 Apr 2019 03:35:19 +0000 (03:35 +0000)
In order to prepare for replay lmm->lmm_stripe_offset (which contains
layout generation) has to be set to -1 (LOV_OFFSET_DEFAULT) in order
to not confuse lod_verify_v1v3

Fixes: f90abfdc96 ("LU-169 lov: add generation number to LOV EA")
Fixes: 89693927f0 ("LU-8998 lod: accomodate to composite layout")
Signed-off-by: Vladimir Saveliev <c17830@cray.com>
Cray-bug-id: LUS-7008
Change-Id: I911d3c659b6c11cc8847f0517062dd8e4df89dff
Reviewed-on: https://review.whamcloud.com/34371
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Mike Pershin <mpershin@whamcloud.com>
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/uapi/linux/lustre/lustre_user.h
lustre/lod/lod_internal.h
lustre/mdc/mdc_lib.c
lustre/mdc/mdc_locks.c
lustre/tests/replay-single.sh

index a3bd790..6229b61 100644 (file)
@@ -556,6 +556,8 @@ struct fsxattr {
 #define LOV_PATTERN_F_RELEASED 0x80000000 /* HSM released file */
 #define LOV_PATTERN_DEFAULT    0xffffffff
 
 #define LOV_PATTERN_F_RELEASED 0x80000000 /* HSM released file */
 #define LOV_PATTERN_DEFAULT    0xffffffff
 
+#define LOV_OFFSET_DEFAULT      ((__u16)-1)
+
 static inline bool lov_pattern_supported(__u32 pattern)
 {
        return (pattern & ~LOV_PATTERN_F_RELEASED) == LOV_PATTERN_RAID0 ||
 static inline bool lov_pattern_supported(__u32 pattern)
 {
        return (pattern & ~LOV_PATTERN_F_RELEASED) == LOV_PATTERN_RAID0 ||
index 62bab33..83fb539 100644 (file)
@@ -54,8 +54,6 @@
 #define LMVEA_DELETE_VALUES(count, offset)                             \
        ((count) == 0 && (offset) == (typeof(offset))(-1))
 
 #define LMVEA_DELETE_VALUES(count, offset)                             \
        ((count) == 0 && (offset) == (typeof(offset))(-1))
 
-#define LOV_OFFSET_DEFAULT             ((__u16)-1)
-
 struct lod_qos_rr {
        spinlock_t               lqr_alloc;     /* protect allocation index */
        __u32                    lqr_start_idx; /* start index of new inode */
 struct lod_qos_rr {
        spinlock_t               lqr_alloc;     /* protect allocation index */
        __u32                    lqr_start_idx; /* start index of new inode */
index dcc4250..cd6f2ca 100644 (file)
@@ -416,7 +416,8 @@ void mdc_setattr_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
                lum->lmm_magic = cpu_to_le32(LOV_USER_MAGIC_V1);
                lum->lmm_stripe_size = 0;
                lum->lmm_stripe_count = 0;
                lum->lmm_magic = cpu_to_le32(LOV_USER_MAGIC_V1);
                lum->lmm_stripe_size = 0;
                lum->lmm_stripe_count = 0;
-               lum->lmm_stripe_offset = (typeof(lum->lmm_stripe_offset))(-1);
+               lum->lmm_stripe_offset =
+                 (typeof(lum->lmm_stripe_offset))LOV_OFFSET_DEFAULT;
        } else {
                memcpy(lum, ea, ealen);
        }
        } else {
                memcpy(lum, ea, ealen);
        }
index 24cea59..13e63ba 100644 (file)
@@ -220,7 +220,7 @@ int mdc_save_lovea(struct ptlrpc_request *req,
                   void *data, u32 size)
 {
        struct req_capsule *pill = &req->rq_pill;
                   void *data, u32 size)
 {
        struct req_capsule *pill = &req->rq_pill;
-       void *lmm;
+       struct lov_user_md *lmm;
        int rc = 0;
 
        if (req_capsule_get_size(pill, field, RCL_CLIENT) < size) {
        int rc = 0;
 
        if (req_capsule_get_size(pill, field, RCL_CLIENT) < size) {
@@ -237,8 +237,12 @@ int mdc_save_lovea(struct ptlrpc_request *req,
 
        req_capsule_set_size(pill, field, RCL_CLIENT, size);
        lmm = req_capsule_client_get(pill, field);
 
        req_capsule_set_size(pill, field, RCL_CLIENT, size);
        lmm = req_capsule_client_get(pill, field);
-       if (lmm)
+       if (lmm) {
                memcpy(lmm, data, size);
                memcpy(lmm, data, size);
+               /* overwrite layout generation returned from the MDS */
+               lmm->lmm_stripe_offset =
+                 (typeof(lmm->lmm_stripe_offset))LOV_OFFSET_DEFAULT;
+       }
 
        return rc;
 }
 
        return rc;
 }
index 3b53bac..2bf9555 100755 (executable)
@@ -4915,6 +4915,25 @@ test_133() {
 }
 run_test 133 "check resend of ongoing requests for lwp during failover"
 
 }
 run_test 133 "check resend of ongoing requests for lwp during failover"
 
+test_134() {
+       [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return 0
+
+       pool_add pool_134
+       pool_add_targets pool_134 1 1
+
+       mkdir $DIR/$tdir
+       $LFS setstripe -p pool_134 $DIR/$tdir
+
+       replay_barrier mds1
+
+       touch $DIR/$tdir/$tfile
+
+       fail mds1
+
+       [ -f $DIR/$tdir/$tfile ] || error "file does not exist"
+}
+run_test 134 "replay creation of a file created in a pool"
+
 complete $SECONDS
 check_and_cleanup_lustre
 exit_status
 complete $SECONDS
 check_and_cleanup_lustre
 exit_status