From: Chengen Du Date: Mon, 12 Aug 2024 07:49:57 +0000 (+0800) Subject: client: Prevent race condition when printing Inode in ll_sync_inode X-Git-Tag: v20.0.0~1195^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2b78a5b3147d4e97be332ca88d286aec0ce44dc3;p=ceph.git client: Prevent race condition when printing Inode in ll_sync_inode 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::size(), resulting in abnormal behavior. Fixes: https://tracker.ceph.com/issues/67491 Co-authored-by: dongdong tao Signed-off-by: Chengen Du --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 5f78e73f9222..8f62bbbca799 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -16140,7 +16140,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;