]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
client: unwrap dentries for getcwd
authorPatrick Donnelly <pdonnell@ibm.com>
Tue, 11 Mar 2025 14:51:38 +0000 (10:51 -0400)
committerPatrick Donnelly <pdonnell@ibm.com>
Thu, 13 Mar 2025 14:07:13 +0000 (10:07 -0400)
This was missed in the path_walk refactor. readdir is not the only way to "get"
dentry names.

Signed-off-by: Patrick Donnelly <pdonnell@ibm.com>
src/client/Client.cc

index e32d2d3360c3132e88058df4a879712217e615f2..8613777ea16746f66aa1c756facc6f6b67e0118d 100644 (file)
@@ -12323,8 +12323,8 @@ int Client::_getcwd(string& dir, const UserPerm& perms)
   filepath path;
   ldout(cct, 10) << __func__ << " " << *cwd << dendl;
 
-  Inode *in = cwd.get();
-  while (in != root.get()) {
+  auto in = cwd;
+  while (in != root) {
     ceph_assert(in->dentries.size() < 2); // dirs can't be hard-linked
 
     // A cwd or ancester is unlinked
@@ -12348,11 +12348,14 @@ int Client::_getcwd(string& dir, const UserPerm& perms)
 
       // start over
       path = filepath();
-      in = cwd.get();
+      in = cwd;
       continue;
     }
-    path.push_front_dentry(dn->name);
-    in = dn->dir->parent_inode;
+    auto* diri = dn->dir->parent_inode;
+    ceph_assert(diri);
+    auto dname = _unwrap_name(*diri, dn->name, dn->alternate_name);
+    path.push_front_dentry(dname);
+    in = InodeRef(diri);
   }
   dir = "/";
   dir += path.get_path();