* zloop fixes
@ 2026-02-24 14:21 Christoph Hellwig
2026-02-24 14:21 ` [PATCH 1/2] zloop: advertise a volatile write cache Christoph Hellwig
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Christoph Hellwig @ 2026-02-24 14:21 UTC (permalink / raw)
To: Damien Le Moal, Jens Axboe; +Cc: linux-block
Hi all,
two fixes for zloop found while writing new test cases using it.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] zloop: advertise a volatile write cache
2026-02-24 14:21 zloop fixes Christoph Hellwig
@ 2026-02-24 14:21 ` Christoph Hellwig
2026-02-24 20:28 ` Damien Le Moal
2026-02-24 21:50 ` Jens Axboe
2026-02-24 14:21 ` [PATCH 2/2] zloop: check for spurious options passed to remove Christoph Hellwig
2026-02-24 21:18 ` zloop fixes Martin K. Petersen
2 siblings, 2 replies; 7+ messages in thread
From: Christoph Hellwig @ 2026-02-24 14:21 UTC (permalink / raw)
To: Damien Le Moal, Jens Axboe; +Cc: linux-block
Zloop is file system backed and thus needs to sync the underlying file
system to persist data. Set BLK_FEAT_WRITE_CACHE so that the block
layer actually send flush commands, and fix the flush implementation
as sync_filesystem requires s_umount to be held and the code currently
misses that.
Fixes: eb0570c7df23 ("block: new zoned loop block device driver")
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/block/zloop.c | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/drivers/block/zloop.c b/drivers/block/zloop.c
index 65a40266437c..56e54d9791f1 100644
--- a/drivers/block/zloop.c
+++ b/drivers/block/zloop.c
@@ -542,6 +542,21 @@ static void zloop_rw(struct zloop_cmd *cmd)
zloop_put_cmd(cmd);
}
+/*
+ * Sync the entire FS containing the zone files instead of walking all files.
+ */
+static int zloop_flush(struct zloop_device *zlo)
+{
+ struct super_block *sb = file_inode(zlo->data_dir)->i_sb;
+ int ret;
+
+ down_read(&sb->s_umount);
+ ret = sync_filesystem(sb);
+ up_read(&sb->s_umount);
+
+ return ret;
+}
+
static void zloop_handle_cmd(struct zloop_cmd *cmd)
{
struct request *rq = blk_mq_rq_from_pdu(cmd);
@@ -562,11 +577,7 @@ static void zloop_handle_cmd(struct zloop_cmd *cmd)
zloop_rw(cmd);
return;
case REQ_OP_FLUSH:
- /*
- * Sync the entire FS containing the zone files instead of
- * walking all files
- */
- cmd->ret = sync_filesystem(file_inode(zlo->data_dir)->i_sb);
+ cmd->ret = zloop_flush(zlo);
break;
case REQ_OP_ZONE_RESET:
cmd->ret = zloop_reset_zone(zlo, rq_zone_no(rq));
@@ -981,7 +992,8 @@ static int zloop_ctl_add(struct zloop_options *opts)
struct queue_limits lim = {
.max_hw_sectors = SZ_1M >> SECTOR_SHIFT,
.chunk_sectors = opts->zone_size,
- .features = BLK_FEAT_ZONED,
+ .features = BLK_FEAT_ZONED | BLK_FEAT_WRITE_CACHE,
+
};
unsigned int nr_zones, i, j;
struct zloop_device *zlo;
--
2.47.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] zloop: check for spurious options passed to remove
2026-02-24 14:21 zloop fixes Christoph Hellwig
2026-02-24 14:21 ` [PATCH 1/2] zloop: advertise a volatile write cache Christoph Hellwig
@ 2026-02-24 14:21 ` Christoph Hellwig
2026-02-24 20:29 ` Damien Le Moal
2026-02-24 21:18 ` zloop fixes Martin K. Petersen
2 siblings, 1 reply; 7+ messages in thread
From: Christoph Hellwig @ 2026-02-24 14:21 UTC (permalink / raw)
To: Damien Le Moal, Jens Axboe; +Cc: linux-block
Zloop uses a command option parser for all control commands,
but most options are only valid for adding a new device. Check
for incorrectly specified options in the remove handler.
Fixes: eb0570c7df23 ("block: new zoned loop block device driver")
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/block/zloop.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/block/zloop.c b/drivers/block/zloop.c
index 56e54d9791f1..51c043342127 100644
--- a/drivers/block/zloop.c
+++ b/drivers/block/zloop.c
@@ -1174,7 +1174,12 @@ static int zloop_ctl_remove(struct zloop_options *opts)
int ret;
if (!(opts->mask & ZLOOP_OPT_ID)) {
- pr_err("No ID specified\n");
+ pr_err("No ID specified for remove\n");
+ return -EINVAL;
+ }
+
+ if (opts->mask & ~ZLOOP_OPT_ID) {
+ pr_err("Invalid option specified for remove\n");
return -EINVAL;
}
--
2.47.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] zloop: advertise a volatile write cache
2026-02-24 14:21 ` [PATCH 1/2] zloop: advertise a volatile write cache Christoph Hellwig
@ 2026-02-24 20:28 ` Damien Le Moal
2026-02-24 21:50 ` Jens Axboe
1 sibling, 0 replies; 7+ messages in thread
From: Damien Le Moal @ 2026-02-24 20:28 UTC (permalink / raw)
To: Christoph Hellwig, Jens Axboe; +Cc: linux-block
On 2/24/26 23:21, Christoph Hellwig wrote:
> Zloop is file system backed and thus needs to sync the underlying file
> system to persist data. Set BLK_FEAT_WRITE_CACHE so that the block
> layer actually send flush commands, and fix the flush implementation
> as sync_filesystem requires s_umount to be held and the code currently
> misses that.
>
> Fixes: eb0570c7df23 ("block: new zoned loop block device driver")
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Thanks for fixing this.
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] zloop: check for spurious options passed to remove
2026-02-24 14:21 ` [PATCH 2/2] zloop: check for spurious options passed to remove Christoph Hellwig
@ 2026-02-24 20:29 ` Damien Le Moal
0 siblings, 0 replies; 7+ messages in thread
From: Damien Le Moal @ 2026-02-24 20:29 UTC (permalink / raw)
To: Christoph Hellwig, Jens Axboe; +Cc: linux-block
On 2/24/26 23:21, Christoph Hellwig wrote:
> Zloop uses a command option parser for all control commands,
> but most options are only valid for adding a new device. Check
> for incorrectly specified options in the remove handler.
>
> Fixes: eb0570c7df23 ("block: new zoned loop block device driver")
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: zloop fixes
2026-02-24 14:21 zloop fixes Christoph Hellwig
2026-02-24 14:21 ` [PATCH 1/2] zloop: advertise a volatile write cache Christoph Hellwig
2026-02-24 14:21 ` [PATCH 2/2] zloop: check for spurious options passed to remove Christoph Hellwig
@ 2026-02-24 21:18 ` Martin K. Petersen
2 siblings, 0 replies; 7+ messages in thread
From: Martin K. Petersen @ 2026-02-24 21:18 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Damien Le Moal, Jens Axboe, linux-block
Christoph,
> two fixes for zloop found while writing new test cases using it.
Looks good.
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
--
Martin K. Petersen
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] zloop: advertise a volatile write cache
2026-02-24 14:21 ` [PATCH 1/2] zloop: advertise a volatile write cache Christoph Hellwig
2026-02-24 20:28 ` Damien Le Moal
@ 2026-02-24 21:50 ` Jens Axboe
1 sibling, 0 replies; 7+ messages in thread
From: Jens Axboe @ 2026-02-24 21:50 UTC (permalink / raw)
To: Damien Le Moal, Christoph Hellwig; +Cc: linux-block
On Tue, 24 Feb 2026 06:21:44 -0800, Christoph Hellwig wrote:
> Zloop is file system backed and thus needs to sync the underlying file
> system to persist data. Set BLK_FEAT_WRITE_CACHE so that the block
> layer actually send flush commands, and fix the flush implementation
> as sync_filesystem requires s_umount to be held and the code currently
> misses that.
>
>
> [...]
Applied, thanks!
[1/2] zloop: advertise a volatile write cache
commit: 6acf7860dcc79ed045cc9e6a79c8a8bb6959dba7
[2/2] zloop: check for spurious options passed to remove
commit: 3c4617117a2b7682cf037be5e5533e379707f050
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-02-24 21:50 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-24 14:21 zloop fixes Christoph Hellwig
2026-02-24 14:21 ` [PATCH 1/2] zloop: advertise a volatile write cache Christoph Hellwig
2026-02-24 20:28 ` Damien Le Moal
2026-02-24 21:50 ` Jens Axboe
2026-02-24 14:21 ` [PATCH 2/2] zloop: check for spurious options passed to remove Christoph Hellwig
2026-02-24 20:29 ` Damien Le Moal
2026-02-24 21:18 ` zloop fixes Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox