]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: handle discovers that race with refragmenting
authorSage Weil <sage@newdream.net>
Wed, 27 Apr 2011 17:59:40 +0000 (10:59 -0700)
committerSage Weil <sage@newdream.net>
Wed, 27 Apr 2011 17:59:40 +0000 (10:59 -0700)
Consider:

 - send discover on frag X
 - X refragments
   - we take the waiter and rediscover on frag Y
 - we get the reply for the X discover

The auth mds will correctly delay sending the reply until the refragment
completes and it unfreezes, but the reply was getting the original frag_t,
not the new one.

Signed-off-by: Sage Weil <sage@newdream.net>
src/mds/MDCache.cc
src/messages/MDiscoverReply.h

index e5915ca293f45261f4ba8c85c2827ab246998ff3..a5cf7ef6af38550d86e28fa7010b96a630d907aa 100644 (file)
@@ -8464,6 +8464,9 @@ void MDCache::handle_discover(MDiscover *dis)
     // add dir
     if (reply->is_empty() && !dis->wants_base_dir()) {
       dout(7) << "handle_discover not adding unwanted base dir " << *curdir << dendl;
+      // make sure the base frag is correct, though, in there was a refragment since the
+      // original request was sent.
+      reply->set_base_dir_frag(curdir->get_frag());
     } else {
       assert(!curdir->is_ambiguous_auth()); // would be frozen.
       if (!reply->trace.length())
index 80e1c2095d9648212ebba1b8ad6e893b2baced6c..00c2e78f236b1c31dde627c830d5eb5f5d2613d2 100644 (file)
@@ -110,6 +110,8 @@ class MDiscoverReply : public Message {
   bool is_unsolicited() { return unsolicited; }
   void mark_unsolicited() { unsolicited = true; }
 
+  void set_base_dir_frag(frag_t df) { base_dir_frag = df; }
+
   // cons
   MDiscoverReply() {}
   MDiscoverReply(MDiscover *dis) :