From d4e131911957b7f0236e56a9145739588009ddcc Mon Sep 17 00:00:00 2001 From: huanwen ren Date: Tue, 20 Sep 2016 20:32:26 +0800 Subject: [PATCH] mds/server: merge the snapshot request judgment merge the snapshot request judgment, and all return -EROFS Signed-off-by: huanwen ren --- src/mds/Server.cc | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/mds/Server.cc b/src/mds/Server.cc index 40d9fd8db3f7..2eceb790d7fa 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -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; } -- 2.47.3