Whamcloud - gitweb
LU-2193 ofd: check object exists before orphan destroy
authorBobi Jam <bobijam.xu@intel.com>
Mon, 6 May 2013 02:05:05 +0000 (10:05 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 6 May 2013 16:06:59 +0000 (12:06 -0400)
MDS replay object destroys after recovery could meet non-existing
objects, skip it before following futile actions.

Signed-off-by: Bobi Jam <bobijam.xu@intel.com>
Change-Id: Ibf233a07fa73d3226fdde5e2c020e73f51428f74
Reviewed-on: http://review.whamcloud.com/6266
Tested-by: Hudson
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
lustre/ofd/ofd_obd.c

index 059d0e2..7ce79de 100644 (file)
@@ -1013,6 +1013,8 @@ static int ofd_destroy_by_fid(const struct lu_env *env,
        fo = ofd_object_find(env, ofd, fid);
        if (IS_ERR(fo))
                RETURN(PTR_ERR(fo));
        fo = ofd_object_find(env, ofd, fid);
        if (IS_ERR(fo))
                RETURN(PTR_ERR(fo));
+       if (!ofd_object_exists(fo))
+               GOTO(out, rc = -ENOENT);
 
        /* Tell the clients that the object is gone now and that they should
         * throw away any cached pages. */
 
        /* Tell the clients that the object is gone now and that they should
         * throw away any cached pages. */
@@ -1029,7 +1031,8 @@ static int ofd_destroy_by_fid(const struct lu_env *env,
        LASSERT(fo != NULL);
 
        rc = ofd_object_destroy(env, fo, orphan);
        LASSERT(fo != NULL);
 
        rc = ofd_object_destroy(env, fo, orphan);
-
+       EXIT;
+out:
        ofd_object_put(env, fo);
        RETURN(rc);
 }
        ofd_object_put(env, fo);
        RETURN(rc);
 }