From d1116818f0519ceedeb6553509fa9fc77f9cacf0 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 27 Apr 2011 10:59:40 -0700 Subject: [PATCH] mds: handle discovers that race with refragmenting 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 --- src/mds/MDCache.cc | 3 +++ src/messages/MDiscoverReply.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index e5915ca293f45..a5cf7ef6af385 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -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()) diff --git a/src/messages/MDiscoverReply.h b/src/messages/MDiscoverReply.h index 80e1c2095d964..00c2e78f236b1 100644 --- a/src/messages/MDiscoverReply.h +++ b/src/messages/MDiscoverReply.h @@ -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) : -- 2.39.5