Whamcloud - gitweb
LU-7463 osd: Change existence assert into error 24/17324/2
authorDi Wang <di.wang@intel.com>
Sat, 21 Nov 2015 15:42:27 +0000 (07:42 -0800)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 30 Nov 2015 17:18:59 +0000 (17:18 +0000)
In osd_declare_xx(), some objects might not existent,
especially when calling out_handler(). Let's change
these assert into -ENOENT error to avoid panic on
MDS.

Signed-off-by: Di Wang <di.wang@intel.com>
Change-Id: If17a013a6939a1ebe0519406d39e405fd915110f
Reviewed-on: http://review.whamcloud.com/17324
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
lustre/osd-ldiskfs/osd_handler.c

index 0369122..1d6d100 100644 (file)
@@ -2468,9 +2468,11 @@ static int osd_declare_object_destroy(const struct lu_env *env,
        int                 rc;
        ENTRY;
 
+       if (inode == NULL)
+               RETURN(-ENOENT);
+
        oh = container_of0(th, struct osd_thandle, ot_super);
        LASSERT(oh->ot_handle == NULL);
-       LASSERT(inode);
 
        osd_trans_declare_op(env, oh, OSD_OT_DESTROY,
                             osd_dto_credits_noquota[DTO_OBJECT_DELETE]);
@@ -2943,6 +2945,9 @@ static int osd_declare_object_ref_del(const struct lu_env *env,
 {
        struct osd_thandle *oh;
 
+       if (!dt_object_exists(dt))
+               return -ENOENT;
+
        LASSERT(!dt_object_remote(dt));
        LASSERT(handle != NULL);
 
@@ -3602,7 +3607,8 @@ static int osd_index_declare_ea_delete(const struct lu_env *env,
                             osd_dto_credits_noquota[DTO_OBJECT_DELETE]);
 
        inode = osd_dt_obj(dt)->oo_inode;
-       LASSERT(inode);
+       if (inode == NULL)
+               RETURN(-ENOENT);
 
        rc = osd_declare_inode_qid(env, i_uid_read(inode), i_gid_read(inode),
                                   0, oh, osd_dt_obj(dt), true, NULL, false);