From: Christopher Hoffman Date: Tue, 5 Aug 2025 19:34:45 +0000 (+0000) Subject: client: use path supplied in statfs X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b8949266cc33351c32385de462c73e9e6c10770a;p=ceph.git 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 (cherry picked from commit 0c6a8add81c61960b733ce3ec38f7bbb3b5e93e9) --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 9674f1e88b3b..795931019c77 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -12521,13 +12521,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; @@ -12968,7 +12969,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 97f035c3bc61..f5457eb27b8d 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -1862,6 +1862,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();