From 90adcdde25445b2c767bb174c15d4527422b0106 Mon Sep 17 00:00:00 2001 From: Xiubo Li Date: Thu, 3 Sep 2020 19:52:10 -0400 Subject: [PATCH] client: make the osdmap wait under the mount_state reader check It will make no sense to check this if the unmouting is already going on. https://tracker.ceph.com/issues/47293 Signed-off-by: Xiubo Li --- src/client/Client.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/client/Client.cc b/src/client/Client.cc index c042dee460998..87878b001e325 100755 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -11616,12 +11616,12 @@ int Client::fremovexattr(int fd, const char *name, const UserPerm& perms) int Client::setxattr(const char *path, const char *name, const void *value, size_t size, int flags, const UserPerm& perms) { - _setxattr_maybe_wait_for_osdmap(name, value, size); - RWRef_t mref_reader(mount_state, CLIENT_MOUNTING); if (!mref_reader.is_state_satisfied()) return -ENOTCONN; + _setxattr_maybe_wait_for_osdmap(name, value, size); + std::scoped_lock lock(client_lock); InodeRef in; @@ -11634,12 +11634,12 @@ int Client::setxattr(const char *path, const char *name, const void *value, int Client::lsetxattr(const char *path, const char *name, const void *value, size_t size, int flags, const UserPerm& perms) { - _setxattr_maybe_wait_for_osdmap(name, value, size); - RWRef_t mref_reader(mount_state, CLIENT_MOUNTING); if (!mref_reader.is_state_satisfied()) return -ENOTCONN; + _setxattr_maybe_wait_for_osdmap(name, value, size); + std::scoped_lock lock(client_lock); InodeRef in; @@ -11652,12 +11652,12 @@ int Client::lsetxattr(const char *path, const char *name, const void *value, int Client::fsetxattr(int fd, const char *name, const void *value, size_t size, int flags, const UserPerm& perms) { - _setxattr_maybe_wait_for_osdmap(name, value, size); - RWRef_t mref_reader(mount_state, CLIENT_MOUNTING); if (!mref_reader.is_state_satisfied()) return -ENOTCONN; + _setxattr_maybe_wait_for_osdmap(name, value, size); + std::scoped_lock lock(client_lock); Fh *f = get_filehandle(fd); -- 2.39.5