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: v19.2.3~22^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c5966a29bbb8a783b9cf68d4fbbdd11cf3d140dd;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 (cherry picked from commit 2b78a5b3147d4e97be332ca88d286aec0ce44dc3) --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 674a2a606367..fbc42f79a97d 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -16081,7 +16081,7 @@ int Client::ll_sync_inode(Inode *in, bool syncdataonly) if (!mref_reader.is_state_satisfied()) return -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;