]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: Handle client compatibility
authorLi Wang <liwang@ubuntukylin.com>
Wed, 25 Dec 2013 02:17:30 +0000 (10:17 +0800)
committerYunchuan Wen <yunchuanwen@ubuntukylin.com>
Mon, 27 Jan 2014 07:25:00 +0000 (15:25 +0800)
Signed-off-by: Yunchuan Wen <yunchuanwen@ubuntukylin.com>
Signed-off-by: Li Wang <liwang@ubuntukylin.com>
src/mds/CInode.cc
src/mds/Locker.cc
src/mds/MDS.h
src/mds/Server.cc

index 45b2702ca584f28af814e125ade664cbaeaad9d2..1933deaee3fb996ab8f05117951676b4898269d9 100644 (file)
@@ -2644,6 +2644,9 @@ int CInode::get_caps_allowed_for_client(client_t client)
   } else {
     allowed = get_caps_allowed_by_type(CAP_ANY);
   }
+  if (inode.inline_version != CEPH_INLINE_NONE &&
+      !mdcache->mds->get_session(client)->connection->has_feature(CEPH_FEATURE_MDS_INLINE_DATA))
+    allowed &= ~(CEPH_CAP_FILE_RD | CEPH_CAP_FILE_WR);
   return allowed;
 }
 
index c8d367a28ccc8d3726cfd49f9c70dfdb21475a4e..4f399e3c4d54634da4a6888d9b3dc24f4b5a07e8 100644 (file)
@@ -1761,6 +1761,10 @@ bool Locker::issue_caps(CInode *in, Capability *only_cap)
     // add in any xlocker-only caps (for locks this client is the xlocker for)
     allowed |= xlocker_allowed & in->get_xlocker_mask(it->first);
 
+    if (in->inode.inline_version != CEPH_INLINE_NONE &&
+        !mds->get_session(it->first)->connection->has_feature(CEPH_FEATURE_MDS_INLINE_DATA))
+      allowed &= ~(CEPH_CAP_FILE_RD | CEPH_CAP_FILE_WR);
+
     int pending = cap->pending();
     int wanted = cap->wanted();
 
index 2ab1eb1741c11d483b4b48559b31a40bbd1b03d1..d6426de466ca71a6ffcb0cb693060ba77ad1d0d0 100644 (file)
@@ -316,6 +316,9 @@ class MDS : public Dispatcher {
  public:
 
   int get_req_rate() { return req_rate; }
+  Session *get_session(client_t client) {
+    return sessionmap.get_session(entity_name_t::CLIENT(client.v));
+  }
 
  private:
   bool ms_dispatch(Message *m);
index 84c300c45a423eb6fcd2a7dc5a047bd86dd90756..0e377277b0e54ac33d21e4ed8c9ca470fb1699da 100644 (file)
@@ -1956,6 +1956,10 @@ CInode* Server::prepare_new_inode(MDRequest *mdr, CDir *dir, inodeno_t useino, u
     }
   }
 
+  if (!mds->mdsmap->get_inline_data_enabled() ||
+      !mdr->session->connection->has_feature(CEPH_FEATURE_MDS_INLINE_DATA))
+    in->inode.inline_version = CEPH_INLINE_NONE;
+
   mdcache->add_inode(in);  // add
   dout(10) << "prepare_new_inode " << *in << dendl;
   return in;
@@ -2469,6 +2473,13 @@ void Server::handle_client_open(MDRequest *mdr)
     reply_request(mdr, -EINVAL);
     return;
   }
+
+  if (cur->inode.inline_version != CEPH_INLINE_NONE &&
+      !mdr->session->connection->has_feature(CEPH_FEATURE_MDS_INLINE_DATA)) {
+    dout(7) << "old client cannot open inline data file " << *cur << dendl;
+    reply_request(mdr, -EPERM);
+    return;
+  }
   
   // snapped data is read only
   if (mdr->snapid != CEPH_NOSNAP &&