diff mbox series

block: add SB_I_STABLE_WRITES to bdev sb flag

Message ID 20231102001430.385337-1-dongyangli@ddn.com (mailing list archive)
State New, archived
Headers show
Series block: add SB_I_STABLE_WRITES to bdev sb flag | expand

Commit Message

Li Dongyang Nov. 2, 2023, 12:14 a.m. UTC
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 <dongyangli@ddn.com>
---
 block/bdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/block/bdev.c b/block/bdev.c
index 2018d250e131..b1536f069aba 100644
--- a/block/bdev.c
+++ b/block/bdev.c
@@ -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;
 }