]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mds: fix Session::check_access()
authorYan, Zheng <zyan@redhat.com>
Fri, 17 Jun 2016 03:58:13 +0000 (11:58 +0800)
committerYan, Zheng <zyan@redhat.com>
Mon, 20 Jun 2016 03:32:08 +0000 (11:32 +0800)
It calls CInode::make_path_string(...) with the second argument is
false. The second argument makes the third argument useless. For
newly created inode, the path string is something like #1xxxxxxxxx.
This can cause the access check to fail.

Fixes: http://tracker.ceph.com/issues/16358
Signed-off-by: Yan, Zheng <zyan@redhat.com>
src/mds/CInode.cc
src/mds/CInode.h
src/mds/SessionMap.cc

index ea58d3831536d06545522ef8b4c050b6a6c2637a..0d97f885067233ab493a5a4b817ff4aef60200ea 100644 (file)
@@ -807,9 +807,14 @@ bool CInode::is_projected_ancestor_of(CInode *other)
   return false;
 }
 
-void CInode::make_path_string(string& s, bool force, CDentry *use_parent) const
+/*
+ * If use_parent is NULL (it should be one of inode's projected parents),
+ * we use it to make path string. Otherwise, we use inode's parent dentry
+ * to make path string
+ */
+void CInode::make_path_string(string& s, CDentry *use_parent) const
 {
-  if (!force)
+  if (!use_parent)
     use_parent = parent;
 
   if (use_parent) {
@@ -844,7 +849,7 @@ void CInode::make_path_string_projected(string& s) const
         p != projected_parent.end();
         ++p) {
       string q;
-      make_path_string(q, true, *p);
+      make_path_string(q, *p);
       s += " ";
       s += q;
     }
index 8f27bf0580badfe12464c2ace5a91436caa7f46a..21686a2e080f9df11d252f389214bbf25303fc9d 100644 (file)
@@ -738,7 +738,7 @@ public:
 
   // -- misc -- 
   bool is_projected_ancestor_of(CInode *other);
-  void make_path_string(std::string& s, bool force=false, CDentry *use_parent=NULL) const;
+  void make_path_string(std::string& s, CDentry *use_parent=NULL) const;
   void make_path_string_projected(std::string& s) const;
   void make_path(filepath& s) const;
   void name_stray_dentry(std::string& dname);
index eac0c5f4dd7c37ea5f5eb36626d40a515b51b257..c9131b5f3e792208263b375aeffd187ca074e91b 100644 (file)
@@ -854,7 +854,7 @@ int Session::check_access(CInode *in, unsigned mask,
     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());
+    in->make_path_string(path, in->get_projected_parent_dn());
     dout(20) << __func__ << " path " << path << dendl;
   }
   if (path.length())