]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: rdlock dft during readdir
authorSage Weil <sage@newdream.net>
Thu, 12 Jun 2008 21:22:40 +0000 (14:22 -0700)
committerSage Weil <sage@newdream.net>
Thu, 12 Jun 2008 21:22:40 +0000 (14:22 -0700)
src/mds/Server.cc
src/mds/Server.h

index d030a3b4d058551b068e1f2aceaf87beb4a6ef7d..13cf73104101f61b5601e6b1123cb24d67e17d6f 100644 (file)
@@ -1261,7 +1261,7 @@ CDir *Server::traverse_to_auth_dir(MDRequest *mdr, vector<CDentry*> &trace, file
 
 
 
-CInode* Server::rdlock_path_pin_ref(MDRequest *mdr, bool want_auth)
+CInode* Server::rdlock_path_pin_ref(MDRequest *mdr, bool want_auth, bool rdlock_dft)
 {
   dout(10) << "rdlock_path_pin_ref " << *mdr << dendl;
 
@@ -1344,6 +1344,8 @@ CInode* Server::rdlock_path_pin_ref(MDRequest *mdr, bool want_auth)
 
   for (int i=0; i<(int)trace.size(); i++) 
     rdlocks.insert(&trace[i]->lock);
+  if (rdlock_dft)
+    rdlocks.insert(&ref->dirfragtreelock);
 
   if (!mds->locker->acquire_locks(mdr, rdlocks, empty, empty))
     return 0;
@@ -1817,7 +1819,7 @@ void Server::handle_client_readdir(MDRequest *mdr)
 {
   MClientRequest *req = mdr->client_request;
   int client = req->get_client().num();
-  CInode *diri = rdlock_path_pin_ref(mdr, false);
+  CInode *diri = rdlock_path_pin_ref(mdr, false, true);  // rdlock dirfragtreelock!
   if (!diri) return;
 
   // it's a directory, right?
@@ -1842,6 +1844,7 @@ void Server::handle_client_readdir(MDRequest *mdr)
   if (!dir) return;
 
   // ok!
+  dout(10) << "handle_client_readdir on " << *dir << dendl;
   assert(dir->is_auth());
 
   // check perm
index 90d768929b54f9ebc63f0f6bb942c814ce6fa93f..bcd34e40b745045c41cda4409dfd11ca3ca068ad 100644 (file)
@@ -98,7 +98,7 @@ public:
   CDentry *prepare_null_dentry(MDRequest *mdr, CDir *dir, const string& dname, bool okexist=false);
   CInode* prepare_new_inode(MDRequest *mdr, CDir *dir);
 
-  CInode* rdlock_path_pin_ref(MDRequest *mdr, bool want_auth);
+  CInode* rdlock_path_pin_ref(MDRequest *mdr, bool want_auth, bool rdlock_dft=false);
   CDentry* rdlock_path_xlock_dentry(MDRequest *mdr, bool okexist, bool mustexist);
 
   CDir* try_open_auth_dirfrag(CInode *diri, frag_t fg, MDRequest *mdr);