Commit b4310306 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Li Nan
Browse files

loop: fix order of cleaning up the queue and freeing the tagset

mainline inclusion
from mainline-v5.14-rc1
commit 6a03cd98
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I81XCK

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6a03cd9843fa4dcf827dc3ad60fa9b4217f3057c



----------------------------------------

We must release the queue before freeing the tagset.

Fixes: 1c99502f ("loop: use blk_mq_alloc_disk and blk_cleanup_disk")
Reported-by: default avatarBruno Goncalves <bgoncalv@redhat.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
conflict:
  drivers/block/loop.c
Signed-off-by: default avatarZhong Jinghua <zhongjinghua@huawei.com>
Signed-off-by: default avatarLi Nan <linan122@huawei.com>
parent 35c9da2c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2194,8 +2194,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);
	kfree(lo);
}