Whamcloud - gitweb
LU-10155 recovery: support setstripe replay 04/30704/8
authorLai Siyao <lai.siyao@intel.com>
Thu, 4 Jan 2018 01:38:43 +0000 (09:38 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 31 Jan 2018 05:52:11 +0000 (05:52 +0000)
Regular file open will always reserve space for LOV ea, which is used
to store user specified lov_user_md, or lov_mds_md for replay, but if
this open is the first open in 'lfs setstripe', it doesn't have
lov_user_md specified, or lov_mds_md for replay because
O_LOV_DELAY_CREATE is set, but MDT will treat the EA field in the
request as valid one, so fails in magic check in this open replay.

This patch fixes this issues on both sides:
1. client doesn't reserve space for LOV ea in
   open(O_LOV_DELAY_CREATE), this change is not necessary, but to
   make clean of the code.
2. server doesn't create OST objects for open(O_LOV_DELAY_CREATE)
   replay.

Add setstripe/setdirstripe replay test in replay-single.sh, which
are 2c, 2d.

Signed-off-by: Lai Siyao <lai.siyao@intel.com>
Change-Id: Ia7971523710822308328239f36f7d690314e0e45
Reviewed-on: https://review.whamcloud.com/30704
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/mdc/mdc_locks.c
lustre/mdd/mdd_dir.c
lustre/tests/replay-single.sh

index 546b7f5..d5f054c 100644 (file)
@@ -300,8 +300,14 @@ mdc_intent_open_pack(struct obd_export *exp, struct lookup_intent *it,
 
         req_capsule_set_size(&req->rq_pill, &RMF_NAME, RCL_CLIENT,
                              op_data->op_namelen + 1);
-       req_capsule_set_size(&req->rq_pill, &RMF_EADATA, RCL_CLIENT,
+       if (cl_is_lov_delay_create(it->it_flags)) {
+               /* open(O_LOV_DELAY_CREATE) won't pack lmm */
+               LASSERT(lmmsize == 0);
+               req_capsule_set_size(&req->rq_pill, &RMF_EADATA, RCL_CLIENT, 0);
+       } else {
+               req_capsule_set_size(&req->rq_pill, &RMF_EADATA, RCL_CLIENT,
                             max(lmmsize, obddev->u.cli.cl_default_mds_easize));
+       }
 
        req_capsule_set_size(&req->rq_pill, &RMF_FILE_SECCTX_NAME,
                             RCL_CLIENT, op_data->op_file_secctx_name != NULL ?
index e421b08..af74cfe 100644 (file)
@@ -2249,7 +2249,7 @@ static int mdd_declare_create_object(const struct lu_env *env,
                GOTO(out, rc);
 
        /* replay case, create LOV EA from client data */
-       if (spec->no_create ||
+       if ((!(spec->sp_cr_flags & MDS_OPEN_DELAY_CREATE) && spec->no_create) ||
            (spec->sp_cr_flags & MDS_OPEN_HAS_EA && S_ISREG(attr->la_mode))) {
                buf = mdd_buf_get_const(env, spec->u.sp_ea.eadata,
                                        spec->u.sp_ea.eadatalen);
index 3327962..0d0954a 100755 (executable)
@@ -119,6 +119,24 @@ test_2b() {
 }
 run_test 2b "touch"
 
+test_2c() {
+       replay_barrier $SINGLEMDS
+       $LFS setstripe -c $OSTCOUNT $DIR/$tfile
+       fail $SINGLEMDS
+       $CHECKSTAT -t file $DIR/$tfile ||
+               error "$CHECKSTAT $DIR/$tfile check failed"
+}
+run_test 2c "setstripe replay"
+
+test_2d() {
+       replay_barrier $SINGLEMDS
+       $LFS setdirstripe -i 0 -c $MDSCOUNT $DIR/$tdir
+       fail $SINGLEMDS
+       $CHECKSTAT -t dir $DIR/$tdir ||
+               error "$CHECKSTAT $DIR/$tdir check failed"
+}
+run_test 2d "setdirstripe replay"
+
 test_3a() {
        local file=$DIR/$tfile
        replay_barrier $SINGLEMDS