From: Andriy Skulysh Date: Wed, 16 Sep 2020 11:38:41 +0000 (+0300) Subject: LU-15107 mdt: Exclusive create isn't replayed X-Git-Tag: 2.14.56~66 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=da14903c4394cb476386c475ade5eda12b2a8aa7 LU-15107 mdt: Exclusive create isn't replayed mdt_finish_open() fails on exclusive create check as there isn't an infrormation that the file was created. Set DISP_OPEN_CREATE for exclusive open replay, as we know that the original request has succeeded. Change-Id: Idc71db76b757670b91b3bb1718870a018a805ed2 HPE-bug-id: LUS-9358 Signed-off-by: Andriy Skulysh Reviewed-by: Vitaly Fertman Reviewed-by: Alexander Zarochentsev Reviewed-on: https://review.whamcloud.com/45254 Reviewed-by: Andreas Dilger Reviewed-by: Alexander Zarochentsev Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/mdt/mdt_open.c b/lustre/mdt/mdt_open.c index bc5ad6a..d59e92d 100644 --- a/lustre/mdt/mdt_open.c +++ b/lustre/mdt/mdt_open.c @@ -780,6 +780,11 @@ static int mdt_open_by_fid(struct mdt_thread_info *info, struct ldlm_reply *rep) mdt_set_disposition(info, rep, (DISP_IT_EXECD | DISP_LOOKUP_EXECD | DISP_LOOKUP_POS)); + if ((open_flags & MDS_OPEN_EXCL) && + (open_flags & MDS_OPEN_CREAT)) + mdt_set_disposition(info, rep, + DISP_OPEN_CREATE); + mdt_prep_ma_buf_from_rep(info, o, ma); rc = mdt_attr_get_complex(info, o, ma); if (rc == 0) diff --git a/lustre/tests/replay-single.sh b/lustre/tests/replay-single.sh index 8ff29c9..a2c290f 100755 --- a/lustre/tests/replay-single.sh +++ b/lustre/tests/replay-single.sh @@ -134,6 +134,23 @@ test_2d() { } run_test 2d "setdirstripe replay" +test_2e() { + testid=$(echo $TESTNAME | tr '_' ' ') + #define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b + do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x8000013b" + openfile -f O_CREAT:O_EXCL $DIR/$tfile & + sleep 1 + replay_barrier $SINGLEMDS + fail $SINGLEMDS + wait + $CHECKSTAT -t file $DIR/$tfile || + error "$CHECKSTAT $DIR/$tfile attribute check failed" + dmesg | tac | sed "/$testid/,$ d" | \ + grep "Open request replay failed with -17" && + error "open replay failed" || true +} +run_test 2e "O_CREAT|O_EXCL create replay" + test_3a() { local file=$DIR/$tfile replay_barrier $SINGLEMDS