[PATCH] block: add SB_I_STABLE_WRITES to bdev sb flag

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>
---
 block/bdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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;
 }
-- 
2.42.0




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux