From nobody Mon Jan 20 16:52:17 2025 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 4YcGbP72snz5kMDR; Mon, 20 Jan 2025 16:52:17 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YcGbP6Wcfz3Wwd; Mon, 20 Jan 2025 16:52:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737391937; 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=BnIE1+0seA3GBNylb6o/77poARRCiN4NwjGaZbdQ7oU=; b=AGaDbJhYJQZQoBZ3QA4zTqpzuaQdRKhQDdONUhTkpxtPhk/sAx9uQjqCYSrESiJxH/+LoX mjXZgX5MXcJsvcGBsyshxIcvJ8tE4kO7JxVjQiCOMvhbSjmL1qBCSEW1PXydKvU90Dga2f g00SkAqLqAyA9MJG1cjWiTZgs1NaQ/Em1RlCSw+ma1zMahvuWN0uPJYbetqAveoT54zvb8 jaSn28pgyaubzIIAyybRB+Zv8pcZzWGmU5VkEAg61vHNkCdARQrA1bXHgCnWn1c4kgFIGt 8d1UuK38LhlC2s4J6xHYLQl51rWaIQDZbyd/rnzgHUCMeQQRvVVJwuL48Bp1Mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737391937; 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=BnIE1+0seA3GBNylb6o/77poARRCiN4NwjGaZbdQ7oU=; b=ttKf+4EKCRfdCK5Lq3YBiv6JK11roRuN8dZ2da0lUmFBzlWIRULF9jQu65nBFis0yI8BDF 3HnJXmdmeVTItn0zRj5gCLSbMWb/Em8IHmx+M0/a8DBK9DRQ5kHWYQQv0taJtVOLgTjHC4 JVD8l+Vf1co5c7FLV5NsYeMvEta52Q5kWAXoxlpYUObSPPxz2S92QmiWvALdztRXLzhwN0 i9s0Qsgm99RuzqlpMDg2zQgIV+rgPCiZDfLKOY4KLE6zrXSdNdgNUC3sU2Xtkw2QZqWJQn /oITwKlHuZvfm/OVaR/ZxaVG0D5HX2uS8lCMmN/0WtYmI62WiopqH/7q/mgvSw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737391937; a=rsa-sha256; cv=none; b=QI4Hkxk2YApUt2/XaGKLGnhJEp41NcQwtffdPngco+na01GFMmpRXlxm4oG50EA1EJ/GqX kQK2DHd2tW+yAhqQxHU94LPjSXEDzZhDY+ijSTJ6qkZ5A/l7dLX4/69nKldV4N0sl6itlJ gUFtCQJW3cF7otdWt9s9lHBwikDTQ7nzU9VgoQGmyPSat4abcL+SvIQGeJkeKowvh80j3+ 3hKrVsr8D9kT5eyLgy4yrMV/gbaEIh59VWaxYGJefrUGIDsRTs43MRzxnoxjHFJUReYmja gkMS+FwOMII4ip6FE+ffAZhfjBMrUxgmaajT3kaTEuMTLDgfP+3OY9Tt4XeWhw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YcGbP64BRzCmC; Mon, 20 Jan 2025 16:52:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50KGqHc5065176; Mon, 20 Jan 2025 16:52:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50KGqHOj065158; Mon, 20 Jan 2025 16:52:17 GMT (envelope-from git) Date: Mon, 20 Jan 2025 16:52:17 GMT Message-Id: <202501201652.50KGqHOj065158@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: b0348117953a - stable/14 - fusefs: More accurately test the unique tokens in the test suite 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-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: b0348117953a117244056032e468dd6a742dc678 Auto-Submitted: auto-generated The branch stable/14 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=b0348117953a117244056032e468dd6a742dc678 commit b0348117953a117244056032e468dd6a742dc678 Author: Alan Somers AuthorDate: 2024-12-18 01:38:05 +0000 Commit: Alan Somers CommitDate: 2025-01-20 16:51:31 +0000 fusefs: More accurately test the unique tokens in the test suite Every fuse ticket has a "unique" token. As the name implies, they're supposed to be unique. Previously the fusefs test suite verified their uniqueness by relying on the fact that they are also sequential. But they aren't guaranteed to be sequential. Enhance the tests by removing that convenient assumption. Sponsored by: Axcient (cherry picked from commit b1879975794772ee51f0b4865753364c7d7626c3) --- tests/sys/fs/fusefs/mockfs.cc | 15 ++++++--------- tests/sys/fs/fusefs/mockfs.hh | 6 ++++-- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/tests/sys/fs/fusefs/mockfs.cc b/tests/sys/fs/fusefs/mockfs.cc index bd7bd1b663f9..023cecd0276f 100644 --- a/tests/sys/fs/fusefs/mockfs.cc +++ b/tests/sys/fs/fusefs/mockfs.cc @@ -421,6 +421,7 @@ MockFS::MockFS(int max_readahead, bool allow_other, bool default_permissions, uint32_t kernel_minor_version, uint32_t max_write, bool async, bool noclusterr, unsigned time_gran, bool nointr, bool noatime, const char *fsname, const char *subtype) + : m_uniques(new std::unordered_set) { struct sigaction sa; struct iovec *iov = NULL; @@ -436,7 +437,7 @@ MockFS::MockFS(int max_readahead, bool allow_other, bool default_permissions, m_pm = pm; m_time_gran = time_gran; m_quit = false; - m_last_unique = 0; + if (m_pm == KQ) m_kq = kqueue(); else @@ -738,14 +739,10 @@ void MockFS::audit_request(const mockfs_buf_in &in, ssize_t buflen) { default: FAIL() << "Unknown opcode " << in.header.opcode; } - /* - * Check that the ticket's unique value is sequential. Technically it - * doesn't need to be sequential, merely unique. But the current - * fusefs driver _does_ make it sequential, and that's easy to check - * for. - */ - if (in.header.unique != ++m_last_unique) - FAIL() << "Non-sequential unique value"; + /* Verify that the ticket's unique value is actually unique. */ + if (m_uniques->find(in.header.unique) != m_uniques->end()) + FAIL() << "Non-unique \"unique\" value"; + m_uniques->insert(in.header.unique); } void MockFS::init(uint32_t flags) { diff --git a/tests/sys/fs/fusefs/mockfs.hh b/tests/sys/fs/fusefs/mockfs.hh index 958964f769d4..38efcd049a61 100644 --- a/tests/sys/fs/fusefs/mockfs.hh +++ b/tests/sys/fs/fusefs/mockfs.hh @@ -36,6 +36,8 @@ extern "C" { #include "fuse_kernel.h" } +#include + #include #define TIME_T_MAX (std::numeric_limits::max()) @@ -298,8 +300,8 @@ class MockFS { /* pid of the test process */ pid_t m_pid; - /* The unique value of the header of the last received operation */ - uint64_t m_last_unique; + /* Every "unique" value of a fuse ticket seen so far */ + std::unique_ptr> m_uniques; /* Method the daemon should use for I/O to and from /dev/fuse */ enum poll_method m_pm;