Whamcloud - gitweb
LU-2739 mdt: Deny non-DNE client to access remote directory
[fs/lustre-release.git] / lustre / mdt / mdt_recovery.c
index 9cd8549..9102eaa 100644 (file)
@@ -497,7 +497,9 @@ static int mdt_txn_start_cb(const struct lu_env *env,
        if (rc)
                return rc;
 
-       if (mti->mti_mos != NULL)
+       /* we probably should not set local transno to the remote object
+        * on another storage, What about VBR on remote object? XXX */
+       if (mti->mti_mos != NULL && !mdt_object_remote(mti->mti_mos))
                rc = dt_declare_version_set(env, mdt_obj2dt(mti->mti_mos), th);
 
        return rc;
@@ -545,7 +547,11 @@ static int mdt_txn_stop_cb(const struct lu_env *env,
         LASSERT(req != NULL && req->rq_repmsg != NULL);
 
         /** VBR: set new versions */
-        if (txn->th_result == 0 && mti->mti_mos != NULL) {
+       /* we probably should not set local transno to the remote object
+        * on another storage, What about VBR on remote object? XXX */
+       if (txn->th_result == 0 && mti->mti_mos != NULL &&
+           !mdt_object_remote(mti->mti_mos)) {
+
                 dt_version_set(env, mdt_obj2dt(mti->mti_mos),
                                mti->mti_transno, txn);
                 mti->mti_mos = NULL;
@@ -733,14 +739,18 @@ static void mdt_reconstruct_create(struct mdt_thread_info *mti,
         mti->mti_attr.ma_need = MA_INODE;
         mti->mti_attr.ma_valid = 0;
        rc = mdt_attr_get_complex(mti, child, &mti->mti_attr);
-        if (rc == -EREMOTE) {
-                /* object was created on remote server */
-                req->rq_status = rc;
-                body->valid |= OBD_MD_MDS;
-        }
-        mdt_pack_attr2body(mti, body, &mti->mti_attr.ma_attr,
-                           mdt_object_fid(child));
-        mdt_object_put(mti->mti_env, child);
+       if (rc == -EREMOTE) {
+               /* object was created on remote server */
+               if (!mdt_is_dne_client(exp))
+                       /* Return -EIO for old client */
+                       rc = -EIO;
+
+               req->rq_status = rc;
+               body->valid |= OBD_MD_MDS;
+       }
+       mdt_pack_attr2body(mti, body, &mti->mti_attr.ma_attr,
+                          mdt_object_fid(child));
+       mdt_object_put(mti->mti_env, child);
 }
 
 static void mdt_reconstruct_setattr(struct mdt_thread_info *mti,