From bbf15239ed8e517c6a3e5fb38599989c587563ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Schmidt?= Date: Tue, 11 May 2004 13:17:40 +0000 Subject: [PATCH] Dont try to finish devstat's if the disk pointer is NULL, this can happen when a disk has been destroyed but still has outstanding bio's. Reviewed by: phk --- sys/geom/geom_disk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c index aee02ebe602..044238530d0 100644 --- a/sys/geom/geom_disk.c +++ b/sys/geom/geom_disk.c @@ -189,7 +189,6 @@ g_disk_done(struct bio *bp) bp->bio_completed = bp->bio_length - bp->bio_resid; bp2 = bp->bio_parent; - dp = bp2->bio_to->geom->softc; if (bp2->bio_error == 0) bp2->bio_error = bp->bio_error; bp2->bio_completed += bp->bio_completed; @@ -197,7 +196,8 @@ g_disk_done(struct bio *bp) bp2->bio_inbed++; if (bp2->bio_children == bp2->bio_inbed) { bp2->bio_resid = bp2->bio_bcount - bp2->bio_completed; - devstat_end_transaction_bio(dp->d_devstat, bp2); + if ((dp = bp2->bio_to->geom->softc)) + devstat_end_transaction_bio(dp->d_devstat, bp2); g_io_deliver(bp2, bp2->bio_error); } mtx_unlock(&g_disk_done_mtx);