From: Venky Shankar Date: Fri, 30 May 2025 18:11:19 +0000 (+0000) Subject: client: asynchronous fsync can decrement request ref twice X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=311750d8601503d43c71bd1cbb88d7b00d5c0cfd;p=ceph.git client: asynchronous fsync can decrement request ref twice After the asynchronous execution context is woken up when waiting for Fb caps reference to be released causing the clien to crash as per: ``` 0x00007f3115b2452c in __pthread_kill_implementation () from /lib64/libc.so.6 0x00007f3115ad7686 in raise () from /lib64/libc.so.6 0x00007f3115ac1833 in abort () from /lib64/libc.so.6 0x00007f3113375d0a in ceph::__ceph_assert_fail (assertion=, file=, line=, func=) at /usr/src/debug/ceph-19.2.0-124.el9cp.x86_64/src/common/assert.cc:74 0x00007f3113375e6f in ceph::__ceph_assert_fail (ctx=...) at /usr/src/debug/ceph-19.2.0-124.el9cp.x86_64/src/common/assert.cc:79 0x00007f311237db1d in xlist::item::~item (this=, this=) at /usr/src/debug/ceph-19.2.0-124.el9cp.x86_64/src/include/xlist.h:31 MetaRequest::~MetaRequest (this=, this=) at /usr/src/debug/ceph-19.2.0-124.el9cp.x86_64/src/client/MetaRequest.cc:65 Client::put_request (this=0x564b491726c0, request=0x7f301c0165c0) at /usr/src/debug/ceph-19.2.0-124.el9cp.x86_64/src/client/Client.cc:2140 0x00007f31123c88ad in Client::C_nonblocking_fsync_state::advance (this=0x7f307002e9f0) at /usr/src/debug/ceph-19.2.0-124.el9cp.x86_64/src/client/Client.cc:11905 0x00007f3112331ccd in Context::complete (this=0x7f3070009250, r=) at /usr/src/debug/ceph-19.2.0-124.el9cp.x86_64/src/include/Context.h:99 0x00007f311246a964 in Client::signal_context_list(std::__cxx11::list >&) [clone .constprop.0] (ls=std::__cxx11::list = {...}, this=) at /usr/src/debug/ceph-19.2.0-124.el9cp.x86_64/src/client/Client.cc:4257 0x00007f3112395f45 in Client::put_cap_ref (this=0x564b491726c0, in=0x7f306807be90, cap=) at /usr/src/debug/ceph-19.2.0-124.el9cp.x86_64/src/client/Client.cc:3611 0x00007f31123331f3 in Client::C_Write_Finisher::finish_io (r=0, this=0x7f30240442d0) at /usr/src/debug/ceph-19.2.0-124.el9cp.x86_64/src/client/Client.cc:11381 Client::CWF_iofinish::finish (this=, r=0) at /usr/src/debug/ceph-19.2.0-124.el9cp.x86_64/src/client/Client.h:1481 0x00007f3112331ccd in Context::complete (this=0x7f302401afd0, r=) at /usr/src/debug/ceph-19.2.0-124.el9cp.x86_64/src/include/Context.h:99 0x00007f31123c5242 in Client::C_Lock_Client_Finisher::finish (this=0x7f302403c9d0, r=0) at /usr/src/debug/ceph-19.2.0-124.el9cp.x86_64/src/client/Client.cc:11372 0x00007f3112331ccd in Context::complete (this=0x7f302403c9d0, r=) at /usr/src/debug/ceph-19.2.0-124.el9cp.x86_64/src/include/Context.h:99 0x00007f31134374ad in Finisher::finisher_thread_entry (this=0x564b491730b0) at /usr/src/debug/ceph-19.2.0-124.el9cp.x86_64/src/common/Finisher.cc:72 0x00007f3115b227e2 in start_thread () from /lib64/libc.so.6 0x00007f3115ba7800 in clone3 () from /lib64/libc.so.6 0x0000000000000000 in ?? () ``` Fixes: http://tracker.ceph.com/issues/71510 Signed-off-by: Venky Shankar (cherry picked from commit ad5a42c75cacfe7cd28d053455e9612fc96d4191) --- diff --git a/src/client/Client.cc b/src/client/Client.cc index b04900912f91b..889950d4a389f 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -12133,6 +12133,7 @@ void Client::C_nonblocking_fsync_state::advance() if (waitfor_safe) { clnt->put_request(req); + waitfor_safe = false; } if (flush_wait && !flush_completed) {