Whamcloud - gitweb
LU-7422 mdt: fix ENOENT handling in mdt_intent_reint 77/17177/5
authorSergey Cheremencev <sergey.cheremencev@seagate.com>
Fri, 23 Oct 2015 16:13:51 +0000 (19:13 +0300)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 14 Jan 2016 03:59:21 +0000 (03:59 +0000)
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 <sergey.cheremencev@seagate.com>
Xyratex-bug-id: MRP-3073
Reviewed-by: Artem Blagodarenko <artem.blagodarenko@seagate.com>
Reviewed-by: Alexander Zarochentsev <alexander.zarochentsev@seagate.com>
Reviewed-by: Alexey Leonidovich Lyashkov <alexey.lyashkov@seagate.com>
Tested-by: Elena V. Gryaznova <elena.gryaznova@seagate.com>
Reviewed-on: http://review.whamcloud.com/17177
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/include/obd_support.h
lustre/lod/lod_lov.c
lustre/mdt/mdt_handler.c
lustre/tests/sanity.sh

index 80a31df..439c409 100644 (file)
@@ -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 */
index bea81b4..6d6396d 100644 (file)
@@ -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);
index 4be1e72..449bd3c 100644 (file)
@@ -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 ||
index ccf10b3..55d8ebc 100755 (executable)
@@ -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
 #