From nobody Sat Oct 21 15:42:27 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SCQgm1mnFz4y91h; Sat, 21 Oct 2023 15:42:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SCQgm1K4lz4Ryp; Sat, 21 Oct 2023 15:42:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697902948; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Vap1AD1zWF4i4A6wc6UbW8TO/YabGwQqHIs9aZB7zvc=; b=SP6rnP6C3j1+tu34Jq65Z9Uyik1Y6BgK9ZmydFOGG8T426/oeAidFi2ijwvasOjG38Hrca +ZR7SMnk7gjyZBvrDHlYlEyGjCR9YswS0sERyBMebTVfaYknXGsBvKaOT3s6RJXH6FZAJm 0YGn8EIg8uZxqEodoVCt6NNtf3yBf06qNOW1CAWy5ubnKh78dyHjISF+a1+LQhlpgsFfF5 0nUjzNmauf8reMH8icD3WtBcCNb0xltwDWUszxc51hZVK8QhozDFD6fjrESZgFa3QhDWQw 3bumkPwvnBlhLfNKWj8mb0alIjpn7ZAc5D0xx1CQGBfqDCjAi8G821ltdFNimA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697902948; a=rsa-sha256; cv=none; b=As/lzpT9P97JdsbkRjrbxaWAiJZFEkDu6jS+wzY5v8EBp+oByZY4j9r9c9lHTY2ZJVITyw 6QUmEX0w/ymvcCsrjMY9y4DnBXSgsnrsp0iELGOHa0ociTBKqLT+5HAy6TaF5nahaRzeor OBnyI/T2UYoXg+zwImaNDIA6LeeyZikDEt04F+lkuPAAZ1cR6dR00tJpGwpto7gEMol2pW xUJvnoVwz0DctugALmX4ASE2Kd2IZth2nZ+t/W8atLw/ziSMJg4D0DBEfELOlsTq6sFoLZ xLDmkHqqAoUNxfO6AR7BRDMhXqrxIorkOHA08ekO3gmA8iCMdkNfQlcmk7HtDg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697902948; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Vap1AD1zWF4i4A6wc6UbW8TO/YabGwQqHIs9aZB7zvc=; b=MtjChD6QN8hWRFF5ptrxu2UtPc/PhKv3Pmqk14of/PUdqyqRjqcSPAvWGnEy3b5sHiTFau loFyoMSlZ34+LUFa33MRe6UAiHiPJb4iJqNGdjMkX7zFyw9+0CpDgNxzu4jPuWIY6+o3mU Vh58AVs1LOUNu4ZvMRFiJgj3RJTZrcv3XIvTkdQZ5ifOs6Qdm4+ABA6S2uffp6ndJsMrvR itpXT2WmVA/bYN5GNnjkXBPKK5pBOVcDmPDSoOxLRh9G4jTtTsu7Q75RGF8+cAte8Rn8Yp jTDg3eCVRngsK2VmQDh1MxOdGkV5EWvbqI1IjoWDtmmid/+og96pNbwAiywabg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SCQgm0MvTz6ZP; Sat, 21 Oct 2023 15:42:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 39LFgRJg004727; Sat, 21 Oct 2023 15:42:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39LFgR3U004724; Sat, 21 Oct 2023 15:42:27 GMT (envelope-from git) Date: Sat, 21 Oct 2023 15:42:27 GMT Message-Id: <202310211542.39LFgR3U004724@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: af20b2201669 - stable/14 - Fix intermittency in the sys.fs.fusefs.mknod.main test List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: af20b2201669ea493de58ba7a5e5ff1138b80cd7 Auto-Submitted: auto-generated The branch stable/14 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=af20b2201669ea493de58ba7a5e5ff1138b80cd7 commit af20b2201669ea493de58ba7a5e5ff1138b80cd7 Author: Alan Somers AuthorDate: 2023-10-06 19:46:42 +0000 Commit: Alan Somers CommitDate: 2023-10-21 15:14:32 +0000 Fix intermittency in the sys.fs.fusefs.mknod.main test In the Mknod.parent_inode test case, the kernel sends an extra FUSE_FORGET message. But because it gets sent asynchronously with the failing syscall, it doesn't always get received before the test ends. So we never setup an expectation for it. And 90+% of the time the test would exit successfully. Fix the intermittency by always waiting to receive the FUSE_FORGET message. Sponsored by: Axcient (cherry picked from commit 86885b18689889e9b9142fd31d8c67f21334ba32) Fix intermittency in the sys.fs.fusefs.symlink.main test This change is identical to 86885b18689 but for symlink instead of mknod. The kernel sends a FUSE_FORGET asynchronously with the final syscall. The lack of an expectation caused this test to occasionally fail. Also, remove a sleep that accidentally snuck into a different test. Sponsored by: Axcient (cherry picked from commit 8399d764c929a4b2fa98dbfae0ca7359810e4668) --- tests/sys/fs/fusefs/mkdir.cc | 1 - tests/sys/fs/fusefs/mknod.cc | 7 +++++++ tests/sys/fs/fusefs/symlink.cc | 8 ++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/sys/fs/fusefs/mkdir.cc b/tests/sys/fs/fusefs/mkdir.cc index 48453ff8bb8a..f020feb94ed8 100644 --- a/tests/sys/fs/fusefs/mkdir.cc +++ b/tests/sys/fs/fusefs/mkdir.cc @@ -241,7 +241,6 @@ TEST_F(Mkdir, parent_inode) ASSERT_EQ(-1, mkdir(FULLPATH, mode)); ASSERT_EQ(EIO, errno); - usleep(100000); } TEST_F(Mkdir_7_8, ok) diff --git a/tests/sys/fs/fusefs/mknod.cc b/tests/sys/fs/fusefs/mknod.cc index 223d38f8acb1..1fb855f44f29 100644 --- a/tests/sys/fs/fusefs/mknod.cc +++ b/tests/sys/fs/fusefs/mknod.cc @@ -32,6 +32,7 @@ extern "C" { #include #include #include +#include } #include "mockfs.hh" @@ -255,14 +256,18 @@ TEST_F(Mknod, parent_inode) const char RELPATH[] = "some_node"; mode_t mode = S_IFSOCK | 0755; struct sockaddr_un sa; + sem_t sem; int fd; dev_t rdev = -1; /* Really it's a don't care */ uint64_t ino = 42; + ASSERT_EQ(0, sem_init(&sem, 0, 0)) << strerror(errno); + expect_lookup(PPATH, ino, S_IFDIR | 0755, 0, 1); EXPECT_LOOKUP(ino, RELPATH) .WillOnce(Invoke(ReturnErrno(ENOENT))); expect_mknod(ino, RELPATH, ino, mode, rdev); + expect_forget(ino, 1, &sem); fd = socket(AF_UNIX, SOCK_STREAM, 0); ASSERT_LE(0, fd) << strerror(errno); @@ -273,6 +278,8 @@ TEST_F(Mknod, parent_inode) ASSERT_EQ(EIO, errno); leak(fd); + sem_wait(&sem); + sem_destroy(&sem); } /* diff --git a/tests/sys/fs/fusefs/symlink.cc b/tests/sys/fs/fusefs/symlink.cc index 19286a446fc3..bd355497a8bd 100644 --- a/tests/sys/fs/fusefs/symlink.cc +++ b/tests/sys/fs/fusefs/symlink.cc @@ -29,6 +29,7 @@ */ extern "C" { +#include #include } @@ -174,15 +175,22 @@ TEST_F(Symlink, parent_ino) const char PPATH[] = "parent"; const char RELPATH[] = "src"; const char dst[] = "dst"; + sem_t sem; const uint64_t ino = 42; + ASSERT_EQ(0, sem_init(&sem, 0, 0)) << strerror(errno); + expect_lookup(PPATH, ino, S_IFDIR | 0755, 0, 1); EXPECT_LOOKUP(ino, RELPATH) .WillOnce(Invoke(ReturnErrno(ENOENT))); expect_symlink(ino, dst, RELPATH); + expect_forget(ino, 1, &sem); EXPECT_EQ(-1, symlink(dst, FULLPATH)); EXPECT_EQ(EIO, errno); + + sem_wait(&sem); + sem_destroy(&sem); } TEST_F(Symlink_7_8, ok)