Whamcloud - gitweb
LU-5370 mdt: return -MDT_EREMOTE_OPEN for remote open
[fs/lustre-release.git] / lustre / mdt / mdt_open.c
index e25e4fd..d179df9 100644 (file)
@@ -123,9 +123,6 @@ static int mdt_create_data(struct mdt_thread_info *info,
        ma->ma_valid = 0;
        mutex_lock(&o->mot_lov_mutex);
        if (!(o->mot_flags & MOF_LOV_CREATED)) {
-               if (p != NULL && !fid_is_md_operative(mdt_object_fid(p)))
-                       GOTO(unlock, rc = -EPERM);
-
                rc = mdo_create_data(info->mti_env,
                                     p ? mdt_object_child(p) : NULL,
                                     mdt_object_child(o), spec, ma);
@@ -135,7 +132,7 @@ static int mdt_create_data(struct mdt_thread_info *info,
                if (rc == 0 && ma->ma_valid & MA_LOV)
                        o->mot_flags |= MOF_LOV_CREATED;
        }
-unlock:
+
        mutex_unlock(&o->mot_lov_mutex);
        RETURN(rc);
 }
@@ -1395,7 +1392,7 @@ static void mdt_object_open_unlock(struct mdt_thread_info *info,
                up_read(&obj->mot_open_sem);
 
        /* Cross-ref case, the lock should be returned to the client */
-       if (ibits == 0 || rc == -EREMOTE)
+       if (ibits == 0 || rc == -MDT_EREMOTE_OPEN)
                RETURN_EXIT;
 
        if (!(open_flags & MDS_OPEN_LOCK) && !(ibits & MDS_INODELOCK_LAYOUT)) {
@@ -1461,9 +1458,9 @@ int mdt_open_by_fid_lock(struct mdt_thread_info *info, struct ldlm_reply *rep,
                         ma->ma_need |= MA_PFID;
         }
 
-        o = mdt_object_find(env, mdt, rr->rr_fid2);
-        if (IS_ERR(o))
-                RETURN(rc = PTR_ERR(o));
+       o = mdt_object_find(env, mdt, rr->rr_fid2);
+       if (IS_ERR(o))
+               GOTO(out_parent_put, rc = PTR_ERR(o));
 
        if (mdt_object_remote(o)) {
                CDEBUG(D_INFO, "%s: "DFID" is on remote MDT.\n",
@@ -1526,6 +1523,7 @@ out_unlock:
        mdt_object_open_unlock(info, o, lhc, ibits, rc);
 out:
        mdt_object_put(env, o);
+out_parent_put:
        if (parent != NULL)
                mdt_object_put(env, parent);
        return rc;
@@ -1569,13 +1567,6 @@ static int mdt_cross_open(struct mdt_thread_info *info,
                        if (rc != 0)
                                GOTO(out, rc);
 
-                       /* Do not create lov object if the fid is opened
-                        * under OBF */
-                       if (S_ISREG(ma->ma_attr.la_mode) &&
-                           !(ma->ma_valid & MA_LOV) && (flags & FMODE_WRITE) &&
-                           fid_is_obf(parent_fid))
-                               GOTO(out, rc = -EPERM);
-
                        rc = mdt_finish_open(info, NULL, o, flags, 0, rep);
                } else {
                        /*
@@ -1826,7 +1817,7 @@ int mdt_reint_open(struct mdt_thread_info *info, struct mdt_lock_handle *lhc)
                         if (rc != 0)
                                 result = rc;
                        else
-                               result = -EREMOTE;
+                               result = -MDT_EREMOTE_OPEN;
                         GOTO(out_child, result);
                } else if (mdt_object_exists(child)) {
                        /* We have to get attr & LOV EA & HSM for this