--- src/sys/dev/disk/md/md.c 2007/05/15 00:01:03 1.16 +++ src/sys/dev/disk/md/md.c 2007/07/31 20:04:48 1.17 @@ -182,11 +182,13 @@ mdstrategy_malloc(struct dev_strategy_ar while (1) { bio = bioq_first(&sc->bio_queue); - if (bp) - bioq_remove(&sc->bio_queue, bio); - crit_exit(); - if (bio == NULL) + if (bio == NULL) { + crit_exit(); break; + } + crit_exit(); + bioq_remove(&sc->bio_queue, bio); + bp = bio->bio_buf; devstat_start_transaction(&sc->stats);