]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: increase cap sequence when sharing max size
authorYan, Zheng <zheng.z.yan@intel.com>
Mon, 18 Nov 2013 09:59:06 +0000 (17:59 +0800)
committerYan, Zheng <zheng.z.yan@intel.com>
Mon, 16 Dec 2013 04:15:24 +0000 (12:15 +0800)
For case:
 - client voluntarily releases some caps through cap update message
 - mds shares the new max by sending cap grant message
 - mds recevies the cap update message

If mds doesn't increase the cap sequence when sharing the max size.
It can't determine if the cap update message was sent before or after
client reveived the cap grant message that updates max size.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
src/mds/Capability.h
src/mds/Locker.cc
src/mds/MDCache.cc

index fb6b3dc1f1629f40ad49bd49c47adc56f7a45b90..dbd318618f30e5fa2c24df9addf3ad8cfb4a8b4b 100644 (file)
@@ -262,6 +262,7 @@ public:
     //check_rdcaps_list();
   }
 
+  void inc_last_seq() { last_sent++; };
   ceph_seq_t get_last_seq() { return last_sent; }
   ceph_seq_t get_last_issue() { return last_issue; }
 
index 895bd964e5d85c492e6aef9e934ca26629d69c1a..7365a47bf1f352234059987b0734e9aae68389af 100644 (file)
@@ -1606,8 +1606,6 @@ void Locker::file_update_finish(CInode *in, Mutation *mut, bool share, client_t
 
   set<CInode*> need_issue;
   drop_locks(mut, &need_issue);
-  mut->cleanup();
-  delete mut;
 
   if (!in->is_head() && !in->client_snap_caps.empty()) {
     dout(10) << " client_snap_caps " << in->client_snap_caps << dendl;
@@ -1640,6 +1638,10 @@ void Locker::file_update_finish(CInode *in, Mutation *mut, bool share, client_t
       share_inode_max_size(in);
   }
   issue_caps_set(need_issue);
+
+  // auth unpin after issuing caps
+  mut->cleanup();
+  delete mut;
 }
 
 Capability* Locker::issue_new_caps(CInode *in,
@@ -2174,6 +2176,7 @@ void Locker::share_inode_max_size(CInode *in, Capability *only_cap)
       continue;
     if (cap->pending() & (CEPH_CAP_FILE_WR|CEPH_CAP_FILE_BUFFER)) {
       dout(10) << "share_inode_max_size with client." << client << dendl;
+      cap->inc_last_seq();
       MClientCaps *m = new MClientCaps(CEPH_CAP_OP_GRANT,
                                       in->ino(),
                                       in->find_snaprealm()->inode->ino(),
index 27bd9b0df93a5f094a2dbc65bd5ff658bc1598e7..f2520c88c2940b33a49ad758ba3d37ac905d6ba9 100644 (file)
@@ -5251,8 +5251,8 @@ void MDCache::do_cap_import(Session *session, CInode *in, Capability *cap)
   SnapRealm *realm = in->find_snaprealm();
   if (realm->have_past_parents_open()) {
     dout(10) << "do_cap_import " << session->info.inst.name << " mseq " << cap->get_mseq() << " on " << *in << dendl;
-    if (cap->get_last_seq() == 0)
-      cap->issue_norevoke(cap->issued()); // reconnected cap
+    if (cap->get_last_seq() == 0) // reconnected cap
+      cap->inc_last_seq();
     cap->set_last_issue();
     MClientCaps *reap = new MClientCaps(CEPH_CAP_OP_IMPORT,
                                        in->ino(),