From 929048f98f4b4aaad9aeb97d765d765b62af0a0c Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 21 May 2010 12:08:17 -0700 Subject: [PATCH] mds: fix readdir pingpong on snapped dir with multiple mds 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 --- src/mds/Server.cc | 8 +++++--- src/mds/Server.h | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/mds/Server.cc b/src/mds/Server.cc index 075a2bc103307..fb4ff2bcf99a8 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -1707,7 +1707,9 @@ CDir *Server::traverse_to_auth_dir(MDRequest *mdr, vector &trace, file CInode* Server::rdlock_path_pin_ref(MDRequest *mdr, int n, set &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 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? diff --git a/src/mds/Server.h b/src/mds/Server.h index 7abfc3356ae51..f4b00542cfcd2 100644 --- a/src/mds/Server.h +++ b/src/mds/Server.h @@ -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& rdlocks, bool want_auth); + CInode* rdlock_path_pin_ref(MDRequest *mdr, int n, set& rdlocks, bool want_auth, + bool no_want_auth=false); CDentry* rdlock_path_xlock_dentry(MDRequest *mdr, int n, set& rdlocks, set& wrlocks, set& xlocks, bool okexist, bool mustexist, bool alwaysxlock); -- 2.39.5