Merge pull request #4523 from ceph/wip-mds-flushsnapack

mds: send FLUSHSNAP_ACK even if FLUSHSNAP message is unexpected
This commit is contained in:
Yan, Zheng 2015-05-07 09:57:03 +08:00
commit d20a387788

View File

@ -2518,6 +2518,16 @@ void Locker::handle_client_caps(MClientCaps *m)
snapid_t snap = realm->get_snap_following(follows);
dout(10) << " flushsnap follows " << follows << " -> snap " << snap << dendl;
// we can prepare the ack now, since this FLUSHEDSNAP is independent of any
// other cap ops. (except possibly duplicate FLUSHSNAP requests, but worst
// case we get a dup response, so whatever.)
MClientCaps *ack = 0;
if (m->get_dirty()) {
ack = new MClientCaps(CEPH_CAP_OP_FLUSHSNAP_ACK, in->ino(), 0, 0, 0, 0, 0, m->get_dirty(), 0, mds->get_osd_epoch_barrier());
ack->set_snap_follows(follows);
ack->set_client_tid(m->get_client_tid());
}
if (in == head_in ||
(head_in->client_need_snapflush.count(snap) &&
head_in->client_need_snapflush[snap].count(client))) {
@ -2528,23 +2538,16 @@ void Locker::handle_client_caps(MClientCaps *m)
if (in == head_in)
cap->client_follows = snap < CEPH_NOSNAP ? snap : realm->get_newest_seq();
// we can prepare the ack now, since this FLUSHEDSNAP is independent of any
// other cap ops. (except possibly duplicate FLUSHSNAP requests, but worst
// case we get a dup response, so whatever.)
MClientCaps *ack = 0;
if (m->get_dirty()) {
ack = new MClientCaps(CEPH_CAP_OP_FLUSHSNAP_ACK, in->ino(), 0, 0, 0, 0, 0, m->get_dirty(), 0, mds->get_osd_epoch_barrier());
ack->set_snap_follows(follows);
ack->set_client_tid(m->get_client_tid());
}
_do_snap_update(in, snap, m->get_dirty(), follows, client, m, ack);
if (in != head_in)
head_in->remove_need_snapflush(in, snap, client);
} else
} else {
dout(7) << " not expecting flushsnap " << snap << " from client." << client << " on " << *in << dendl;
if (ack)
mds->send_message_client_counted(ack, m->get_connection());
}
goto out;
}