From nobody Sat Jul 01 17:14:59 2023 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 4Qtf2D0Wk6z4l5lx; Sat, 1 Jul 2023 17:15:00 +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 4Qtf2D03rrz3mXJ; Sat, 1 Jul 2023 17:15:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688231700; 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=en/IkIhQ7N7nLxqOuhfrXesLGnyHet0g8PR1sFXUozM=; b=rg1y8MZM2K0Dohn4cUdIDLxZlTUAWeqB7cg2UWr9W22CJbTIGG/fdLiU45SkQmWVFTxgpL TkAwDNm2P48bvtSAO8BIUQzVNMs4l4d1p1drtV10V0aCxWgKF6IdIuqO4z93kEupucz1Nu 1NDwP3XOke8d/SGXIhCJRpfKKr5EaeXkmiZnNOOttujRUVS9Y8Bp9XGZwOPBepq8weyFR8 aqe12x9XFl4tpIHm7ZCt+D5W7L0IH1jazkbtJJasCl3YRKwlFUwmyjzZ/uYXHhQIRNU21b 9Nd9Sycrgz9V09B7MlP6nZePPnJTBOHIpJZuoNdAK9HBXzXEkEbjLGqKco020g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688231700; 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=en/IkIhQ7N7nLxqOuhfrXesLGnyHet0g8PR1sFXUozM=; b=WQMP1eTv4epSubd7UVaY/dzPZ0iWEk4ZZNGbFPSJtvgesnI3myUHVUblKWuxeSz+mrLRzq KhHecjQ+VskHsNGlRHlEP75N/hXqWoghryElzY0PTo9CiQWtJijA2osr9zAdte0N5ewB9l OosDtKtIJIb5RI3lRfWsCiEhkq77Y+lNr8N5VdZDMr6z34ZnUtRkWx3B0Ff3/VCpdTwygY OsCFAQ917yVbGNoxAjLoFdk/ICmsImtzt7etnFMABOAe/cxg9XmQfHM3k3WDnSYbhObgrN DRRSC+BHud09IyiiXXhRXw0ZRtx+xSv2qbeQjtMARrhzc0dhUCMYgWQg70R+Qw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1688231700; a=rsa-sha256; cv=none; b=EvsolZA/zzwVJ8nJ0nFkXYXoCNY/PruS28Ot7s4gUsFP41+b6TCltgamNz/Keuzwo1wzQY s5UfuVjVUy7Gy8jEgr2nDH1HB5cmV7FB54MpmymgDszW1DMJww0Dk7SIQZpUJJ1Tnz3ilS t+63Fx4hcDzQcAgTd1P7RcVwWuygXUVTd/H93CmqBv7cR4GI6utqhYGa6+DKgMfgTw7d7h YOvobyTkjZ26Rv1cGvrScCZZitj7gpDp6kktOgpbry9HawB9iZaLCtEdmVO1UQ2xBjds4+ gnsDQ7128ObqEcBD1osRdxzzyeUO/lT5DAaK1Atrxb7TzoSSHlNs3NPIHYXHhg== 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 4Qtf2C62R4zZ3J; Sat, 1 Jul 2023 17:14:59 +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 361HExA1054369; Sat, 1 Jul 2023 17:14:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 361HExJt054368; Sat, 1 Jul 2023 17:14:59 GMT (envelope-from git) Date: Sat, 1 Jul 2023 17:14:59 GMT Message-Id: <202307011714.361HExJt054368@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: d3eb9d3db3aa - main - bios: Don't keep sending BIO_FLUSH after first ENOTSUPP. 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: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d3eb9d3db3aa36df13f96c48bff8acdf626464c5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=d3eb9d3db3aa36df13f96c48bff8acdf626464c5 commit d3eb9d3db3aa36df13f96c48bff8acdf626464c5 Author: santhoshkumar-mani AuthorDate: 2023-07-01 17:11:57 +0000 Commit: Warner Losh CommitDate: 2023-07-01 17:14:49 +0000 bios: Don't keep sending BIO_FLUSH after first ENOTSUPP. When a storage device reports that it does not support cache flush, the GEOM disk layer by default returns ENOTSUPP in response to a BIO_FLUSH command. On AWS, local volumes do not advertise themselves as having write-cache enabled. When they are selected for L3 on all HDD nodes, the L3 subsystem may inadvertently kick these L3 devices if a BIO_FLUSH command fails with an ENOTSUPP return code. The fix is to make GEOM disk return success (0) when this condition occurs and add a sysctl to make this error handling config-driven Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/710 --- sys/geom/geom_disk.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c index 90fe0216dd8b..a000dfe6c4f2 100644 --- a/sys/geom/geom_disk.c +++ b/sys/geom/geom_disk.c @@ -71,6 +71,7 @@ struct g_disk_softc { char led[64]; uint32_t state; struct mtx done_mtx; + bool flush_notsup_succeed; }; static g_access_t g_disk_access; @@ -539,7 +540,7 @@ g_disk_start(struct bio *bp) g_trace(G_T_BIO, "g_disk_flushcache(%s)", bp->bio_to->name); if (!(dp->d_flags & DISKFLAG_CANFLUSHCACHE)) { - error = EOPNOTSUPP; + error = (sc->flush_notsup_succeed) ? 0 : EOPNOTSUPP; break; } /*FALLTHROUGH*/ @@ -760,6 +761,10 @@ g_disk_create(void *arg, int flag) SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, "flags", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, dp, 0, g_disk_sysctl_flags, "A", "Report disk flags"); + SYSCTL_ADD_BOOL(&sc->sysctl_ctx, + SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, "flush_notsup_succeed", + CTLFLAG_RWTUN, &sc->flush_notsup_succeed, sizeof(sc->flush_notsup_succeed), + "Do not return EOPNOTSUPP if there is no cache to flush"); } pp->private = sc; dp->d_geom = gp;