Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

zloop: advertise a volatile write cache

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>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Christoph Hellwig and committed by
Jens Axboe
6acf7860 0d195d3b

+18 -6
+18 -6
drivers/block/zloop.c
··· 542 542 zloop_put_cmd(cmd); 543 543 } 544 544 545 + /* 546 + * Sync the entire FS containing the zone files instead of walking all files. 547 + */ 548 + static int zloop_flush(struct zloop_device *zlo) 549 + { 550 + struct super_block *sb = file_inode(zlo->data_dir)->i_sb; 551 + int ret; 552 + 553 + down_read(&sb->s_umount); 554 + ret = sync_filesystem(sb); 555 + up_read(&sb->s_umount); 556 + 557 + return ret; 558 + } 559 + 545 560 static void zloop_handle_cmd(struct zloop_cmd *cmd) 546 561 { 547 562 struct request *rq = blk_mq_rq_from_pdu(cmd); ··· 577 562 zloop_rw(cmd); 578 563 return; 579 564 case REQ_OP_FLUSH: 580 - /* 581 - * Sync the entire FS containing the zone files instead of 582 - * walking all files 583 - */ 584 - cmd->ret = sync_filesystem(file_inode(zlo->data_dir)->i_sb); 565 + cmd->ret = zloop_flush(zlo); 585 566 break; 586 567 case REQ_OP_ZONE_RESET: 587 568 cmd->ret = zloop_reset_zone(zlo, rq_zone_no(rq)); ··· 992 981 struct queue_limits lim = { 993 982 .max_hw_sectors = SZ_1M >> SECTOR_SHIFT, 994 983 .chunk_sectors = opts->zone_size, 995 - .features = BLK_FEAT_ZONED, 984 + .features = BLK_FEAT_ZONED | BLK_FEAT_WRITE_CACHE, 985 + 996 986 }; 997 987 unsigned int nr_zones, i, j; 998 988 struct zloop_device *zlo;