@@ -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()
@@ -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 );
@@ -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;
@@ -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();