]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix readdir pingpong on snapped dir with multiple mds
authorSage Weil <sage@newdream.net>
Fri, 21 May 2010 19:08:17 +0000 (12:08 -0700)
committerSage Weil <sage@newdream.net>
Fri, 21 May 2010 19:08:35 +0000 (12:08 -0700)
Our traverse helper will follow the auth if we're looking at snapped
metadata, but we _don't_ want that for readdir because we check auth
ourselves, and want the dir's auth, not the inode's.

Signed-off-by: Sage Weil <sage@newdream.net>
src/mds/Server.cc
src/mds/Server.h

index 075a2bc103307347ec270881c218a3bd458c90d6..fb4ff2bcf99a8efb624448f100650a7e5344394e 100644 (file)
@@ -1707,7 +1707,9 @@ CDir *Server::traverse_to_auth_dir(MDRequest *mdr, vector<CDentry*> &trace, file
 
 CInode* Server::rdlock_path_pin_ref(MDRequest *mdr, int n,
                                    set<SimpleLock*> &rdlocks,
-                                   bool want_auth)
+                                   bool want_auth,
+                                   bool no_want_auth)  /* for readdir, who doesn't want auth _even_if_ it's
+                                                          a snapped dir */
 {
   MClientRequest *req = mdr->client_request;
   const filepath& refpath = n ? req->get_filepath2() : req->get_filepath();
@@ -1732,7 +1734,7 @@ CInode* Server::rdlock_path_pin_ref(MDRequest *mdr, int n,
   dout(10) << "ref is " << *ref << dendl;
 
   // fw to inode auth?
-  if (mdr->snapid != CEPH_NOSNAP)
+  if (mdr->snapid != CEPH_NOSNAP && !no_want_auth)
     want_auth = true;
 
   if (want_auth) {
@@ -2297,7 +2299,7 @@ void Server::handle_client_readdir(MDRequest *mdr)
   MClientRequest *req = mdr->client_request;
   client_t client = req->get_source().num();
   set<SimpleLock*> rdlocks, wrlocks, xlocks;
-  CInode *diri = rdlock_path_pin_ref(mdr, 0, rdlocks, false);
+  CInode *diri = rdlock_path_pin_ref(mdr, 0, rdlocks, false, true);
   if (!diri) return;
 
   // it's a directory, right?
index 7abfc3356ae5196f36ae12d2fb0b63882d788a89..f4b00542cfcd25d732a5bf60ed3e556d738a5a4c 100644 (file)
@@ -117,7 +117,8 @@ public:
   void journal_allocated_inos(MDRequest *mdr, EMetaBlob *blob);
   void apply_allocated_inos(MDRequest *mdr);
 
-  CInode* rdlock_path_pin_ref(MDRequest *mdr, int n, set<SimpleLock*>& rdlocks, bool want_auth);
+  CInode* rdlock_path_pin_ref(MDRequest *mdr, int n, set<SimpleLock*>& rdlocks, bool want_auth,
+                             bool no_want_auth=false);
   CDentry* rdlock_path_xlock_dentry(MDRequest *mdr, int n, set<SimpleLock*>& rdlocks, set<SimpleLock*>& wrlocks, 
                                    set<SimpleLock*>& xlocks, bool okexist, bool mustexist, bool alwaysxlock);