]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: switch to use ceph_mutex_is_locked_by_me always 36525/head
authorXiubo Li <xiubli@redhat.com>
Fri, 7 Aug 2020 23:23:14 +0000 (07:23 +0800)
committerXiubo Li <xiubli@redhat.com>
Tue, 11 Aug 2020 01:29:49 +0000 (09:29 +0800)
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 <xiubli@redhat.com>
src/client/Client.cc

index e7eb2c23ef76d9c2a4960054cb757b2f164d5e56..d4286a413982013d6851b8ae3359939818074f42 100755 (executable)
@@ -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<Inode *>(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;