]> git.apps.os.sepia.ceph.com Git - ceph.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>
Mon, 17 Mar 2025 19:43:24 +0000 (15:43 -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>
(cherry picked from commit cda2a6e6facb24eba96afb51341720336febdd54)

src/client/Client.cc

index e2f0ee0fa2357dc7975b3dee3599cedacbc474b8..63fc0dec0030fba8f675ab398680c90de9690372 100644 (file)
@@ -12257,8 +12257,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
@@ -12282,11 +12282,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();