]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
client: Prevent race condition when printing Inode in ll_sync_inode
authorChengen Du <chengen.du@canonical.com>
Mon, 12 Aug 2024 07:49:57 +0000 (15:49 +0800)
committerPonnuvel Palaniyappan <pponnuvel@gmail.com>
Thu, 5 Sep 2024 15:01:34 +0000 (16:01 +0100)
In the ll_sync_inode function, the entire Inode structure is printed without
holding a lock. This can lead to a race condition when evaluating the assertion
in xlist<ObjectCacher::Object*>::size(), resulting in abnormal behavior.

Fixes: https://tracker.ceph.com/issues/67491
Co-authored-by: dongdong tao <tdd21151186@gmail.com>
Signed-off-by: Chengen Du <chengen.du@canonical.com>
(cherry picked from commit 2b78a5b3147d4e97be332ca88d286aec0ce44dc3)

src/client/Client.cc

index a84e69f38f2fdcca7691a0c805b6d27a0398a924..42b5d1f863578321c330fb9a66948864fed58f32 100644 (file)
@@ -15347,7 +15347,7 @@ int Client::ll_sync_inode(Inode *in, bool syncdataonly)
   if (!mref_reader.is_state_satisfied())
     return -CEPHFS_ENOTCONN;
 
-  ldout(cct, 3) << "ll_sync_inode " << *in << " " << dendl;
+  ldout(cct, 3) << "ll_sync_inode " << _get_vino(in) << " " << dendl;
   tout(cct) << "ll_sync_inode" << std::endl;
   tout(cct) << (uintptr_t)in << std::endl;