]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: send FLUSHSNAP_ACK even if FLUSHSNAP message is unexpected 4523/head
authorYan, Zheng <zyan@redhat.com>
Fri, 1 May 2015 02:33:52 +0000 (10:33 +0800)
committerYan, Zheng <zyan@redhat.com>
Fri, 1 May 2015 13:43:43 +0000 (21:43 +0800)
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 <zyan@redhat.com>
src/mds/Locker.cc

index f49f8eead9dcb65dabb459bdebfc0c51eb95808e..64a17fe6308c8bcdeff3f0063d3064abd0d48a8e 100644 (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;
   }