From d388dae58f4c271516e4b79cebb7b822f6499ae5 Mon Sep 17 00:00:00 2001 From: Willem Jan Withagen Date: Sat, 21 Sep 2019 14:51:06 +0200 Subject: [PATCH] test/libcephfs: introduce (uint64_t)ceph_pthread_self() There is a difference between libc shipped with FreeBSD and glibc shipped with GNU/Linux for the return type of pthread_self(). Introduced a conversion function in include/compat.h (uint64_t)ceph_pthread_self() Signed-off-by: Willem Jan Withagen --- src/test/libcephfs/ceph_pthread_self.h | 31 +++++++++++++ src/test/libcephfs/flock.cc | 61 ++++++++++++------------ src/test/libcephfs/recordlock.cc | 64 ++++++++++++++------------ 3 files changed, 97 insertions(+), 59 deletions(-) create mode 100644 src/test/libcephfs/ceph_pthread_self.h diff --git a/src/test/libcephfs/ceph_pthread_self.h b/src/test/libcephfs/ceph_pthread_self.h new file mode 100644 index 0000000000000..4c0c98f6ee3f7 --- /dev/null +++ b/src/test/libcephfs/ceph_pthread_self.h @@ -0,0 +1,31 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab + +#ifndef CEPH_TEST_LIBCEPHFS_PTHREAD_SELF +#define CEPH_TEST_LIBCEPHFS_PTHREAD_SELF + +#include + +#include + +/* + * There is a difference between libc shipped with FreeBSD and + * glibc shipped with GNU/Linux for the return type of pthread_self(). + * + * Introduced a conversion function in include/compat.h + * (uint64_t)ceph_pthread_self() + * + * libc returns an opague pthread_t that is not default convertable + * to a uint64_t, which is what gtest expects. + * And tests using gtest will not compile because of this difference. + * + */ +static uint64_t ceph_pthread_self() { + auto me = pthread_self(); + static_assert(std::is_convertible_v || + std::is_pointer_v, + "we need to use pthread_self() for the owner parameter"); + return reinterpret_cast(me); +} + +#endif diff --git a/src/test/libcephfs/flock.cc b/src/test/libcephfs/flock.cc index 79f8a0777ade5..9add019d37ae9 100644 --- a/src/test/libcephfs/flock.cc +++ b/src/test/libcephfs/flock.cc @@ -26,8 +26,6 @@ #include #include #include -#include - #include #include #include @@ -35,9 +33,14 @@ #ifdef __linux__ #include +#include +#elif __FreeBSD__ +#include +#include #endif #include "include/ceph_assert.h" +#include "ceph_pthread_self.h" // Startup common: create and mount ceph fs #define STARTUP_CEPH() do { \ @@ -175,27 +178,27 @@ static void thread_ConcurrentLocking(str_ConcurrentLocking& s) { ASSERT_GE(fd, 0); ASSERT_EQ(-EWOULDBLOCK, - ceph_flock(cmount, fd, LOCK_EX | LOCK_NB, pthread_self())); + ceph_flock(cmount, fd, LOCK_EX | LOCK_NB, ceph_pthread_self())); PING_MAIN(1); // (1) - ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_EX, pthread_self())); + ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_EX, ceph_pthread_self())); PING_MAIN(2); // (2) - ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_UN, pthread_self())); + ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_UN, ceph_pthread_self())); PING_MAIN(3); // (3) - ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_SH, pthread_self())); + ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_SH, ceph_pthread_self())); PING_MAIN(4); // (4) WAIT_MAIN(1); // (R1) - ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_UN, pthread_self())); + ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_UN, ceph_pthread_self())); PING_MAIN(5); // (5) WAIT_MAIN(2); // (R2) - ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_EX, pthread_self())); + ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_EX, ceph_pthread_self())); PING_MAIN(6); // (6) WAIT_MAIN(3); // (R3) - ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_UN, pthread_self())); + ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_UN, ceph_pthread_self())); PING_MAIN(7); // (7) } @@ -218,7 +221,7 @@ TEST(LibCephFS, ConcurrentLocking) { ASSERT_GE(fd, 0); // Lock - ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_EX, pthread_self())); + ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_EX, ceph_pthread_self())); // Start locker thread pthread_t thread; @@ -233,7 +236,7 @@ TEST(LibCephFS, ConcurrentLocking) { NOT_WAIT_WORKER(2); // (2) // Unlock - ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_UN, pthread_self())); + ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_UN, ceph_pthread_self())); // Shall have lock // Synchronization point with thread (failure: thread is dead) @@ -245,8 +248,8 @@ TEST(LibCephFS, ConcurrentLocking) { // Wait for thread to share lock WAIT_WORKER(4); // (4) ASSERT_EQ(-EWOULDBLOCK, - ceph_flock(cmount, fd, LOCK_EX | LOCK_NB, pthread_self())); - ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_SH | LOCK_NB, pthread_self())); + ceph_flock(cmount, fd, LOCK_EX | LOCK_NB, ceph_pthread_self())); + ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_SH | LOCK_NB, ceph_pthread_self())); // Wake up thread to unlock shared lock PING_WORKER(1); // (R1) @@ -254,7 +257,7 @@ TEST(LibCephFS, ConcurrentLocking) { // Now we can lock exclusively // Upgrade to exclusive lock (as per POSIX) - ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_EX, pthread_self())); + ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_EX, ceph_pthread_self())); // Wake up thread to lock shared lock PING_WORKER(2); // (R2) @@ -263,22 +266,22 @@ TEST(LibCephFS, ConcurrentLocking) { NOT_WAIT_WORKER(6); // (6) // Release lock ; thread will get it - ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_UN, pthread_self())); + ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_UN, ceph_pthread_self())); WAIT_WORKER(6); // (6) // We no longer have the lock ASSERT_EQ(-EWOULDBLOCK, - ceph_flock(cmount, fd, LOCK_EX | LOCK_NB, pthread_self())); + ceph_flock(cmount, fd, LOCK_EX | LOCK_NB, ceph_pthread_self())); ASSERT_EQ(-EWOULDBLOCK, - ceph_flock(cmount, fd, LOCK_SH | LOCK_NB, pthread_self())); + ceph_flock(cmount, fd, LOCK_SH | LOCK_NB, ceph_pthread_self())); // Wake up thread to unlock exclusive lock PING_WORKER(3); // (R3) WAIT_WORKER(7); // (7) // We can lock it again - ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_EX | LOCK_NB, pthread_self())); - ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_UN, pthread_self())); + ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_EX | LOCK_NB, ceph_pthread_self())); + ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_UN, ceph_pthread_self())); // Cleanup void *retval = (void*) (uintptr_t) -1; @@ -301,7 +304,7 @@ TEST(LibCephFS, ThreesomeLocking) { ASSERT_GE(fd, 0); // Lock - ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_EX, pthread_self())); + ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_EX, ceph_pthread_self())); // Start locker thread pthread_t thread[2]; @@ -317,7 +320,7 @@ TEST(LibCephFS, ThreesomeLocking) { NOT_WAIT_WORKER(2); // (2) // Unlock - ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_UN, pthread_self())); + ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_UN, ceph_pthread_self())); // Shall have lock TWICE(// Synchronization point with thread (failure: thread is dead) @@ -329,8 +332,8 @@ TEST(LibCephFS, ThreesomeLocking) { // Wait for thread to share lock TWICE(WAIT_WORKER(4)); // (4) ASSERT_EQ(-EWOULDBLOCK, - ceph_flock(cmount, fd, LOCK_EX | LOCK_NB, pthread_self())); - ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_SH | LOCK_NB, pthread_self())); + ceph_flock(cmount, fd, LOCK_EX | LOCK_NB, ceph_pthread_self())); + ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_SH | LOCK_NB, ceph_pthread_self())); // Wake up thread to unlock shared lock TWICE(PING_WORKER(1); // (R1) @@ -338,7 +341,7 @@ TEST(LibCephFS, ThreesomeLocking) { // Now we can lock exclusively // Upgrade to exclusive lock (as per POSIX) - ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_EX, pthread_self())); + ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_EX, ceph_pthread_self())); TWICE( // Wake up thread to lock shared lock PING_WORKER(2); // (R2) @@ -347,14 +350,14 @@ TEST(LibCephFS, ThreesomeLocking) { NOT_WAIT_WORKER(6)); // (6) // Release lock ; thread will get it - ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_UN, pthread_self())); + ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_UN, ceph_pthread_self())); TWICE(WAIT_WORKER(6); // (6) // We no longer have the lock ASSERT_EQ(-EWOULDBLOCK, - ceph_flock(cmount, fd, LOCK_EX | LOCK_NB, pthread_self())); + ceph_flock(cmount, fd, LOCK_EX | LOCK_NB, ceph_pthread_self())); ASSERT_EQ(-EWOULDBLOCK, - ceph_flock(cmount, fd, LOCK_SH | LOCK_NB, pthread_self())); + ceph_flock(cmount, fd, LOCK_SH | LOCK_NB, ceph_pthread_self())); // Wake up thread to unlock exclusive lock PING_WORKER(3); // (R3) @@ -362,8 +365,8 @@ TEST(LibCephFS, ThreesomeLocking) { ); // We can lock it again - ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_EX | LOCK_NB, pthread_self())); - ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_UN, pthread_self())); + ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_EX | LOCK_NB, ceph_pthread_self())); + ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_UN, ceph_pthread_self())); // Cleanup void *retval = (void*) (uintptr_t) -1; diff --git a/src/test/libcephfs/recordlock.cc b/src/test/libcephfs/recordlock.cc index 9d1fcdede8b9e..efcfc6aab5c3f 100644 --- a/src/test/libcephfs/recordlock.cc +++ b/src/test/libcephfs/recordlock.cc @@ -27,7 +27,6 @@ #include #include #include -#include #include #include @@ -36,9 +35,14 @@ #ifdef __linux__ #include +#include +#elif __FreeBSD__ +#include +#include #endif #include "include/ceph_assert.h" +#include "ceph_pthread_self.h" // Startup common: create and mount ceph fs #define STARTUP_CEPH() do { \ @@ -304,7 +308,7 @@ static void thread_ConcurrentRecordLocking(str_ConcurrentRecordLocking& s) { lock1.l_start = 0; lock1.l_len = 1024; lock1.l_pid = getpid(); - ASSERT_EQ(-EAGAIN, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false)); + ASSERT_EQ(-EAGAIN, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false)); PING_MAIN(1); // (1) lock1.l_type = F_WRLCK; @@ -312,7 +316,7 @@ static void thread_ConcurrentRecordLocking(str_ConcurrentRecordLocking& s) { lock1.l_start = 0; lock1.l_len = 1024; lock1.l_pid = getpid(); - ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), true)); + ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), true)); PING_MAIN(2); // (2) lock1.l_type = F_UNLCK; @@ -320,7 +324,7 @@ static void thread_ConcurrentRecordLocking(str_ConcurrentRecordLocking& s) { lock1.l_start = 0; lock1.l_len = 1024; lock1.l_pid = getpid(); - ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false)); + ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false)); PING_MAIN(3); // (3) lock1.l_type = F_RDLCK; @@ -328,7 +332,7 @@ static void thread_ConcurrentRecordLocking(str_ConcurrentRecordLocking& s) { lock1.l_start = 0; lock1.l_len = 1024; lock1.l_pid = getpid(); - ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), true)); + ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), true)); PING_MAIN(4); // (4) WAIT_MAIN(1); // (R1) @@ -337,7 +341,7 @@ static void thread_ConcurrentRecordLocking(str_ConcurrentRecordLocking& s) { lock1.l_start = 0; lock1.l_len = 1024; lock1.l_pid = getpid(); - ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false)); + ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false)); PING_MAIN(5); // (5) WAIT_MAIN(2); // (R2) @@ -346,7 +350,7 @@ static void thread_ConcurrentRecordLocking(str_ConcurrentRecordLocking& s) { lock1.l_start = 0; lock1.l_len = 1024; lock1.l_pid = getpid(); - ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), true)); + ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), true)); PING_MAIN(6); // (6) WAIT_MAIN(3); // (R3) @@ -355,7 +359,7 @@ static void thread_ConcurrentRecordLocking(str_ConcurrentRecordLocking& s) { lock1.l_start = 0; lock1.l_len = 1024; lock1.l_pid = getpid(); - ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false)); + ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false)); PING_MAIN(7); // (7) ASSERT_EQ(0, ceph_ll_close(cmount, fh)); @@ -398,7 +402,7 @@ TEST(LibCephFS, ConcurrentRecordLocking) { lock1.l_start = 0; lock1.l_len = 1024; lock1.l_pid = getpid(); - ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), true)); + ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), true)); // Start locker thread pthread_t thread; @@ -418,7 +422,7 @@ TEST(LibCephFS, ConcurrentRecordLocking) { lock1.l_start = 0; lock1.l_len = 1024; lock1.l_pid = getpid(); - ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false)); + ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false)); // Shall have lock // Synchronization point with thread (failure: thread is dead) @@ -434,13 +438,13 @@ TEST(LibCephFS, ConcurrentRecordLocking) { lock1.l_start = 0; lock1.l_len = 1024; lock1.l_pid = getpid(); - ASSERT_EQ(-EAGAIN, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false)); + ASSERT_EQ(-EAGAIN, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false)); lock1.l_type = F_RDLCK; lock1.l_whence = SEEK_SET; lock1.l_start = 0; lock1.l_len = 1024; lock1.l_pid = getpid(); - ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false)); + ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false)); // Wake up thread to unlock shared lock PING_WORKER(1); // (R1) @@ -453,7 +457,7 @@ TEST(LibCephFS, ConcurrentRecordLocking) { lock1.l_start = 0; lock1.l_len = 1024; lock1.l_pid = getpid(); - ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), true)); + ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), true)); // Wake up thread to lock shared lock PING_WORKER(2); // (R2) @@ -467,7 +471,7 @@ TEST(LibCephFS, ConcurrentRecordLocking) { lock1.l_start = 0; lock1.l_len = 1024; lock1.l_pid = getpid(); - ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false)); + ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false)); WAIT_WORKER(6); // (6) // We no longer have the lock @@ -476,13 +480,13 @@ TEST(LibCephFS, ConcurrentRecordLocking) { lock1.l_start = 0; lock1.l_len = 1024; lock1.l_pid = getpid(); - ASSERT_EQ(-EAGAIN, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false)); + ASSERT_EQ(-EAGAIN, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false)); lock1.l_type = F_RDLCK; lock1.l_whence = SEEK_SET; lock1.l_start = 0; lock1.l_len = 1024; lock1.l_pid = getpid(); - ASSERT_EQ(-EAGAIN, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false)); + ASSERT_EQ(-EAGAIN, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false)); // Wake up thread to unlock exclusive lock PING_WORKER(3); // (R3) @@ -494,13 +498,13 @@ TEST(LibCephFS, ConcurrentRecordLocking) { lock1.l_start = 0; lock1.l_len = 1024; lock1.l_pid = getpid(); - ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false)); + ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false)); lock1.l_type = F_UNLCK; lock1.l_whence = SEEK_SET; lock1.l_start = 0; lock1.l_len = 1024; lock1.l_pid = getpid(); - ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false)); + ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false)); // Cleanup void *retval = (void*) (uintptr_t) -1; @@ -541,7 +545,7 @@ TEST(LibCephFS, ThreesomeRecordLocking) { lock1.l_start = 0; lock1.l_len = 1024; lock1.l_pid = getpid(); - ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), true)); + ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), true)); // Start locker thread pthread_t thread[2]; @@ -562,7 +566,7 @@ TEST(LibCephFS, ThreesomeRecordLocking) { lock1.l_start = 0; lock1.l_len = 1024; lock1.l_pid = getpid(); - ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false)); + ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false)); // Shall have lock TWICE(// Synchronization point with thread (failure: thread is dead) @@ -578,13 +582,13 @@ TEST(LibCephFS, ThreesomeRecordLocking) { lock1.l_start = 0; lock1.l_len = 1024; lock1.l_pid = getpid(); - ASSERT_EQ(-EAGAIN, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false)); + ASSERT_EQ(-EAGAIN, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false)); lock1.l_type = F_RDLCK; lock1.l_whence = SEEK_SET; lock1.l_start = 0; lock1.l_len = 1024; lock1.l_pid = getpid(); - ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false)); + ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false)); // Wake up thread to unlock shared lock TWICE(PING_WORKER(1); // (R1) @@ -597,7 +601,7 @@ TEST(LibCephFS, ThreesomeRecordLocking) { lock1.l_start = 0; lock1.l_len = 1024; lock1.l_pid = getpid(); - ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), true)); + ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), true)); TWICE( // Wake up thread to lock shared lock PING_WORKER(2); // (R2) @@ -611,7 +615,7 @@ TEST(LibCephFS, ThreesomeRecordLocking) { lock1.l_start = 0; lock1.l_len = 1024; lock1.l_pid = getpid(); - ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false)); + ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false)); TWICE(WAIT_WORKER(6); // (6) // We no longer have the lock @@ -620,13 +624,13 @@ TEST(LibCephFS, ThreesomeRecordLocking) { lock1.l_start = 0; lock1.l_len = 1024; lock1.l_pid = getpid(); - ASSERT_EQ(-EAGAIN, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false)); + ASSERT_EQ(-EAGAIN, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false)); lock1.l_type = F_RDLCK; lock1.l_whence = SEEK_SET; lock1.l_start = 0; lock1.l_len = 1024; lock1.l_pid = getpid(); - ASSERT_EQ(-EAGAIN, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false)); + ASSERT_EQ(-EAGAIN, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false)); // Wake up thread to unlock exclusive lock PING_WORKER(3); // (R3) @@ -639,13 +643,13 @@ TEST(LibCephFS, ThreesomeRecordLocking) { lock1.l_start = 0; lock1.l_len = 1024; lock1.l_pid = getpid(); - ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false)); + ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false)); lock1.l_type = F_UNLCK; lock1.l_whence = SEEK_SET; lock1.l_start = 0; lock1.l_len = 1024; lock1.l_pid = getpid(); - ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false)); + ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false)); // Cleanup void *retval = (void*) (uintptr_t) -1; @@ -1049,13 +1053,13 @@ TEST(LibCephFS, DISABLED_ThreesomeInterProcessRecordLocking) { lock1.l_start = 0; lock1.l_len = 1024; lock1.l_pid = getpid(); - ASSERT_EQ(-EAGAIN, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false)); + ASSERT_EQ(-EAGAIN, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false)); lock1.l_type = F_RDLCK; lock1.l_whence = SEEK_SET; lock1.l_start = 0; lock1.l_len = 1024; lock1.l_pid = getpid(); - ASSERT_EQ(-EAGAIN, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false)); + ASSERT_EQ(-EAGAIN, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false)); // Wake up process to unlock exclusive lock PING_WORKER(4); // (R4) -- 2.39.5