From nobody Thu Jan 18 16:48:27 2024 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 4TG7wr0ycdz56SdV; Thu, 18 Jan 2024 16:48: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 4TG7wq6tvVz40S4; Thu, 18 Jan 2024 16:48:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705596508; 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=Hm5i9WTZG+KZCKTr/w4uoj9iXOONktQsAIVFihavZxQ=; b=a+/pON+25KStiGoOZqr/C7DeIlrgwjfyDxeEUwJ78q+y9Ixi+O++5FQgItZA3MOFhfvhhh dl1OzQ8KOGCklT4vQCQ7IkBOuqzuM0hjom3TYYdUIBUPoBOK1a/hIq2m2c4BOiPOqusC6m ZBjDyvhFVJT/uDO7GsdxM+1cPX2vc1Vu1VOibK0ezMk7hCFvUtqS1c3uk3SytT4v49SWrK 5EJAw1Oj3th2dx6G5d3q7oGuT1aDzH4clFQSIxo9XhTWjbtwnXdn9gHuws7dYZt1LKGYd7 u3w2SV4jiNkYZOD90jVYqvlaJodMMz/jagHp7034Gecr1KaB6y5WmqoZLACLiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705596508; 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=Hm5i9WTZG+KZCKTr/w4uoj9iXOONktQsAIVFihavZxQ=; b=tJJwkbMaiJyI0177vRvQQ4RX2mEUhiztem0fKgtj8GiPR0KuiYCdEPwdYIfmDyOLqyJZOP vLucVv7uVja6nX2crjZwhFyxC8h1MNtUIek8azKK4KWTTSBgPsO/XXxDwwQk4T6YViejuC 6r/j1DcpFM96ySluuLGVVNT6rRh6J+GaFEsCOFI+LbmX9j5BTZLwzGpVRE1q7encIRhjdu 4ulVnSReUZE1k9gnmk9xdgJ3iFgLfyc1F3cV2rRZq7ujGVoFZf/z+n38fEzjqoW4OwNkv1 WCDuGcAD+9UAxUftYr/RPnQAcua5fqlyaSpHsHiA3yyBs6ntEnfl/61TUGwkWg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1705596508; a=rsa-sha256; cv=none; b=pusSkGe9/ZOcngErrYiK+iOy6p4fq7zMcH4VWZoM+seRiS6eV48MOgAfllWDLjBQieqsU5 QHBDx7Grl1oF7G8k80oPAco/htxqlD77htN6jRVoT7a3rS9Hz1NTwQ6lnC3T9woDX6Ub5r P6RD6SGjoPAd0Lfa8iM/AFWVotRyhNlGB68H/X7HsAVWToIr3GO6x7XDH8K7ad1cpcsFmW AUMOmYUftQ+E14bsN1S1DqzqThjj+/AJMmctz/qiIoowY2zE/9m5vbR9LPLP7URn0vEOSo c7iX45u0dA2VQg9v7B6vqYQq8DO7qY31e0aTT/YAPC4+SLGhWOkd9Apc6EFJEw== 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 4TG7wq60TJzFjb; Thu, 18 Jan 2024 16:48:27 +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 40IGmRcF013181; Thu, 18 Jan 2024 16:48:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40IGmR3L013178; Thu, 18 Jan 2024 16:48:27 GMT (envelope-from git) Date: Thu, 18 Jan 2024 16:48:27 GMT Message-Id: <202401181648.40IGmR3L013178@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 13ccb04589e2 - main - msdosfs_integrity_error(): plug possible busy leak 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 13ccb04589e2c5c840e19b407a59e44cb70ac28e Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=13ccb04589e2c5c840e19b407a59e44cb70ac28e commit 13ccb04589e2c5c840e19b407a59e44cb70ac28e Author: Konstantin Belousov AuthorDate: 2024-01-18 15:35:56 +0000 Commit: Konstantin Belousov CommitDate: 2024-01-18 16:48:05 +0000 msdosfs_integrity_error(): plug possible busy leak If taskqueue_enqueue() returned error, unbusy(). Handle parallel calls to msdosfs_integrity_error() by unbusying in msdosfs_remount_ro() up to pending times. Noted and reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D43482 --- sys/fs/msdosfs/msdosfs_vfsops.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c index df96bcbfe9c6..03c794bad900 100644 --- a/sys/fs/msdosfs/msdosfs_vfsops.c +++ b/sys/fs/msdosfs/msdosfs_vfsops.c @@ -1006,7 +1006,9 @@ msdosfs_remount_ro(void *arg, int pending) } MSDOSFS_UNLOCK_MP(pmp); - vfs_unbusy(pmp->pm_mountp); + do { + vfs_unbusy(pmp->pm_mountp); + } while (--pending >= 0); } void @@ -1015,11 +1017,19 @@ msdosfs_integrity_error(struct msdosfsmount *pmp) int error; error = vfs_busy(pmp->pm_mountp, MBF_NOWAIT); - if (error == 0) - taskqueue_enqueue(taskqueue_thread, &pmp->pm_rw2ro_task); - else + if (error == 0) { + error = taskqueue_enqueue(taskqueue_thread, + &pmp->pm_rw2ro_task); + if (error != 0) { + printf("%s: integrity error scheduling failed, " + "error %d\n", + pmp->pm_mountp->mnt_stat.f_mntfromname, error); + vfs_unbusy(pmp->pm_mountp); + } + } else { printf("%s: integrity error busying failed, error %d\n", pmp->pm_mountp->mnt_stat.f_mntfromname, error); + } } static int