From nobody Thu Oct 7 23:08:03 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 5487912DC42B; Thu, 7 Oct 2021 23:08:04 +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 4HQRnJ1vmwz3JWw; Thu, 7 Oct 2021 23:08:04 +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 1DA561C42D; Thu, 7 Oct 2021 23:08:04 +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 197N83nN037274; Thu, 7 Oct 2021 23:08:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 197N833D037273; Thu, 7 Oct 2021 23:08:03 GMT (envelope-from git) Date: Thu, 7 Oct 2021 23:08:03 GMT Message-Id: <202110072308.197N833D037273@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kirk McKusick Subject: git: b72d51cfffab - stable/13 - Avoid "consumer not attached in g_io_request" panic when disk lost while using a UFS snapshot. 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: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b72d51cfffab35f43cd05ee385047f222e0ab8e0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=b72d51cfffab35f43cd05ee385047f222e0ab8e0 commit b72d51cfffab35f43cd05ee385047f222e0ab8e0 Author: Kirk McKusick AuthorDate: 2021-09-28 03:03:43 +0000 Commit: Kirk McKusick CommitDate: 2021-10-07 23:05:39 +0000 Avoid "consumer not attached in g_io_request" panic when disk lost while using a UFS snapshot. Differential revision: https://reviews.freebsd.org/D32150 Sponsored by: Netflix (cherry picked from commit 4a365e863f209b0c82641c909a858dab53b19134) --- sys/ufs/ffs/ffs_snapshot.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c index baad50cab2ba..5855a679ab84 100644 --- a/sys/ufs/ffs/ffs_snapshot.c +++ b/sys/ufs/ffs/ffs_snapshot.c @@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -2554,22 +2555,16 @@ readblock(vp, bp, lbn) ufs2_daddr_t lbn; { struct inode *ip; - struct bio *bip; struct fs *fs; ip = VTOI(vp); fs = ITOFS(ip); - bip = g_alloc_bio(); - bip->bio_cmd = BIO_READ; - bip->bio_offset = dbtob(fsbtodb(fs, blkstofrags(fs, lbn))); - bip->bio_data = bp->b_data; - bip->bio_length = bp->b_bcount; - bip->bio_done = NULL; - - g_io_request(bip, ITODEVVP(ip)->v_bufobj.bo_private); - bp->b_error = biowait(bip, "snaprdb"); - g_destroy_bio(bip); + bp->b_iocmd = BIO_READ; + bp->b_iooffset = dbtob(fsbtodb(fs, blkstofrags(fs, lbn))); + bp->b_iodone = bdone; + g_vfs_strategy(&ITODEVVP(ip)->v_bufobj, bp); + bufwait(bp); return (bp->b_error); }