From nobody Mon Sep 15 00:31:24 2025 X-Original-To: dev-commits-src-main@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 4cQ5Ym2rv7z67kVF; Mon, 15 Sep 2025 00:31:24 +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 4cQ5Ym2LRVz3clf; Mon, 15 Sep 2025 00:31:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757896284; 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=NLi0BLfnbn1bGBDIJe/6RxHe3qDbn6IwBJnspWbpYZU=; b=xfzDZvBryayRoRI+1Cu0aJN+YNo9ZsVExRxuKwyWEQ84q2/1MJ2zZZSPHmDRjpoA596SDV /rW8L/0titg2AMXobRNk1+bTuwH0AHs/N+Ozsh5qrpJ3SxXp6b4VBku3azSbHghk0Fat/x prUnCHij8y013zWkTLTjIEoLwlTxbvkPShSiXVbf83Kv972Y+UzxO4ITqLLydNlRLaLr6u VBCTl++riZS/9xKRxxKFgZMztVgIXutrAYgSWPolxJwLNm579NzA+Io+xtH/MPBgCB8xcE ICpgvLq4pkoctSmGPjqnNp5tmwJD4Dw7Ect1LLc+fATyjjUt0HmiJ1JLzXq/dA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757896284; 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=NLi0BLfnbn1bGBDIJe/6RxHe3qDbn6IwBJnspWbpYZU=; b=Fi0TjYoDOQ8vmIzitrRNL250U7hKl9yad9LqY1Ce1hiu3zP9LOJs6F2lnipb+CFQ+IfXgr il/8enxPX+Vysxv6IlZtpIUwpjBrl6GMYH8DOvSLoVjjJyoypR+gbyj5uS6VEOLSvTO9gq oHNrO0xRYEJRNkwGq8ChbpVn3yBNRwfsiLJ51np3y6JhOZmj4BhMhI5AcclboUCzUCTJsu wOodz2J0mAP6fjm6+8lumIWGQ7CDq7gwn6Tg0mVKKuUarQ2adnXSp3v5ABJ7UpgbM5SyXH o0qSldyXu6yCGA69Cwj3JgwFf1PAnwyb7zQcMlt5R5/Qes5h4lQBvH9sLEVTMw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1757896284; a=rsa-sha256; cv=none; b=tNxxczmLIG6zfjM264pFlbiqtSduM0Exim3pxn+0Q2jfVK3Gv23i22s7smtTSjgkoyFNEq eTDCQm1YprBv3V3f5z/NPCSv5kU/V/bTmjozOJwETiHOi0m37tygo9nBy34EX/5NjSXzP7 7wfkUsa0J2dUOE8+9fOSKD2cDmqrR9Yc8g6cd+98hNwjahPtdjlYlo9MAWw+ONQQ1ACt5j 8j24Q7kGOn3KnO2TZ17cTrYKz4usDN+xHcKifftVyVmNleE/XCcfkg5myPUIJVNLZbx/5/ OAHfDG+bhkq36Ddx/tX+UQbaLKNluJ42qhEkheAJDW/p/SC1eoPALqkCcGNgCw== 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 4cQ5Ym1xxnzX2K; Mon, 15 Sep 2025 00:31:24 +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 58F0VOLV049063; Mon, 15 Sep 2025 00:31:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 58F0VOhb049060; Mon, 15 Sep 2025 00:31:24 GMT (envelope-from git) Date: Mon, 15 Sep 2025 00:31:24 GMT Message-Id: <202509150031.58F0VOhb049060@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: d1eaa52d10f9 - main - fusefs: fix the last_local_modify LLM/LastLocalModify.lookup/3 test List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: d1eaa52d10f9b85e5f6358e1a280899b9d55dd07 Auto-Submitted: auto-generated The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=d1eaa52d10f9b85e5f6358e1a280899b9d55dd07 commit d1eaa52d10f9b85e5f6358e1a280899b9d55dd07 Author: Alan Somers AuthorDate: 2025-09-15 00:22:36 +0000 Commit: Alan Somers CommitDate: 2025-09-15 00:30:30 +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 MFC after: 1 week --- 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);