From nobody Thu Sep 25 22:39:08 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 4cXpY90pgHz68l8B; Thu, 25 Sep 2025 22:39:09 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cXpY903twz3FFv; Thu, 25 Sep 2025 22:39:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1758839949; 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=FEBkBShDsq4nIh8KnuG+4BeXzJD+D7KBM92D/8rAOvk=; b=YCGazfx3/P02nQYmvMV/Bu/JQ38Mv8R9ZLdMAnhqZHRFiOylmeWWyMFW9w/e0Z/PH8lDV4 4JxAYNIQV8tgHuz+2CnKczBYWBQbCR827k3ygD/snwrpYSfMpMZQ04AlusIGf538TEtkg1 +KROFY/QDem+98cZC7l/y70+sDqIT9ACB1PcOPOZyUSsZyhucLl/8xfcxN7+HkN07PPE2f 3MhO3JKNBSmrqBXYNA3obZ7eGm/Sz9DqP5248kB5FQPxdHpXOyGzi55sZ/8x9mVsra2b2s OA8NZ0dUdetM+PE6p9JnoN/nwwj4svkeICze0WWYcIoVrh9WohbhaFQB1AKSsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1758839949; 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=FEBkBShDsq4nIh8KnuG+4BeXzJD+D7KBM92D/8rAOvk=; b=Mv7onMp1nW70erbF6bF1yJVHVPIOOGd7y3li53bsnWNjcIm3jgdg0JZEIK7ENM383YAbdK B31g26vBXZpjSQCmD7aiaqdGs/jQHhkyiOCzO/2bSOpnlMT8uM1oJhCYFyN5CWD3UbdlLT OQp7Li1hIQ3mREt9K89x/uV3zWZJdtMQ6H7l56X/XZGvzBfIby+5JS7IVWr7TuHnF3pPUB zy5Nio1dAuF4GZGgVY0WrhPwo9SxOkIaNvglNVtOy9AFBNBqJNdRa8v/rbYQqyWu+Uscuv VLiROsfGorvxzOWAMWGYJmtDnrZ5e6F6A1JX3txRxWvIOPXWqWR4PceM0xVlAg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1758839949; a=rsa-sha256; cv=none; b=b6CqOXEgkHnWqw1oIeiNvtdkAJprnPHSBRObqhOgqq7BQMU+t3AheSgW2r+9yWX+x33KLv ttPJKFnS6oV0Nfnv33tveFiMT234qTFqdmBxObQuji5YIjokkiLW7ssCkylCTgTN6yDDqY R3frKr3vFf/02qrzoF37ikrO2xWcWbWvxUKo5ql0X5lkYA/VKRNn77GtdfB7j6cp3GpDp7 6HkbBe7bp6YkiLmRSn75SCTYweaCbEoYv5lz1LSCRX6IJK8iYTXsT0h/DPCFtkDW46ivgf gH3A+dj6wTtPBWP1UnrphTnrj26M1oNJtR5fbAypD9wdVRumzBH/0CkW1BBauw== 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 4cXpY86mDGz5R3; Thu, 25 Sep 2025 22:39:08 +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 58PMd8k0014621; Thu, 25 Sep 2025 22:39:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 58PMd8jX014618; Thu, 25 Sep 2025 22:39:08 GMT (envelope-from git) Date: Thu, 25 Sep 2025 22:39:08 GMT Message-Id: <202509252239.58PMd8jX014618@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: 3289d3831718 - stable/15 - fusefs: fix the last_local_modify LLM/LastLocalModify.lookup/3 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: 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/15 X-Git-Reftype: branch X-Git-Commit: 3289d383171825622c907df79a0824c8c2175d1c Auto-Submitted: auto-generated The branch stable/15 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=3289d383171825622c907df79a0824c8c2175d1c commit 3289d383171825622c907df79a0824c8c2175d1c Author: Alan Somers AuthorDate: 2025-09-15 00:22:36 +0000 Commit: Alan Somers CommitDate: 2025-09-25 22:35:46 +0000 fusefs: fix the last_local_modify LLM/LastLocalModify.lookup/3 test The LastLocalModify tests were originally written to simulate a race condition between VOP_SETATTR and VOP_LOOKUP. They were later extended to cover some other VOPs that can affect file size, including VOP_WRITE. However, the test never correctly simulated the race with VOP_WRITE. So that test only ever passed by accident. Fix it by always opening the file with O_DIRECT. PR: 289237 Reported by: Siva Mahadevan (cherry picked from commit d1eaa52d10f9b85e5f6358e1a280899b9d55dd07) --- tests/sys/fs/fusefs/last_local_modify.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/sys/fs/fusefs/last_local_modify.cc b/tests/sys/fs/fusefs/last_local_modify.cc index 5fcd3c36c892..6b8c19f1efc7 100644 --- a/tests/sys/fs/fusefs/last_local_modify.cc +++ b/tests/sys/fs/fusefs/last_local_modify.cc @@ -174,7 +174,15 @@ static void* write_th(void* arg) { if (sem) sem_wait(sem); - fd = open("mountpoint/some_file.txt", O_RDWR); + /* + * Open the file in direct mode. + * The race condition affects both direct and non-direct writes, and + * they have separate code paths. However, in the non-direct case, the + * kernel updates last_local_modify _before_ sending FUSE_WRITE to the + * server. So the technique that this test program uses to invoke the + * race cannot work. Therefore, test with O_DIRECT only. + */ + fd = open("mountpoint/some_file.txt", O_RDWR | O_DIRECT); if (fd < 0) return (void*)(intptr_t)errno; @@ -332,7 +340,7 @@ TEST_P(LastLocalModify, lookup) /* Wait for FUSE_SETATTR to be sent */ sem_wait(&sem); - /* Lookup again, which will race with setattr */ + /* Lookup again, which will race with the mutator */ ASSERT_EQ(0, stat(FULLPATH, &sb)) << strerror(errno); ASSERT_EQ((off_t)newsize, sb.st_size);