From: Yan, Zheng Date: Mon, 18 Nov 2013 09:59:06 +0000 (+0800) Subject: mds: increase cap sequence when sharing max size X-Git-Tag: v0.75~93^2~16 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=77515b7a3c7280a2bd448889ea63591ad69096f0;p=ceph.git mds: increase cap sequence when sharing max size 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 --- diff --git a/src/mds/Capability.h b/src/mds/Capability.h index fb6b3dc1f16..dbd318618f3 100644 --- a/src/mds/Capability.h +++ b/src/mds/Capability.h @@ -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; } diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index 895bd964e5d..7365a47bf1f 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -1606,8 +1606,6 @@ void Locker::file_update_finish(CInode *in, Mutation *mut, bool share, client_t set 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(), diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 27bd9b0df93..f2520c88c29 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -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(),