summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-05-17 12:12:15 -0700
committerSage Weil <sage@inktank.com>2013-06-24 21:21:47 -0700
commit44cbdfb643398414d1a7037362025508754b679a (patch)
tree65b4b4f8930bc06d44cbbf7d4927c905c62e0eeb
parent14af8c44582f2cefb179a9854053c17aac3ece92 (diff)
downloadceph-44cbdfb643398414d1a7037362025508754b679a.tar.gz
client: avoid blindly removing dentries
MetaRequests may have references to these dentries. Instead of removing them and tearing down the directory, just unlink them from the inodes. We could be a bit smarter here if we looked at the reference count, but this works too. Signed-off-by: Sage Weil <sage@inktank.com>
-rw-r--r--src/client/Client.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/client/Client.cc b/src/client/Client.cc
index 59cf62c9f5c..5f1d68dfc13 100644
--- a/src/client/Client.cc
+++ b/src/client/Client.cc
@@ -660,10 +660,14 @@ Inode * Client::add_update_inode(InodeStat *st, utime_t from, MetaSession *sessi
in->flags |= I_COMPLETE;
if (in->dir) {
ldout(cct, 10) << " dir is open on empty dir " << in->ino << " with "
- << in->dir->dentry_map.size() << " entries, tearing down" << dendl;
- while (!in->dir->dentry_map.empty())
+ << in->dir->dentry_map.size() << " entries, marking all dentries null" << dendl;
+ for (map<string, Dentry*>::iterator p = in->dir->dentry_map.begin();
+ p != in->dir->dentry_map.end();
+ ++p) {
unlink(in->dir->dentry_map.begin()->second, true, true);
- close_dir(in->dir);
+ }
+ if (in->dir->dentry_map.empty())
+ close_dir(in->dir);
}
}