All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Yan, Zheng" <zheng.z.yan@intel.com>
To: ceph-devel@vger.kernel.org, sage@inktank.com
Cc: "Yan, Zheng" <zheng.z.yan@intel.com>
Subject: [PATCH 04/14] mds: no bloom filter for replica dir
Date: Tue, 11 Dec 2012 16:30:50 +0800	[thread overview]
Message-ID: <1355214660-26354-5-git-send-email-zheng.z.yan@intel.com> (raw)
In-Reply-To: <1355214660-26354-1-git-send-email-zheng.z.yan@intel.com>

From: "Yan, Zheng" <zheng.z.yan@intel.com>

We should delete dir fragment's bloom filter after exporting the dir
fragment to other MDS. Otherwise the residual bloom filter may cause
problem if the MDS imports dir fragment later.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
---
 src/mds/CDir.cc     | 9 +++++++--
 src/mds/CDir.h      | 1 +
 src/mds/MDCache.cc  | 5 ++++-
 src/mds/Migrator.cc | 2 ++
 4 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/mds/CDir.cc b/src/mds/CDir.cc
index 4b1d3ef..cbda038 100644
--- a/src/mds/CDir.cc
+++ b/src/mds/CDir.cc
@@ -632,6 +632,12 @@ bool CDir::is_in_bloom(const string& name)
   return bloom->contains(name.c_str(), name.size());
 }
 
+void CDir::remove_bloom()
+{
+  delete bloom;
+  bloom = NULL;
+}
+
 void CDir::remove_null_dentries() {
   dout(12) << "remove_null_dentries " << *this << dendl;
 
@@ -1287,8 +1293,7 @@ void CDir::log_mark_dirty()
 
 void CDir::mark_complete() {
   state_set(STATE_COMPLETE);
-  delete bloom;
-  bloom = NULL;
+  remove_bloom();
 }
 
 void CDir::first_get()
diff --git a/src/mds/CDir.h b/src/mds/CDir.h
index 2222418..91e53d2 100644
--- a/src/mds/CDir.h
+++ b/src/mds/CDir.h
@@ -349,6 +349,7 @@ protected:
   void add_to_bloom(CDentry *dn);
   bool is_in_bloom(const string& name);
   bool has_bloom() { return (bloom ? true : false); }
+  void remove_bloom();
 private:
   void link_inode_work( CDentry *dn, CInode *in );
   void unlink_inode_work( CDentry *dn );
diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc
index c8055ea..7733d0d 100644
--- a/src/mds/MDCache.cc
+++ b/src/mds/MDCache.cc
@@ -5524,7 +5524,8 @@ void MDCache::trim_dentry(CDentry *dn, map<int, MCacheExpire*>& expiremap)
   }
     
   // remove dentry
-  dir->add_to_bloom(dn);
+  if (dir->is_auth())
+    dir->add_to_bloom(dn);
   dir->remove_dentry(dn);
 
   if (clear_complete)
@@ -5718,6 +5719,7 @@ void MDCache::trim_non_auth()
 	assert(dnl->is_null());
       }
 
+      assert(!dir->has_bloom());
       dir->remove_dentry(dn);
       // adjust the dir state
       dir->state_clear(CDir::STATE_COMPLETE);  // dir incomplete!
@@ -5819,6 +5821,7 @@ bool MDCache::trim_non_auth_subtree(CDir *dir)
         dout(20) << "trim_non_auth_subtree(" << dir << ") removing inode " << in << " with dentry" << dn << dendl;
         dir->unlink_inode(dn);
         remove_inode(in);
+	assert(!dir->has_bloom());
         dir->remove_dentry(dn);
       } else {
         dout(20) << "trim_non_auth_subtree(" << dir << ") keeping inode " << in << " with dentry " << dn <<dendl;
diff --git a/src/mds/Migrator.cc b/src/mds/Migrator.cc
index a804eab..cc045b4 100644
--- a/src/mds/Migrator.cc
+++ b/src/mds/Migrator.cc
@@ -1196,6 +1196,7 @@ void Migrator::finish_export_dir(CDir *dir, list<Context*>& finished, utime_t no
   // mark
   assert(dir->is_auth());
   dir->state_clear(CDir::STATE_AUTH);
+  dir->remove_bloom();
   dir->replica_nonce = CDir::NONCE_EXPORT;
 
   if (dir->is_dirty())
@@ -2006,6 +2007,7 @@ void Migrator::import_reverse(CDir *dir)
     // dir
     assert(cur->is_auth());
     cur->state_clear(CDir::STATE_AUTH);
+    cur->remove_bloom();
     cur->clear_replica_map();
     if (cur->is_dirty())
       cur->mark_clean();
-- 
1.7.11.7


  parent reply	other threads:[~2012-12-11  8:31 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-11  8:30 [PATCH 00/14] fixes for MDS Yan, Zheng
2012-12-11  8:30 ` [PATCH 01/14] mds: fix journaling issue regarding rstat accounting Yan, Zheng
2012-12-11  8:30 ` [PATCH 02/14] mds: alllow handle_client_readdir() fetching freezing dir Yan, Zheng
2012-12-11  8:30 ` [PATCH 03/14] mds: properly mark dirfrag dirty Yan, Zheng
2012-12-11  8:30 ` Yan, Zheng [this message]
2012-12-11  8:30 ` [PATCH 05/14] mds: set want_base_dir to false for MDCache::discover_ino() Yan, Zheng
2012-12-11  8:30 ` [PATCH 06/14] mds: fix error hanlding in MDCache::handle_discover_reply() Yan, Zheng
2012-12-11  8:30 ` [PATCH 07/14] mds: always send discover if want_xlocked is true Yan, Zheng
2012-12-11  8:30 ` [PATCH 08/14] mds: re-issue caps after importing caps Yan, Zheng
2012-12-11  8:30 ` [PATCH 09/14] mds: take export lock set before sending MExportDirDiscover Yan, Zheng
2012-12-11  8:30 ` [PATCH 10/14] mds: don't retry readdir request after issuing caps Yan, Zheng
2012-12-11  8:30 ` [PATCH 11/14] mds: delay processing cache expire when state >= EXPORT_EXPORTING Yan, Zheng
2012-12-11  8:30 ` [PATCH 12/14] mds: fix file existing check in Server::handle_client_openc() Yan, Zheng
2012-12-11  8:30 ` [PATCH 13/14] mds: fix race between send_dentry_link() and cache expire Yan, Zheng
2012-12-11  8:31 ` [PATCH 14/14] mds: compare sessionmap version before replaying imported sessions Yan, Zheng
2012-12-11  8:33 ` [PATCH 00/14] fixes for MDS Yan, Zheng
2012-12-11 17:11   ` Sage Weil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1355214660-26354-5-git-send-email-zheng.z.yan@intel.com \
    --to=zheng.z.yan@intel.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=sage@inktank.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.