From: Sergey Cheremencev Date: Fri, 23 Oct 2015 16:13:51 +0000 (+0300) Subject: LU-7422 mdt: fix ENOENT handling in mdt_intent_reint X-Git-Tag: 2.7.66~46 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=ec9078afb635e8a64a4906b09dc99a2ab90e321b;ds=sidebyside LU-7422 mdt: fix ENOENT handling in mdt_intent_reint In case of DISP_OPEN_CREATE client waits for valid fid value in reply when it_status == 0. When reint_open returns ENOENT fid is not set and client gets fid filled by 0. This may cause following panic: ll_prep_inode()) ASSERTION( fid_is_sane(&md.body->fid1) ) Change-Id: I1c8821f547de11709663565ce509044613564bc5 Signed-off-by: Sergey Cheremencev Xyratex-bug-id: MRP-3073 Reviewed-by: Artem Blagodarenko Reviewed-by: Alexander Zarochentsev Reviewed-by: Alexey Leonidovich Lyashkov Tested-by: Elena V. Gryaznova Reviewed-on: http://review.whamcloud.com/17177 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Lai Siyao Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/obd_support.h b/lustre/include/obd_support.h index 80a31df..439c409 100644 --- a/lustre/include/obd_support.h +++ b/lustre/include/obd_support.h @@ -248,6 +248,7 @@ extern char obd_jobid_var[]; #define OBD_FAIL_MDS_REINT_MULTI_NET 0x159 #define OBD_FAIL_MDS_REINT_MULTI_NET_REP 0x15a #define OBD_FAIL_MDS_LLOG_CREATE_FAILED2 0x15b +#define OBD_FAIL_MDS_FLD_LOOKUP 0x15c #define OBD_FAIL_MDS_INTENT_DELAY 0x160 /* layout lock */ diff --git a/lustre/lod/lod_lov.c b/lustre/lod/lod_lov.c index bea81b4..6d6396d 100644 --- a/lustre/lod/lod_lov.c +++ b/lustre/lod/lod_lov.c @@ -703,7 +703,11 @@ int lod_generate_and_set_lovea(const struct lu_env *env, ostid_cpu_to_le(&info->lti_ostid, &objs[i].l_ost_oi); objs[i].l_ost_gen = cpu_to_le32(0); - rc = lod_fld_lookup(env, lod, fid, &index, &type); + if (OBD_FAIL_CHECK(OBD_FAIL_MDS_FLD_LOOKUP)) + rc = -ENOENT; + else + rc = lod_fld_lookup(env, lod, fid, + &index, &type); if (rc < 0) { CERROR("%s: Can not locate "DFID": rc = %d\n", lod2obd(lod)->obd_name, PFID(fid), rc); diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 4be1e72..449bd3c 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -3283,8 +3283,9 @@ static int mdt_intent_reint(enum mdt_it_code opcode, rep->lock_policy_res2 = clear_serious(rc); if (rep->lock_policy_res2 == -ENOENT && - mdt_get_disposition(rep, DISP_LOOKUP_NEG)) - rep->lock_policy_res2 = 0; + mdt_get_disposition(rep, DISP_LOOKUP_NEG) && + !mdt_get_disposition(rep, DISP_OPEN_CREATE)) + rep->lock_policy_res2 = 0; lhc->mlh_reg_lh.cookie = 0ull; if (rc == -ENOTCONN || rc == -ENODEV || diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index ccf10b3..55d8ebc 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -14326,6 +14326,15 @@ test_401() { #LU-7437 } run_test 401 "Verify if 'lctl list_param -R' can list parameters recursively" +test_402() { + $LFS setdirstripe -i 0 $DIR/$tdir || error "setdirstripe -i 0 failed" +#define OBD_FAIL_MDS_FLD_LOOKUP 0x15c + do_facet mds1 "lctl set_param fail_loc=0x8000015c" + touch $DIR/$tdir/$tfile && error "touch should fail with ENOENT" || + echo "Touch failed - OK" +} +run_test 402 "Return ENOENT to lod_generate_and_set_lovea" + # # tests that do cleanup/setup should be run at the end #