From owner-freebsd-geom@freebsd.org Fri Jan 27 21:55:12 2017 Return-Path: Delivered-To: freebsd-geom@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8B95CCC3195 for ; Fri, 27 Jan 2017 21:55:12 +0000 (UTC) (envelope-from phk@phk.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id 4150F825; Fri, 27 Jan 2017 21:55:12 +0000 (UTC) (envelope-from phk@phk.freebsd.dk) Received: from critter.freebsd.dk (unknown [192.168.55.3]) by phk.freebsd.dk (Postfix) with ESMTP id 7228F273E8; Fri, 27 Jan 2017 21:55:05 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.15.2/8.15.2) with ESMTP id v0RLt400031396; Fri, 27 Jan 2017 21:55:04 GMT (envelope-from phk@phk.freebsd.dk) To: Andriy Gapon cc: freebsd-geom@FreeBSD.org Subject: Re: g_disk_done() vs a destroyed disk In-reply-to: From: "Poul-Henning Kamp" References: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <31394.1485554104.1@critter.freebsd.dk> Content-Transfer-Encoding: quoted-printable Date: Fri, 27 Jan 2017 21:55:04 +0000 Message-ID: <31395.1485554104@critter.freebsd.dk> X-BeenThere: freebsd-geom@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: GEOM-specific discussions and implementations List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Jan 2017 21:55:12 -0000 -------- In message , Andriy Gapo= n writes: > >I've seen a situation where g_disk_done() was called on a bio after the >corresponding disk had been already destroyed via g_disk_destroy(). >That call resulted in a crash here: > devstat_end_transaction_bio_bt(sc->dp->d_devstat, bp, &now); >because sc->dp was NULL. > >Is it a bug that we do not check for dp being NULL (or dp->d_destroyed be= ing >set) in g_disk_done() ? >Or is it a bug that a controller driver called biodone() for that bio hav= ing >earlier called disk_destroy() ? It is a driver bug to call disk_destroy() before purging all in-flight bio= s with biodone() -- = Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe = Never attribute to malice what can adequately be explained by incompetence= .