Whamcloud - gitweb
LU-4803 ofd: skip orphan cleanup when inject OI error 59/9759/4
authorFan Yong <fan.yong@intel.com>
Mon, 10 Mar 2014 04:16:51 +0000 (12:16 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 17 Apr 2014 03:48:48 +0000 (03:48 +0000)
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 <fan.yong@intel.com>
Change-Id: I8e0a8a9bb4ae584fc8f40f894a19e8f10aa24c10
Reviewed-on: http://review.whamcloud.com/9759
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/include/obd_support.h
lustre/ofd/ofd_dev.c
lustre/osd-ldiskfs/osd_handler.c
lustre/tests/sanity-scrub.sh

index 6d4a050..49efb01 100644 (file)
@@ -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
index a27e4b0..d7ca3f4 100644 (file)
@@ -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 */
index 8b2d5b9..84f9564 100644 (file)
@@ -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);
index fdbd97f..c043768 100644 (file)
@@ -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"