]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test/libcephfs: update delegation test assertions 52569/head
authorLucian Petrut <lpetrut@cloudbasesolutions.com>
Fri, 21 Jul 2023 07:42:47 +0000 (07:42 +0000)
committerLucian Petrut <lpetrut@cloudbasesolutions.com>
Fri, 21 Jul 2023 07:48:22 +0000 (07:48 +0000)
Some of the libcephfs tests ensure that the delegations are recalled
as a result of certain open requests.

The issue is that we're expecting the "opened" flag to be false
after the delegation gets recalled, which is racy.

  /home/ubuntu/ceph/src/test/libcephfs/deleg.cc:392: Failure
  Expected equality of these values:
    opened.load()
      Which is: true
    false

We'll update those checks, asserting that "opened" is true after
the delegation breaker thread returns.

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
src/test/libcephfs/deleg.cc

index 061e13763c62fedb86e685e385d395e89baddefb..7bdc97d206ee64f2e6ac71ba560159239bb30e85 100644 (file)
@@ -186,9 +186,9 @@ static void simple_deleg_test(struct ceph_mount_info *cmount, struct ceph_mount_
   std::thread breaker1(open_breaker_func, tcmount, filename, O_RDWR, &opened);
 
   wait_for_atomic_bool(recalled);
-  ASSERT_EQ(opened.load(), false);
   ASSERT_EQ(ceph_ll_delegation(cmount, fh, CEPH_DELEGATION_NONE, dummy_deleg_cb, &recalled), 0);
   breaker1.join();
+  ASSERT_EQ(opened.load(), true);
   ASSERT_EQ(ceph_ll_close(cmount, fh), 0);
   ASSERT_EQ(ceph_ll_unlink(cmount, root, filename, perms), 0);
 
@@ -201,9 +201,9 @@ static void simple_deleg_test(struct ceph_mount_info *cmount, struct ceph_mount_
   ASSERT_EQ(ceph_ll_delegation_wait(cmount, fh, CEPH_DELEGATION_WR, dummy_deleg_cb, &recalled), 0);
   std::thread breaker2(open_breaker_func, tcmount, filename, O_RDONLY, &opened);
   wait_for_atomic_bool(recalled);
-  ASSERT_EQ(opened.load(), false);
   ASSERT_EQ(ceph_ll_delegation(cmount, fh, CEPH_DELEGATION_NONE, dummy_deleg_cb, &recalled), 0);
   breaker2.join();
+  ASSERT_EQ(opened.load(), true);
   ASSERT_EQ(ceph_ll_close(cmount, fh), 0);
   ASSERT_EQ(ceph_ll_unlink(cmount, root, filename, perms), 0);
 
@@ -222,9 +222,9 @@ static void simple_deleg_test(struct ceph_mount_info *cmount, struct ceph_mount_
   std::thread breaker4(open_breaker_func, tcmount, filename, O_WRONLY, &opened);
   wait_for_atomic_bool(recalled);
   usleep(1000);
-  ASSERT_EQ(opened.load(), false);
   ASSERT_EQ(ceph_ll_delegation(cmount, fh, CEPH_DELEGATION_NONE, dummy_deleg_cb, &recalled), 0);
   breaker4.join();
+  ASSERT_EQ(opened.load(), true);
   ASSERT_EQ(ceph_ll_close(cmount, fh), 0);
   ASSERT_EQ(ceph_ll_unlink(cmount, root, filename, perms), 0);
 
@@ -389,10 +389,10 @@ TEST(LibCephFS, RecalledGetattr) {
     ASSERT_LT(i++, MAX_WAIT);
     usleep(1000);
   } while (!recalled.load());
-  ASSERT_EQ(opened.load(), false);
   ASSERT_EQ(ceph_ll_getattr(cmount2, file, &stx, CEPH_STATX_ALL_STATS, 0, perms), 0);
   ASSERT_EQ(ceph_ll_delegation(cmount2, fh, CEPH_DELEGATION_NONE, dummy_deleg_cb, nullptr), 0);
   breaker1.join();
+  ASSERT_EQ(opened.load(), true);
   ASSERT_EQ(ceph_ll_close(cmount2, fh), 0);
   ceph_unmount(cmount2);
   ceph_release(cmount2);