Skip to content

Commit cda2a6e

Browse files
committed
client: unwrap dentries for getcwd
This was missed in the path_walk refactor. readdir is not the only way to "get" dentry names. Signed-off-by: Patrick Donnelly <[email protected]>
1 parent 3bfd614 commit cda2a6e

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/client/Client.cc

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12323,8 +12323,8 @@ int Client::_getcwd(string& dir, const UserPerm& perms)
1232312323
filepath path;
1232412324
ldout(cct, 10) << __func__ << " " << *cwd << dendl;
1232512325

12326-
Inode *in = cwd.get();
12327-
while (in != root.get()) {
12326+
auto in = cwd;
12327+
while (in != root) {
1232812328
ceph_assert(in->dentries.size() < 2); // dirs can't be hard-linked
1232912329

1233012330
// A cwd or ancester is unlinked
@@ -12348,11 +12348,14 @@ int Client::_getcwd(string& dir, const UserPerm& perms)
1234812348

1234912349
// start over
1235012350
path = filepath();
12351-
in = cwd.get();
12351+
in = cwd;
1235212352
continue;
1235312353
}
12354-
path.push_front_dentry(dn->name);
12355-
in = dn->dir->parent_inode;
12354+
auto* diri = dn->dir->parent_inode;
12355+
ceph_assert(diri);
12356+
auto dname = _unwrap_name(*diri, dn->name, dn->alternate_name);
12357+
path.push_front_dentry(dname);
12358+
in = InodeRef(diri);
1235612359
}
1235712360
dir = "/";
1235812361
dir += path.get_path();

0 commit comments

Comments
 (0)