From cad3af63697b4e00875d217d2f2ae535b53ab5be Mon Sep 17 00:00:00 2001 From: Xiubo Li Date: Sat, 8 Aug 2020 07:23:14 +0800 Subject: [PATCH] client: switch to use ceph_mutex_is_locked_by_me always There is one case if the client_lock is hold by another thread, the check here will also be passed. Fixes: https://tracker.ceph.com/issues/46868 Signed-off-by: Xiubo Li --- src/client/Client.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/client/Client.cc b/src/client/Client.cc index e7eb2c23ef76..d4286a413982 100755 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -4004,7 +4004,7 @@ bool Client::_flush(Inode *in, Context *onfinish) void Client::_flush_range(Inode *in, int64_t offset, uint64_t size) { - ceph_assert(ceph_mutex_is_locked(client_lock)); + ceph_assert(ceph_mutex_is_locked_by_me(client_lock)); if (!in->oset.dirty_or_tx) { ldout(cct, 10) << " nothing to flush" << dendl; return; @@ -4024,7 +4024,7 @@ void Client::_flush_range(Inode *in, int64_t offset, uint64_t size) void Client::flush_set_callback(ObjectCacher::ObjectSet *oset) { // std::scoped_lock l(client_lock); - ceph_assert(ceph_mutex_is_locked(client_lock)); // will be called via dispatch() -> objecter -> ... + ceph_assert(ceph_mutex_is_locked_by_me(client_lock)); // will be called via dispatch() -> objecter -> ... Inode *in = static_cast(oset->parent); ceph_assert(in); _flushed(in); @@ -8269,7 +8269,7 @@ struct dentry_off_lt { int Client::_readdir_cache_cb(dir_result_t *dirp, add_dirent_cb_t cb, void *p, int caps, bool getref) { - ceph_assert(ceph_mutex_is_locked(client_lock)); + ceph_assert(ceph_mutex_is_locked_by_me(client_lock)); ldout(cct, 10) << __func__ << " " << dirp << " on " << dirp->inode->ino << " last_name " << dirp->last_name << " offset " << hex << dirp->offset << dec << dendl; -- 2.47.3