drivers/block/zram/zram_drv.c | 5 +++++ 1 file changed, 5 insertions(+)
Device reset does not take into account in-flight async IO
requests so we can free meta table and reset device concurrently
with those requests being executed. The block layer guidelines
indicate that queue state should be protected by blk_mq_freeze_queue()
during teardown. Freeze zram queue before device reset.
Fixes: cd67e10ac699 ("zram: promote zram from staging")
Link: https://sashiko.dev/#/patchset/20260804065919.3970386-1-xialonglong2025@163.com
Cc: stable@vger.kernel.org
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
---
drivers/block/zram/zram_drv.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 56183c827e1b..3b9dfcae9317 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -19,6 +19,7 @@
#include <linux/bio.h>
#include <linux/bitops.h>
#include <linux/blkdev.h>
+#include <linux/blk-mq.h>
#include <linux/buffer_head.h>
#include <linux/device.h>
#include <linux/highmem.h>
@@ -2842,6 +2843,9 @@ static void zram_destroy_comps(struct zram *zram)
static void zram_reset_device(struct zram *zram)
{
+ unsigned int memflags;
+
+ memflags = blk_mq_freeze_queue(zram->disk->queue);
guard(rwsem_write)(&zram->dev_lock);
zram->limit_pages = 0;
@@ -2855,6 +2859,7 @@ static void zram_reset_device(struct zram *zram)
zram_destroy_comps(zram);
memset(&zram->stats, 0, sizeof(zram->stats));
reset_bdev(zram);
+ blk_mq_unfreeze_queue(zram->disk->queue, memflags);
}
static ssize_t disksize_store(struct device *dev, struct device_attribute *attr,
--
2.55.0.571.g244d577d93-goog
On (26/08/05 11:18), Sergey Senozhatsky wrote:
> Device reset does not take into account in-flight async IO
> requests so we can free meta table and reset device concurrently
> with those requests being executed. The block layer guidelines
> indicate that queue state should be protected by blk_mq_freeze_queue()
> during teardown. Freeze zram queue before device reset.
>
> Fixes: cd67e10ac699 ("zram: promote zram from staging")
> Link: https://sashiko.dev/#/patchset/20260804065919.3970386-1-xialonglong2025@163.com
> Cc: stable@vger.kernel.org
> Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
lockdep doesn't seem to be happy...
Let me look into it.
On (26/08/05 19:29), Sergey Senozhatsky wrote:
> On (26/08/05 11:18), Sergey Senozhatsky wrote:
> > Device reset does not take into account in-flight async IO
> > requests so we can free meta table and reset device concurrently
> > with those requests being executed. The block layer guidelines
> > indicate that queue state should be protected by blk_mq_freeze_queue()
> > during teardown. Freeze zram queue before device reset.
> >
> > Fixes: cd67e10ac699 ("zram: promote zram from staging")
> > Link: https://sashiko.dev/#/patchset/20260804065919.3970386-1-xialonglong2025@163.com
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
>
> lockdep doesn't seem to be happy...
> Let me look into it.
Actually I need to look at the report again. I suspect that we
maybe don't even need any patches for that "async IO vs reset"
sashiko report.
© 2016 - 2026 Red Hat, Inc.