From 2edaafdf1da61561a237bdb5685a3061cd46074e Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Tue, 11 Mar 2025 10:51:38 -0400 Subject: [PATCH] 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 (cherry picked from commit cda2a6e6facb24eba96afb51341720336febdd54) --- src/client/Client.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/client/Client.cc b/src/client/Client.cc index e2f0ee0fa2357..63fc0dec0030f 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -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(); -- 2.39.5