From e516079b36230b9d69c9f5f286a970e4fb0ab4f1 Mon Sep 17 00:00:00 2001 From: Christopher Hoffman Date: Mon, 11 Aug 2025 14:30:05 +0000 Subject: [PATCH] client: move mref_reader check in statfs out of helper Signed-off-by: Christopher Hoffman (cherry picked from commit 9ab1209a68d450eca9bf915a605200ab92e53926) --- src/client/Client.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/client/Client.cc b/src/client/Client.cc index 2cbacbcb36a9a..0416ed363859e 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -12524,10 +12524,6 @@ int Client::getcwd(string& dir, const UserPerm& perms) 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; @@ -12965,6 +12961,10 @@ int Client::get_snap_info(const char *path, const UserPerm &perms, SnapInfo *sna int Client::ll_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; + /* 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. */ @@ -12973,6 +12973,10 @@ int Client::ll_statfs(Inode *in, struct statvfs *stbuf, const UserPerm& perms) int Client::statfs(const char *path, struct statvfs *stbuf, const UserPerm& perms) { + RWRef_t mref_reader(mount_state, CLIENT_MOUNTING); + if (!mref_reader.is_state_satisfied()) + return -ENOTCONN; + walk_dentry_result wdr; { std::scoped_lock l(client_lock); -- 2.39.5