mm: folio_wait_stable() should check for bdev
Subsystems (4)
PATCH 1/1 mm: folio_wait_stable() should check for bdev
folio_wait_stable() 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 folio_wait_stable() is a noop for bdev and the content could be modified during writeback.
Check if the folio's superblock is bdev and wait for writeback if the backing device requires stables_writes.
---
This patch supersedes the previous
block: add SB_I_STABLE_WRITES to bdev sb flag
---
--- mm/page-writeback.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
mm/page-writeback.c +5 -1
@@ -3110,7 +3110,11 @@ EXPORT_SYMBOL_GPL(folio_wait_writeback_killable);*/ void folio_wait_stable (struct folio *folio) { -if (folio_inode (folio)->i_sb->s_iflags &SB_I_STABLE_WRITES ) +struct inode *inode =folio_inode (folio); + +if (inode->i_sb->s_iflags &SB_I_STABLE_WRITES || + (sb_is_blkdev_sb (inode->i_sb) && +bdev_stable_writes (I_BDEV (inode))))folio_wait_writeback (folio); }EXPORT_SYMBOL_GPL (folio_wait_stable);
Signature · 1 line
2.42.0
Quoted 9 lines · Li Dongyang
folio_wait_stable()now checksSB_I_STABLE_WRITESflag on the superblock instead ofbacking_dev_info, this could trigger a false block integrity error when doing buffered write directly to the block device, asfolio_wait_stable()is a noop for bdev and the content could be modified during writeback.Check if the folio's superblock is bdev and wait for writeback if the backing device requires
stables_writes.
https://lore.kernel.org/lkml/CAOi1vP9Zit-A9rRk9jy+d1itaBzUSBzFBuhXE+EDfBtF-Mf0og@mail.gmail.com/T/#t