From aed5caddf9f66e7575be288f9999ae24e37e31ed Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 1 Sep 2015 22:30:36 -0400 Subject: [PATCH] mds/SessionMap: fix check_access for stray inodes Signed-off-by: Sage Weil --- src/mds/SessionMap.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/mds/SessionMap.cc b/src/mds/SessionMap.cc index e36945c31b728..9cd37a32dd1be 100644 --- a/src/mds/SessionMap.cc +++ b/src/mds/SessionMap.cc @@ -732,6 +732,9 @@ void SessionMap::save_if_dirty(const std::set &tgt_sessions, // ================= // Session +#undef dout_prefix +#define dout_prefix *_dout << "Session " + /** * Calculate the length of the `requests` member list, * because elist does not have a size() method. @@ -832,14 +835,18 @@ void Session::decode(bufferlist::iterator &p) _update_human_name(); } -bool Session::check_access(CInode *in, unsigned mask, int caller_uid, int caller_gid, int setattr_uid, int setattr_gid) +bool Session::check_access(CInode *in, unsigned mask, + int caller_uid, int caller_gid, + int setattr_uid, int setattr_gid) { string path; - - if (in->is_stray()){ + CInode *diri = in->get_parent_inode(); + if (diri && diri->is_stray()){ path = in->get_projected_inode()->stray_prior_path; + dout(20) << __func__ << " stray_prior_path " << path << dendl; } else { in->make_path_string(path, false, in->get_projected_parent_dn()); + dout(20) << __func__ << " path " << path << dendl; } if (path.length()) path = path.substr(1); // drop leading / -- 2.39.5