From 0c6a8add81c61960b733ce3ec38f7bbb3b5e93e9 Mon Sep 17 00:00:00 2001 From: Christopher Hoffman Date: Tue, 5 Aug 2025 19:34:45 +0000 Subject: [PATCH] client: use path supplied in statfs If path provided, use in statfs. Replumb internal statfs for internal only to allow for use in ll_statfs and statfs Fixes: https://tracker.ceph.com/issues/72355 Signed-off-by: Christopher Hoffman --- src/client/Client.cc | 19 +++++++++++++++++-- src/client/Client.h | 2 ++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/client/Client.cc b/src/client/Client.cc index 35baf658cf3..33f1945a4c3 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -12526,13 +12526,14 @@ int Client::getcwd(string& dir, const UserPerm& perms) return _getcwd(dir, perms); } -int Client::statfs(const char *path, struct statvfs *stbuf, +int Client::_statfs(Inode *in, struct statvfs *stbuf, const UserPerm& perms) { RWRef_t mref_reader(mount_state, CLIENT_MOUNTING); if (!mref_reader.is_state_satisfied()) return -ENOTCONN; + ldout(cct, 10) << __func__ << dendl; tout(cct) << __func__ << std::endl; unsigned long int total_files_on_fs; @@ -12973,7 +12974,21 @@ int Client::ll_statfs(Inode *in, struct statvfs *stbuf, const UserPerm& perms) /* Since the only thing this does is wrap a call to statfs, and statfs takes a lock, it doesn't seem we have a need to split it out. */ - return statfs(0, stbuf, perms); + return _statfs(in, stbuf, perms); +} + +int Client::statfs(const char *path, struct statvfs *stbuf, const UserPerm& perms) +{ + walk_dentry_result wdr; + { + std::scoped_lock l(client_lock); + if (int rc = path_walk(cwd, filepath(path), &wdr, perms, {}); rc < 0) { + return rc; + } + } + + auto in = wdr.target.get(); + return _statfs(in, stbuf, perms); } void Client::_ll_register_callbacks(struct ceph_client_callback_args *args) diff --git a/src/client/Client.h b/src/client/Client.h index 52b23288ea8..c4203312b72 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -1863,6 +1863,8 @@ private: int _lookup_vino(vinodeno_t ino, const UserPerm& perms, Inode **inode=NULL); bool _ll_forget(Inode *in, uint64_t count); + int _statfs(Inode *in, struct statvfs *stbuf, const UserPerm& perms); + void collect_and_send_metrics(); void collect_and_send_global_metrics(); -- 2.39.5