Whamcloud - gitweb
LU-10337 mdt: Allow open of open orphans
[fs/lustre-release.git] / lustre / mdd / mdd_object.c
index 3fedd2d..1025a0d 100644 (file)
@@ -2988,8 +2988,11 @@ static int mdd_open_sanity_check(const struct lu_env *env,
        int mode, rc;
        ENTRY;
 
        int mode, rc;
        ENTRY;
 
-       /* EEXIST check */
-       if (mdd_is_dead_obj(obj))
+       /* EEXIST check, also opening of *open* orphans is allowed so we can
+        * open-by-handle unlinked files
+        */
+       if (mdd_is_dead_obj(obj) &&
+           likely(!(mdd_is_orphan_obj(obj) && obj->mod_count > 0)))
                RETURN(-ENOENT);
 
        if (S_ISLNK(attr->la_mode))
                RETURN(-ENOENT);
 
        if (S_ISLNK(attr->la_mode))