From nobody Thu Oct 07 19:41:48 2021 X-Original-To: dev-commits-src-branches@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 2AD4817E619B; Thu, 7 Oct 2021 19:41:49 +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 4HQMCK0Yr0z4mYX; Thu, 7 Oct 2021 19:41:49 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E8CBA19A51; Thu, 7 Oct 2021 19:41:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 197Jfmfl067060; Thu, 7 Oct 2021 19:41:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 197JfmOk067059; Thu, 7 Oct 2021 19:41:48 GMT (envelope-from git) Date: Thu, 7 Oct 2021 19:41:48 GMT Message-Id: <202110071941.197JfmOk067059@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: 7dcb5db451b6 - stable/12 - vinvalbuf: do not panic if we were unable to flush dirty buffers List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/12 X-Git-Reftype: branch X-Git-Commit: 7dcb5db451b66aa277bd59c61c18a5053c658915 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=7dcb5db451b66aa277bd59c61c18a5053c658915 commit 7dcb5db451b66aa277bd59c61c18a5053c658915 Author: Konstantin Belousov AuthorDate: 2021-05-30 16:52:42 +0000 Commit: Alan Somers CommitDate: 2021-10-07 19:34:19 +0000 vinvalbuf: do not panic if we were unable to flush dirty buffers Return EBUSY instead and let caller to handle the issue. For vgone()/vnode reclamation, caller first does vinvalbuf(V_SAVE), which return EBUSY in case dirty buffers where not flushed. Then caller calls vinvalbuf(0) due to non-zero return, which gets rid of all dirty buffers without dependencies. PR: 238565 Reviewed by: asomers, mckusick Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D30555 (cherry picked from commit 27006229f7a40a18a61a0e8fd270bc583326b690) fusefs: reenable the WriteCluster.cluster_write_err test The underlying panic was just fixed by revision 27006229f7a40a18a61a0e8fd270bc583326b690 PR: 238565 (cherry picked from commit 425bbe9e64f7af6bdb30a099bd90a32885de1ab8) --- sys/kern/vfs_subr.c | 10 ++++------ tests/sys/fs/fusefs/write.cc | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 15ea8a1275c9..5f0c467c87e6 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1742,13 +1742,11 @@ bufobj_invalbuf(struct bufobj *bo, int flags, int slpflag, int slptimeo) BO_UNLOCK(bo); if ((error = BO_SYNC(bo, MNT_WAIT)) != 0) return (error); - /* - * XXX We could save a lock/unlock if this was only - * enabled under INVARIANTS - */ BO_LOCK(bo); - if (bo->bo_numoutput > 0 || bo->bo_dirty.bv_cnt > 0) - panic("vinvalbuf: dirty bufs"); + if (bo->bo_numoutput > 0 || bo->bo_dirty.bv_cnt > 0) { + BO_UNLOCK(bo); + return (EBUSY); + } } } /* diff --git a/tests/sys/fs/fusefs/write.cc b/tests/sys/fs/fusefs/write.cc index e9bf17c5c4d6..e3fbbf072911 100644 --- a/tests/sys/fs/fusefs/write.cc +++ b/tests/sys/fs/fusefs/write.cc @@ -793,10 +793,10 @@ TEST_F(WriteCluster, clustering) * not panic the system on unmount */ /* - * Disabled because it panics. + * Regression test for bug 238585 * https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=238565 */ -TEST_F(WriteCluster, DISABLED_cluster_write_err) +TEST_F(WriteCluster, cluster_write_err) { const char FULLPATH[] = "mountpoint/some_file.txt"; const char RELPATH[] = "some_file.txt";