block: add SB_I_STABLE_WRITES to bdev sb flag
PATCH 1/1 block: add SB_I_STABLE_WRITES to bdev sb flag
wait_for_stable_page() now checks SB_I_STABLE_WRITES flag on the superblock instead of backing_dev_info, this could trigger a false block integrity error when doing buffered write directly to the block device, as wait_for_stable_page() is a noop for bdev and the content of the page could be modified during writeback.
Add SB_I_STABLE_WRITES to bdev superblock flag to prevent this, one downside is we now wait for the page writeback for all devices doing write via bdev, regardless if stable_writes is required or not by the device.
Fixes 1cb039f3dc16 ("bdi: replace BDI_CAP_STABLE_WRITES with a queue and a sb flag")
Signed-off-by Li Dongyang <[email protected]>
--- block/bdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/bdev.c +1 -1
@@ -350,7 +350,7 @@ static int bd_init_fs_context(struct fs_context *fc)struct pseudo_fs_context *ctx =init_pseudo (fc,BDEVFS_MAGIC );if (!ctx)return -ENOMEM ; - fc->s_iflags |=SB_I_CGROUPWB ; + fc->s_iflags |=SB_I_CGROUPWB |SB_I_STABLE_WRITES ; ctx->ops = &bdev_sops;return 0 ; }
Signature · 1 line
2.42.0