]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test/librados/aio_cxx: Fix potential mutex destruction failure on PoolEIOFlag 64242/head
authorNitzan Mordechai <nmordech@redhat.com>
Sun, 22 Jun 2025 13:43:55 +0000 (13:43 +0000)
committerNitzan Mordechai <nmordech@redhat.com>
Sun, 29 Jun 2025 06:30:00 +0000 (06:30 +0000)
GTEST_SKIP() does not return and causes early test exit, which
skips any following cleanup logic.
In this case, the test skipped before releasing my_lock, causing
pthread_mutex_destroy() to fail with EBUSY and trigger a ceph_assert()
in the mutex debug wrapper.
Fix by explicitly unlocking the mutex before calling GTEST_SKIP().

Signed-off-by: Nitzan Mordechai <nmordech@ibm.com>
(cherry picked from commit 26e7bbf68142419d9e2991099e42853c1a7339b4)

src/test/librados/aio_cxx.cc

index b0b7b6c4e7d50d806ee5e44c937dc9658c893c87..32470489373bd347b8f4a51c6b67cc3fc12ef29f 100644 (file)
@@ -2349,7 +2349,7 @@ void pool_io_callback(completion_t cb, void *arg /* Actually AioCompletion* */)
     ASSERT_EQ(0, info->c->wait_for_complete());
   }
   int r = info->c->get_return_value();
-  cout << "finish " << i << " r = " << r << std::endl;
+  //cout << "finish " << i << " r = " << r << std::endl;
 
   std::scoped_lock l(my_lock);
   inflight.erase(i);
@@ -2426,8 +2426,8 @@ TEST(LibRadosAio, PoolEIOFlag) {
   }
 
   if (!missed_eio) {
-    GTEST_SKIP() << "eio flag missed all ios that already completed";
     my_lock.unlock();
+    GTEST_SKIP() << "eio flag missed all ios that already completed";
   }
   cout << "max_success " << max_success << ", min_failed " << min_failed << std::endl;
   ASSERT_TRUE(max_success + 1 == min_failed);