From: Xiubo Li Date: Fri, 7 Aug 2020 23:23:14 +0000 (+0800) Subject: client: switch to use ceph_mutex_is_locked_by_me always X-Git-Tag: v16.1.0~1410^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F36525%2Fhead;p=ceph.git 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 --- 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;