From: Yan, Zheng Date: Fri, 1 May 2015 02:33:52 +0000 (+0800) Subject: mds: send FLUSHSNAP_ACK even if FLUSHSNAP message is unexpected X-Git-Tag: v9.0.2~228^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=585bc2bc6a7aeddf32e9c1d43d0aa01568e01d63;p=ceph.git mds: send FLUSHSNAP_ACK even if FLUSHSNAP message is unexpected MDS should send FLUSHSNAP_ACK even if FLUSHSNAP message is unexpected. This is because client does not release corresponding resources until it get the FLUSHSNAP_ACK Signed-off-by: Yan, Zheng --- diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index f49f8eead9dc..64a17fe6308c 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -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; }