From nobody Sun Apr 24 20:02:28 2022 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 BAEE71990096; Sun, 24 Apr 2022 20:02: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 4KmfFJ32Mbz4pSK; Sun, 24 Apr 2022 20:02:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1650830548; 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=LKo+DJU/U/79dKzZUuqzNnxaHSwHZu0/vwKJvksQ43Y=; b=rH1CFXypocQMw0t7Uz37TaJWW4Roj5FufhqvHT327zuJDXLVemaTXPA9yNEYrjUX/LDFBp GFGUY9iDE75VeYi1yCS5V9n21xfFurjAi9Rx8J3saofPXdXB5rvtLOVvDzyTG1uuLp0ZPC 1HE7ADO0x/GNflEszeoHbidoxoWvBbBBGdplU8vmakm0MxGB2sRDPS2ZarQl1NntWQYXCF 5sikVv12dh4IIPDM2pV1gCd7Gw9QYK9c/9SSogkencGmuYUueVsG8cNBGLm0eZHlpVicvi fzj4ucwhaUuWGIt/4FliJuEEyphWmjRqhOfn60iuw/oDQjUWLLHe/tDNWsig8A== 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 2BF974DBE; Sun, 24 Apr 2022 20:02:28 +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 23OK2SnJ049698; Sun, 24 Apr 2022 20:02:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 23OK2SV6049697; Sun, 24 Apr 2022 20:02:28 GMT (envelope-from git) Date: Sun, 24 Apr 2022 20:02:28 GMT Message-Id: <202204242002.23OK2SV6049697@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 347a8e93fe68 - main - g_vfs_done: Only report ENXIO once 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: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 347a8e93fe687d55f65a4b58a394a5632deca7ba Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1650830548; 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=LKo+DJU/U/79dKzZUuqzNnxaHSwHZu0/vwKJvksQ43Y=; b=GWODXBd4P4Rwi998R3rb7rbmjPNKelhaX0c32aa65e1oAm2ewJKyaOZWlN6pQXYiqHWFNX LyWnq2rRsi+MPgdG3xLqoGlVSktIYotjqiX4F0DF05LBA7UqAXU7jgWWGl1We9fgetvIJs 8PD2tyELxUyAI2wiIGLeOxB/lXUl4Y14OYTge3SqFwpcn7rpKzXoVkG4zVuf2Vjvg6WMhi Ue3TCgHS9iTNWNElKhb+Lty9jBkW2arJfFT4q90/7aOU0g5Gcf6OnzKtPCR310dyQ83hnn p5IWVak7jMdF1MsKoxiyOcBTl0Eyt2UxNfljLUry0WygvTX8fPn4yKjBYnBwQA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1650830548; a=rsa-sha256; cv=none; b=w0VPrQT1dSRJ/AHuAXIysLhxJKuwWeeDO7Y7lifH8V7+kKlEbgpf+Ciym2+ohiaVep2z/P DDHBgp9TsPMoML8ha/VxR8g2peeZj4rYuY8xqo7KSQs7dFryQaGaDGY6ZMkVDt5HHlv7ie nss5TX4khZAYcDkBJK4fWJQkhjJTnW1URtzpHQG0PU70U87Io17qZc3vLKDCVAanYuGlkd QU5ZG101iBsFqfWUci5CzXgn6Cg6OAX8DqXqz1am41y9+2Xd8ona75b7cbkFz45LKsaB9z kjVI82FcTCc/e5JDCvmDCb3Bj5kam18zVa7czdtz7ryNpSdfkd+acm5MLZDY4Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=347a8e93fe687d55f65a4b58a394a5632deca7ba commit 347a8e93fe687d55f65a4b58a394a5632deca7ba Author: Warner Losh AuthorDate: 2022-04-24 19:54:29 +0000 Commit: Warner Losh CommitDate: 2022-04-24 20:01:33 +0000 g_vfs_done: Only report ENXIO once The contract with the lower layers is that once ENXIO is reported, all further I/O to the device is not possible. This is reported when the device departs for good or changes in some material manner out from underneath the system. Since the lower layers terminate all pending I/O when this is detected with ENXIO, reporting more than one provides no extra value. ENXIO suppression done with atomics due to race described in e8827f4094cb. It's on the error path and a rare event, so this won't affect performance. Sponsored by: Netflix Reviewed by: mckusick, kib Differential Revision: https://reviews.freebsd.org/D35034 --- sys/geom/geom_vfs.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/geom/geom_vfs.c b/sys/geom/geom_vfs.c index b6f5916c386a..04d5fe883a8f 100644 --- a/sys/geom/geom_vfs.c +++ b/sys/geom/geom_vfs.c @@ -57,6 +57,7 @@ struct g_vfs_softc { int sc_active; bool sc_orphaned; int sc_enxio_active; + int sc_enxio_reported; }; static struct buf_ops __g_vfs_bufops = { @@ -150,8 +151,13 @@ g_vfs_done(struct bio *bip) } if (sc->sc_enxio_active) bip->bio_error = ENXIO; - g_print_bio("g_vfs_done():", bip, "error = %d", - bip->bio_error); + if (bip->bio_error != ENXIO || + atomic_cmpset_int(&sc->sc_enxio_reported, 0, 1)) { + g_print_bio("g_vfs_done():", bip, "error = %d%s", + bip->bio_error, + bip->bio_error != ENXIO ? "" : + " supressing further ENXIO"); + } } bp->b_error = bip->bio_error; bp->b_ioflags = bip->bio_flags;