mirror of
https://github.com/ceph/ceph
synced 2024-12-26 21:43:10 +00:00
mds: track Capability in mempool
Partial-fix: http://tracker.ceph.com/issues/21402 Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
This commit is contained in:
parent
7e2f59aad3
commit
b106408f95
@ -560,7 +560,7 @@ public:
|
||||
|
||||
// -- distributed state --
|
||||
protected:
|
||||
// file capabilities FIXME Capability not part of mempool
|
||||
// file capabilities
|
||||
using cap_map = mempool::mds_co::map<client_t, Capability*>;
|
||||
cap_map client_caps; // client -> caps
|
||||
mempool::mds_co::compact_map<int32_t, int32_t> mds_caps_wanted; // [auth] mds -> caps wanted
|
||||
|
@ -175,9 +175,9 @@ void Capability::dump(Formatter *f) const
|
||||
f->dump_unsigned("pending", _pending);
|
||||
|
||||
f->open_array_section("revokes");
|
||||
for (list<revoke_info>::const_iterator p = _revokes.begin(); p != _revokes.end(); ++p) {
|
||||
for (const auto &r : _revokes) {
|
||||
f->open_object_section("revoke");
|
||||
p->dump(f);
|
||||
r.dump(f);
|
||||
f->close_section();
|
||||
}
|
||||
f->close_section();
|
||||
@ -191,12 +191,18 @@ void Capability::generate_test_instances(list<Capability*>& ls)
|
||||
ls.back()->last_issue_stamp = utime_t(12, 13);
|
||||
ls.back()->_wanted = 14;
|
||||
ls.back()->_pending = 15;
|
||||
ls.back()->_revokes.push_back(revoke_info());
|
||||
ls.back()->_revokes.back().before = 16;
|
||||
ls.back()->_revokes.back().seq = 17;
|
||||
ls.back()->_revokes.back().last_issue = 18;
|
||||
ls.back()->_revokes.push_back(revoke_info());
|
||||
ls.back()->_revokes.back().before = 19;
|
||||
ls.back()->_revokes.back().seq = 20;
|
||||
ls.back()->_revokes.back().last_issue = 21;
|
||||
{
|
||||
auto &r = ls.back()->_revokes.emplace_back();
|
||||
r.before = 16;
|
||||
r.seq = 17;
|
||||
r.last_issue = 18;
|
||||
}
|
||||
{
|
||||
auto &r = ls.back()->_revokes.emplace_back();
|
||||
r.before = 19;
|
||||
r.seq = 20;
|
||||
r.last_issue = 21;
|
||||
}
|
||||
}
|
||||
|
||||
MEMPOOL_DEFINE_OBJECT_FACTORY(Capability, co_cap, mds_co);
|
||||
|
@ -16,14 +16,16 @@
|
||||
#ifndef CEPH_CAPABILITY_H
|
||||
#define CEPH_CAPABILITY_H
|
||||
|
||||
#include "include/counter.h"
|
||||
#include "include/buffer_fwd.h"
|
||||
#include "include/counter.h"
|
||||
#include "include/mempool.h"
|
||||
#include "include/xlist.h"
|
||||
|
||||
#include "common/config.h"
|
||||
|
||||
#include "mdstypes.h"
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Capability protocol notes.
|
||||
@ -66,6 +68,8 @@ namespace ceph {
|
||||
|
||||
class Capability : public Counter<Capability> {
|
||||
public:
|
||||
MEMPOOL_CLASS_HELPERS();
|
||||
|
||||
struct Export {
|
||||
int64_t cap_id;
|
||||
int32_t wanted;
|
||||
@ -138,7 +142,7 @@ public:
|
||||
ceph_seq_t issue(unsigned c) {
|
||||
if (_pending & ~c) {
|
||||
// revoking (and maybe adding) bits. note caps prior to this revocation
|
||||
_revokes.push_back(revoke_info(_pending, last_sent, last_issue));
|
||||
_revokes.emplace_back(_pending, last_sent, last_issue);
|
||||
_pending = c;
|
||||
_issued |= c;
|
||||
} else if (~_pending & c) {
|
||||
@ -166,8 +170,9 @@ public:
|
||||
}
|
||||
void _calc_issued() {
|
||||
_issued = _pending;
|
||||
for (list<revoke_info>::iterator p = _revokes.begin(); p != _revokes.end(); ++p)
|
||||
_issued |= p->before;
|
||||
for (const auto &r : _revokes) {
|
||||
_issued |= r.before;
|
||||
}
|
||||
}
|
||||
void confirm_receipt(ceph_seq_t seq, unsigned caps) {
|
||||
if (seq == last_sent) {
|
||||
@ -345,7 +350,7 @@ private:
|
||||
// - add new caps to _pending
|
||||
// - track revocations in _revokes list
|
||||
__u32 _pending, _issued;
|
||||
list<revoke_info> _revokes;
|
||||
mempool::mds_co::list<revoke_info> _revokes;
|
||||
|
||||
ceph_seq_t last_sent;
|
||||
ceph_seq_t last_issue;
|
||||
|
Loading…
Reference in New Issue
Block a user