From: Jeff Layton Date: Thu, 8 Dec 2016 19:24:04 +0000 (-0500) Subject: test: add missing ceph_ll_close calls X-Git-Tag: v11.1.1~22^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=18e3f9c17bfca68abaa5a5a2cdfaab702e75d78a;p=ceph.git test: add missing ceph_ll_close calls There's a noticable up to tick-length hang that occurs when you call ceph_shutdown with open files still in play. Ensure that we always call ceph_ll_close after a successful ceph_ll_create. Signed-off-by: Jeff Layton --- diff --git a/src/test/libcephfs/recordlock.cc b/src/test/libcephfs/recordlock.cc index 7f852ef3f469..5a18c5126d00 100644 --- a/src/test/libcephfs/recordlock.cc +++ b/src/test/libcephfs/recordlock.cc @@ -355,6 +355,8 @@ static void thread_ConcurrentRecordLocking(str_ConcurrentRecordLocking& s) { lock1.l_pid = getpid(); ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false)); PING_MAIN(7); // (7) + + ASSERT_EQ(0, ceph_ll_close(cmount, fh)); } // Used by ConcurrentRecordLocking test @@ -746,6 +748,7 @@ static void process_ConcurrentRecordLocking(str_ConcurrentRecordLocking& s) { ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, mypid, false)); PING_MAIN(7); // (7) + ASSERT_EQ(0, ceph_ll_close(cmount, fh)); CLEANUP_CEPH(); s.sem_destroy(); diff --git a/src/test/libcephfs/test.cc b/src/test/libcephfs/test.cc index 5f43f4ce2e82..0d6c87c44648 100644 --- a/src/test/libcephfs/test.cc +++ b/src/test/libcephfs/test.cc @@ -1402,6 +1402,7 @@ TEST(LibCephFS, Nlink) { ASSERT_EQ(ceph_ll_mkdir(cmount, root, dirname, 0755, &dir, &stx, 0, 0, perms), 0); ASSERT_EQ(ceph_ll_create(cmount, dir, filename, 0666, O_RDWR|O_CREAT|O_EXCL, &file, &fh, &stx, CEPH_STATX_NLINK, 0, perms), 0); + ASSERT_EQ(ceph_ll_close(cmount, fh), 0); ASSERT_EQ(stx.stx_nlink, (nlink_t)1); ASSERT_EQ(ceph_ll_link(cmount, file, dir, linkname, perms), 0); @@ -1573,6 +1574,7 @@ TEST(LibCephFS, LazyStatx) { ceph_ll_unlink(cmount1, root1, filename, perms1); ASSERT_EQ(ceph_ll_create(cmount1, root1, filename, 0666, O_RDWR|O_CREAT|O_EXCL, &file1, &fh, &stx, 0, 0, perms1), 0); + ASSERT_EQ(ceph_ll_close(cmount1, fh), 0); ASSERT_EQ(ceph_ll_lookup_root(cmount2, &root2), 0); @@ -1737,5 +1739,6 @@ TEST(LibCephFS, ClearSetuid) { ASSERT_TRUE(stx.stx_mask & CEPH_STATX_MODE); ASSERT_FALSE(stx.stx_mode & (S_ISUID|S_ISGID)); + ASSERT_EQ(ceph_ll_close(cmount, fh), 0); ceph_shutdown(cmount); }