Whamcloud - gitweb
LU-7579 mdd: do not mark object as an orphan early 44/18444/2
authorAlex Zhuravlev <alexey.zhuravlev@intel.com>
Sat, 13 Feb 2016 14:51:27 +0000 (17:51 +0300)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 15 Feb 2016 05:45:43 +0000 (05:45 +0000)
do not set LUSTRE_ORPHAN_FL before calling __mdd_orphan_add()
as racing mdd_la_get() may set ORPHAN_OBJ causing an false
assertion in __mdd_orphan_add().

Change-Id: If8a9417cdb3c0a9d1e96ac1345e841dc5fc89b53
Signed-off-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-on: http://review.whamcloud.com/18444
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Yang Sheng <yang.sheng@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/mdd/mdd_dir.c

index 6f7f17c..22c3f2b 100644 (file)
@@ -1467,10 +1467,6 @@ int mdd_finish_unlink(const struct lu_env *env,
                 * will be deleted during mdd_close() */
                obj->mod_flags |= DEAD_OBJ;
                if (obj->mod_count) {
                 * will be deleted during mdd_close() */
                obj->mod_flags |= DEAD_OBJ;
                if (obj->mod_count) {
-                       rc = mdd_mark_orphan_object(env, obj, th, false);
-                       if (rc != 0)
-                               RETURN(rc);
-
                        rc = __mdd_orphan_add(env, obj, th);
                        if (rc == 0)
                                CDEBUG(D_HA, "Object "DFID" is inserted into "
                        rc = __mdd_orphan_add(env, obj, th);
                        if (rc == 0)
                                CDEBUG(D_HA, "Object "DFID" is inserted into "
@@ -1483,6 +1479,12 @@ int mdd_finish_unlink(const struct lu_env *env,
                                       "open replay\n",
                                        PFID(mdd_object_fid(obj)),
                                        obj->mod_count);
                                       "open replay\n",
                                        PFID(mdd_object_fid(obj)),
                                        obj->mod_count);
+
+                       /* mark object as an orphan here, not
+                        * before __mdd_orphan_add() as racing
+                        * mdd_la_get() may propagate ORPHAN_OBJ
+                        * causing the asserition */
+                       rc = mdd_mark_orphan_object(env, obj, th, false);
                } else {
                        rc = mdo_destroy(env, obj, th);
                }
                } else {
                        rc = mdo_destroy(env, obj, th);
                }