]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds/server: merge the snapshot request judgment 11150/head
authorhuanwen ren <rhwlyw@163.com>
Tue, 20 Sep 2016 12:32:26 +0000 (20:32 +0800)
committerGitHub <noreply@github.com>
Tue, 20 Sep 2016 12:32:26 +0000 (20:32 +0800)
merge the snapshot request judgment,
and all return -EROFS

Signed-off-by: huanwen ren <ren.huanwen@zte.com.cn>
src/mds/Server.cc

index 40d9fd8db3f7ce2cf14dcc38f9abb1cf7c106111..2eceb790d7fa927347929bd75911c6ff39ed77dc 100644 (file)
@@ -2921,11 +2921,6 @@ void Server::handle_client_open(MDRequestRef& mdr)
       return;
   }
 
-  if (mdr->snapid != CEPH_NOSNAP && req->may_write()) {
-    respond_to_request(mdr, -EROFS);
-    return;
-  }
-
   if (!cur->inode.is_file()) {
     // can only open non-regular inode with mode FILE_MODE_PIN, at least for now.
     cmode = CEPH_FILE_MODE_PIN;
@@ -2967,9 +2962,9 @@ void Server::handle_client_open(MDRequestRef& mdr)
   
   // snapped data is read only
   if (mdr->snapid != CEPH_NOSNAP &&
-      (cmode & CEPH_FILE_MODE_WR)) {
+      ((cmode & CEPH_FILE_MODE_WR) || req->may_write())) {
     dout(7) << "snap " << mdr->snapid << " is read-only " << *cur << dendl;
-    respond_to_request(mdr, -EPERM);
+    respond_to_request(mdr, -EROFS);
     return;
   }