From: Alexey Lyashkov Date: Mon, 4 Mar 2019 14:46:33 +0000 (+0300) Subject: LU-12040 mdc: reset lmm->lmm_stripe_offset in mdc_save_lovea X-Git-Tag: 2.12.53~29 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=c872afa36ff5de5910f0f524f7a487982fa0c776 LU-12040 mdc: reset lmm->lmm_stripe_offset in mdc_save_lovea 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 Cray-bug-id: LUS-7008 Change-Id: I911d3c659b6c11cc8847f0517062dd8e4df89dff Reviewed-on: https://review.whamcloud.com/34371 Reviewed-by: Andreas Dilger Reviewed-by: Mike Pershin Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/uapi/linux/lustre/lustre_user.h b/lustre/include/uapi/linux/lustre/lustre_user.h index a3bd790..6229b61 100644 --- a/lustre/include/uapi/linux/lustre/lustre_user.h +++ b/lustre/include/uapi/linux/lustre/lustre_user.h @@ -556,6 +556,8 @@ struct fsxattr { #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 || diff --git a/lustre/lod/lod_internal.h b/lustre/lod/lod_internal.h index 62bab33..83fb539 100644 --- a/lustre/lod/lod_internal.h +++ b/lustre/lod/lod_internal.h @@ -54,8 +54,6 @@ #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 */ diff --git a/lustre/mdc/mdc_lib.c b/lustre/mdc/mdc_lib.c index dcc4250..cd6f2ca2 100644 --- a/lustre/mdc/mdc_lib.c +++ b/lustre/mdc/mdc_lib.c @@ -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_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); } diff --git a/lustre/mdc/mdc_locks.c b/lustre/mdc/mdc_locks.c index 24cea59..13e63ba 100644 --- a/lustre/mdc/mdc_locks.c +++ b/lustre/mdc/mdc_locks.c @@ -220,7 +220,7 @@ int mdc_save_lovea(struct ptlrpc_request *req, 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) { @@ -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); - if (lmm) + if (lmm) { 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; } diff --git a/lustre/tests/replay-single.sh b/lustre/tests/replay-single.sh index 3b53bac..2bf9555 100755 --- a/lustre/tests/replay-single.sh +++ b/lustre/tests/replay-single.sh @@ -4915,6 +4915,25 @@ test_133() { } 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