Skip to content

Commit cb4ff28

Browse files
committed
mds: add issue_seq to all cap messages
Right now only the clients tell the MDS what they believe the issue_seq to be. The clients are expected to figure out issue_seq updates at Fixes: https://tracker.ceph.com/issues/68515 Signed-off-by: Patrick Donnelly <[email protected]>
1 parent 1da6ef2 commit cb4ff28

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

src/client/Client.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3840,6 +3840,7 @@ void Client::send_cap(Inode *in, MetaSession *session, Cap *cap,
38403840
want,
38413841
flush,
38423842
cap->mseq,
3843+
cap->issue_seq,
38433844
cap_epoch_barrier);
38443845
/*
38453846
* Since the setattr will check the cephx mds auth access before
@@ -3853,7 +3854,6 @@ void Client::send_cap(Inode *in, MetaSession *session, Cap *cap,
38533854
m->caller_uid = -1;
38543855
m->caller_gid = -1;
38553856

3856-
m->head.issue_seq = cap->issue_seq;
38573857
m->set_tid(flush_tid);
38583858

38593859
m->head.uid = in->uid;

src/mds/Locker.cc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2599,6 +2599,7 @@ int Locker::issue_caps(CInode *in, Capability *only_cap)
25992599
in->find_snaprealm()->inode->ino(),
26002600
cap->get_cap_id(), cap->get_last_seq(),
26012601
pending, wanted, 0, cap->get_mseq(),
2602+
cap->get_last_issue(),
26022603
mds->get_osd_epoch_barrier());
26032604
in->encode_cap_message(m, cap);
26042605

@@ -2649,6 +2650,7 @@ int Locker::issue_caps(CInode *in, Capability *only_cap)
26492650
in->find_snaprealm()->inode->ino(),
26502651
cap->get_cap_id(), cap->get_last_seq(),
26512652
after, wanted, 0, cap->get_mseq(),
2653+
cap->get_last_issue(),
26522654
mds->get_osd_epoch_barrier());
26532655
in->encode_cap_message(m, cap);
26542656

@@ -2675,6 +2677,7 @@ void Locker::issue_truncate(CInode *in)
26752677
cap->get_cap_id(), cap->get_last_seq(),
26762678
cap->pending(), cap->wanted(), 0,
26772679
cap->get_mseq(),
2680+
cap->get_last_issue(),
26782681
mds->get_osd_epoch_barrier());
26792682
in->encode_cap_message(m, cap);
26802683
mds->send_message_client_counted(m, cap->get_session());
@@ -3165,6 +3168,7 @@ void Locker::share_inode_max_size(CInode *in, Capability *only_cap)
31653168
cap->pending(),
31663169
cap->wanted(), 0,
31673170
cap->get_mseq(),
3171+
cap->get_last_issue(),
31683172
mds->get_osd_epoch_barrier());
31693173
in->encode_cap_message(m, cap);
31703174
mds->send_message_client_counted(m, cap->get_session());
@@ -3375,10 +3379,10 @@ void Locker::handle_client_caps(const cref_t<MClientCaps> &m)
33753379
ref_t<MClientCaps> ack;
33763380
if (op == CEPH_CAP_OP_FLUSHSNAP) {
33773381
if (mds->logger) mds->logger->inc(l_mdss_ceph_cap_op_flushsnap_ack);
3378-
ack = make_message<MClientCaps>(CEPH_CAP_OP_FLUSHSNAP_ACK, m->get_ino(), 0, 0, 0, 0, 0, dirty, 0, mds->get_osd_epoch_barrier());
3382+
ack = make_message<MClientCaps>(CEPH_CAP_OP_FLUSHSNAP_ACK, m->get_ino(), 0, 0, 0, 0, 0, dirty, 0, 0, mds->get_osd_epoch_barrier());
33793383
} else {
33803384
if (mds->logger) mds->logger->inc(l_mdss_ceph_cap_op_flush_ack);
3381-
ack = make_message<MClientCaps>(CEPH_CAP_OP_FLUSH_ACK, m->get_ino(), 0, m->get_cap_id(), m->get_seq(), m->get_caps(), 0, dirty, 0, mds->get_osd_epoch_barrier());
3385+
ack = make_message<MClientCaps>(CEPH_CAP_OP_FLUSH_ACK, m->get_ino(), 0, m->get_cap_id(), m->get_seq(), m->get_caps(), 0, dirty, 0, 0, mds->get_osd_epoch_barrier());
33823386
}
33833387
ack->set_snap_follows(follows);
33843388
ack->set_client_tid(m->get_client_tid());
@@ -3500,7 +3504,7 @@ void Locker::handle_client_caps(const cref_t<MClientCaps> &m)
35003504
// case we get a dup response, so whatever.)
35013505
ref_t<MClientCaps> ack;
35023506
if (dirty) {
3503-
ack = make_message<MClientCaps>(CEPH_CAP_OP_FLUSHSNAP_ACK, in->ino(), 0, 0, 0, 0, 0, dirty, 0, mds->get_osd_epoch_barrier());
3507+
ack = make_message<MClientCaps>(CEPH_CAP_OP_FLUSHSNAP_ACK, in->ino(), 0, 0, 0, 0, 0, dirty, 0, 0, mds->get_osd_epoch_barrier());
35043508
ack->set_snap_follows(follows);
35053509
ack->set_client_tid(m->get_client_tid());
35063510
ack->set_oldest_flush_tid(m->get_oldest_flush_tid());
@@ -3589,7 +3593,7 @@ void Locker::handle_client_caps(const cref_t<MClientCaps> &m)
35893593
dout(7) << " flush client." << client << " dirty " << ccap_string(dirty)
35903594
<< " seq " << m->get_seq() << " on " << *in << dendl;
35913595
ack = make_message<MClientCaps>(CEPH_CAP_OP_FLUSH_ACK, in->ino(), 0, cap->get_cap_id(), m->get_seq(),
3592-
m->get_caps(), 0, dirty, 0, mds->get_osd_epoch_barrier());
3596+
m->get_caps(), 0, dirty, 0, cap->get_last_issue(), mds->get_osd_epoch_barrier());
35933597
ack->set_client_tid(m->get_client_tid());
35943598
ack->set_oldest_flush_tid(m->get_oldest_flush_tid());
35953599
}

src/mds/MDCache.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5898,7 +5898,7 @@ void MDCache::do_cap_import(Session *session, CInode *in, Capability *cap,
58985898
auto reap = make_message<MClientCaps>(CEPH_CAP_OP_IMPORT,
58995899
in->ino(), realm->inode->ino(), cap->get_cap_id(),
59005900
cap->get_last_seq(), cap->pending(), cap->wanted(),
5901-
0, cap->get_mseq(), mds->get_osd_epoch_barrier());
5901+
0, cap->get_mseq(), cap->get_last_issue(), mds->get_osd_epoch_barrier());
59025902
in->encode_cap_message(reap, cap);
59035903
reap->snapbl = mds->server->get_snap_trace(session, realm);
59045904
reap->set_cap_peer(p_cap_id, p_seq, p_mseq, peer, p_flags);

src/messages/MClientCaps.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ class MClientCaps final : public SafeMessage {
142142
int wanted,
143143
int dirty,
144144
ceph_seq_t mseq,
145+
ceph_seq_t issue_seq,
145146
epoch_t oeb)
146147
: SafeMessage{CEPH_MSG_CLIENT_CAPS, HEAD_VERSION, COMPAT_VERSION},
147148
osd_epoch_barrier(oeb) {
@@ -155,6 +156,7 @@ class MClientCaps final : public SafeMessage {
155156
head.wanted = wanted;
156157
head.dirty = dirty;
157158
head.migrate_seq = mseq;
159+
head.issue_seq = issue_seq;
158160
memset(&peer, 0, sizeof(peer));
159161
}
160162
MClientCaps(int op,

0 commit comments

Comments
 (0)