Skip to content

Commit

Permalink
Merge pull request #10105: jewel: Session::check_access() is buggy
Browse files Browse the repository at this point in the history
Reviewed-by: Loic Dachary <ldachary@redhat.com>
  • Loading branch information
Loic Dachary committed Aug 8, 2016
2 parents 0a7fcf5 + 64d99b1 commit b2f694f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
11 changes: 8 additions & 3 deletions src/mds/CInode.cc
Expand Up @@ -810,9 +810,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) {
Expand Down Expand Up @@ -847,7 +852,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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/mds/CInode.h
Expand Up @@ -739,7 +739,7 @@ class CInode : public MDSCacheObject, public InodeStoreBase {

// -- 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);
Expand Down
2 changes: 1 addition & 1 deletion src/mds/SessionMap.cc
Expand Up @@ -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())
Expand Down

0 comments on commit b2f694f

Please sign in to comment.