From: Fan Yong Date: Mon, 10 Mar 2014 04:16:51 +0000 (+0800) Subject: LU-4803 ofd: skip orphan cleanup when inject OI error X-Git-Tag: 2.5.58~22 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=0bafbd7d8f652997d83b3cc2419894f48833f424;p=fs%2Flustre-release.git LU-4803 ofd: skip orphan cleanup when inject OI error When inject OI error for simulating some failure cases, the object may be mapped to invalid local target (inode for ldiskfs), so skip the orphan cleanup in OSP to avoid unexpected warning or destroy. Signed-off-by: Fan Yong Change-Id: I8e0a8a9bb4ae584fc8f40f894a19e8f10aa24c10 Reviewed-on: http://review.whamcloud.com/9759 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Lai Siyao Reviewed-by: Alex Zhuravlev Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/obd_support.h b/lustre/include/obd_support.h index 6d4a050..49efb01 100644 --- a/lustre/include/obd_support.h +++ b/lustre/include/obd_support.h @@ -313,6 +313,7 @@ int obd_alloc_fail(const void *ptr, const char *name, const char *type, #define OBD_FAIL_OST_DQACQ_NET 0x230 #define OBD_FAIL_OST_STATFS_EINPROGRESS 0x231 #define OBD_FAIL_OST_SET_INFO_NET 0x232 +#define OBD_FAIL_OST_NODESTROY 0x233 #define OBD_FAIL_LDLM 0x300 #define OBD_FAIL_LDLM_NAMESPACE_NEW 0x301 diff --git a/lustre/ofd/ofd_dev.c b/lustre/ofd/ofd_dev.c index a27e4b0..d7ca3f4 100644 --- a/lustre/ofd/ofd_dev.c +++ b/lustre/ofd/ofd_dev.c @@ -1172,6 +1172,9 @@ static int ofd_orphans_destroy(const struct lu_env *env, LASSERT(exp != NULL); skip_orphan = !!(exp_connect_flags(exp) & OBD_CONNECT_SKIP_ORPHAN); + if (OBD_FAIL_CHECK(OBD_FAIL_OST_NODESTROY)) + goto done; + LCONSOLE(D_INFO, "%s: deleting orphan objects from "DOSTID " to "DOSTID"\n", ofd_name(ofd), seq, end_id + 1, seq, last); @@ -1181,9 +1184,12 @@ static int ofd_orphans_destroy(const struct lu_env *env, GOTO(out_put, rc); rc = ofd_destroy_by_fid(env, ofd, fid, 1); - if (rc != 0 && rc != -ENOENT) /* this is pretty fatal... */ - CEMERG("%s: error destroying precreated id "DFID - ": rc = %d\n", ofd_name(ofd), PFID(fid), rc); + if (rc != 0 && rc != -ENOENT && rc != -ESTALE && + likely(rc != -EREMCHG && rc != -EINPROGRESS)) + /* this is pretty fatal... */ + CEMERG("%s: error destroying precreated id " + DFID": rc = %d\n", + ofd_name(ofd), PFID(fid), rc); oid--; if (!skip_orphan) { @@ -1199,7 +1205,9 @@ static int ofd_orphans_destroy(const struct lu_env *env, CDEBUG(D_HA, "%s: after destroy: set last_id to "DOSTID"\n", ofd_name(ofd), seq, oid); +done: if (!skip_orphan) { + ofd_seq_last_oid_set(oseq, oid); rc = ofd_seq_last_oid_write(env, ofd, oseq); } else { /* don't reuse orphan object, return last used objid */ diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index 8b2d5b9..84f9564 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -466,9 +466,6 @@ static int osd_check_lma(const struct lu_env *env, struct osd_object *obj) int rc; ENTRY; - if (OBD_FAIL_CHECK(OBD_FAIL_OSD_COMPAT_INVALID_ENTRY)) - RETURN(0); - CLASSERT(LMA_OLD_SIZE >= sizeof(*lma)); rc = __osd_xattr_get(inode, dentry, XATTR_NAME_LMA, info->oti_mdt_attrs_old, LMA_OLD_SIZE); diff --git a/lustre/tests/sanity-scrub.sh b/lustre/tests/sanity-scrub.sh index fdbd97f..c043768 100644 --- a/lustre/tests/sanity-scrub.sh +++ b/lustre/tests/sanity-scrub.sh @@ -903,10 +903,13 @@ test_12() { echo "stopall" stopall > /dev/null + + #define OBD_FAIL_OST_NODESTROY 0x233 + do_facet ost1 $LCTL set_param fail_loc=0x233 + echo "setupall" setupall > /dev/null - do_facet ost1 $LCTL set_param fail_loc=0 local STATUS=$($SHOW_SCRUB_ON_OST | awk '/^status/ { print $2 }') [ "$STATUS" == "init" ] || error "(1) Expect 'init', but got '$STATUS'" @@ -918,6 +921,7 @@ test_12() { [ "$STATUS" == "completed" ] || error "(3) Expect 'completed', but got '$STATUS'" + do_facet ost1 $LCTL set_param fail_loc=0 ls -ail $DIR/$tdir > /dev/null 2>&1 || error "(4) ls should succeed" } run_test 12 "OI scrub can rebuild invalid /O entries"