From 32cca70e411a22519d1b7c50351cf4cdae5247e9 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 8 Sep 2008 13:53:53 -0700 Subject: [PATCH] mds: fix client_follows in live cap --- src/mds/CInode.h | 1 + src/mds/Capability.h | 10 ++++++++-- src/mds/Locker.cc | 1 - 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/mds/CInode.h b/src/mds/CInode.h index 5f90836d5cd47..e55d0081d7aee 100644 --- a/src/mds/CInode.h +++ b/src/mds/CInode.h @@ -516,6 +516,7 @@ public: assert(client_caps.count(client) == 0); Capability *cap = client_caps[client] = new Capability; cap->set_inode(this); + cap->client_follows = first-1; containing_realm->add_cap(client, cap); diff --git a/src/mds/Capability.h b/src/mds/Capability.h index 5d9be6f06ae3e..589522880ff74 100644 --- a/src/mds/Capability.h +++ b/src/mds/Capability.h @@ -37,19 +37,23 @@ public: int32_t wanted; int32_t issued; int32_t pending; + snapid_t client_follows; capseq_t mseq; Export() {} - Export(int w, int i, int p, capseq_t s) : wanted(w), issued(i), pending(p), mseq(s) {} + Export(int w, int i, int p, snapid_t cf, capseq_t s) : + wanted(w), issued(i), pending(p), client_follows(cf), mseq(s) {} void encode(bufferlist &bl) const { ::encode(wanted, bl); ::encode(issued, bl); ::encode(pending, bl); + ::encode(client_follows, bl); ::encode(mseq, bl); } void decode(bufferlist::iterator &p) { ::decode(wanted, p); ::decode(issued, p); ::decode(pending, p); + ::decode(client_follows, p); ::decode(mseq, p); } }; @@ -169,7 +173,7 @@ public: capseq_t get_last_seq() { return last_sent; } Export make_export() { - return Export(wanted_caps, issued(), pending(), mseq+1); + return Export(wanted_caps, issued(), pending(), client_follows, mseq+1); } void merge(Export& other) { // issued + pending @@ -178,6 +182,8 @@ public: issue(other.issued | newpending); issue(newpending); + client_follows = other.client_follows; + // wanted wanted_caps = wanted_caps | other.wanted; mseq = other.mseq; diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index bebbde997d389..f842073fcff04 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -999,7 +999,6 @@ void Locker::handle_client_caps(MClientCaps *m) int wanted = m->get_wanted() & head_in->filelock.caps_allowed_ever(); int had = cap->confirm_receipt(m->get_seq(), m->get_caps()); int has = cap->confirmed(); - cap->client_follows = follows; dout(10) << " follows " << follows << ", had " << cap_string(had) << ", has " << cap_string(has) -- 2.39.5