On Tue, Jun 15, 2021 at 6:01 PM Christoph Hellwig <hch@xxxxxx> wrote: > > On Tue, Jun 15, 2021 at 09:58:03PM +0800, Ming Lei wrote: > > On Tue, Jun 15, 2021 at 7:52 PM Christoph Hellwig <hch@xxxxxx> wrote: > > > > > > On Mon, Jun 14, 2021 at 02:40:58PM +0200, Bruno Goncalves wrote: > > > > Hi, > > > > > > > > We've noticed a kernel oops during the stress-ng test on aarch64 more log > > > > details on [1]. Christoph, do you think this could be related to the recent > > > > blk_cleanup_disk changes [2]? > > > > > > It doesn't really look very related. Any chance you could bisect it? > > > > It should be the wrong order between freeing tagset and cleanup disk: > > > > static void loop_remove(struct loop_device *lo) > > { > > ... > > blk_mq_free_tag_set(&lo->tag_set); > > blk_cleanup_disk(lo->lo_disk); > > ... > > } > > Indeed. Something like this should fix the issue: > > diff --git a/drivers/block/loop.c b/drivers/block/loop.c > index 9a48b3f9a15c..e0c4de392eab 100644 > --- a/drivers/block/loop.c > +++ b/drivers/block/loop.c > @@ -2172,8 +2172,8 @@ static int loop_add(struct loop_device **l, int i) > static void loop_remove(struct loop_device *lo) > { > del_gendisk(lo->lo_disk); > - blk_mq_free_tag_set(&lo->tag_set); > blk_cleanup_disk(lo->lo_disk); > + blk_mq_free_tag_set(&lo->tag_set); > mutex_destroy(&lo->lo_mutex); > kfree(lo); > } > Thank you Christoph and Ming, I've tested the patch and the panic is gone. I still hit some kernel oops, but that doesn't seem related to any block change. Bruno