From: Ilya Dryomov Date: Thu, 4 May 2023 10:31:26 +0000 (+0200) Subject: mm: always respect QUEUE_FLAG_STABLE_WRITES on the block device X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fheads%2Fwip-stable-writes;p=ceph-client.git mm: always respect QUEUE_FLAG_STABLE_WRITES on the block device Commit 1cb039f3dc16 ("bdi: replace BDI_CAP_STABLE_WRITES with a queue and a sb flag") introduced a regression for the raw block device use case. Capturing QUEUE_FLAG_STABLE_WRITES flag in set_bdev_super() has the effect of respecting it only when there is a filesystem mounted on top of the block device. Consequently, block devices that do integrity checking return sporadic checksum errors when accessed directly. Resurrect the original stable writes behavior by changing folio_wait_stable() to account for the case of a raw block device. Cc: stable@vger.kernel.org Fixes: 1cb039f3dc16 ("bdi: replace BDI_CAP_STABLE_WRITES with a queue and a sb flag") Signed-off-by: Ilya Dryomov --- diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 516b1aa247e8..068a63badaa3 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -3169,7 +3169,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); + struct super_block *sb = inode->i_sb; + + if ((sb->s_iflags & SB_I_STABLE_WRITES) || + (sb_is_blkdev_sb(sb) && bdev_stable_writes(I_BDEV(inode)))) folio_wait_writeback(folio); } EXPORT_SYMBOL_GPL(folio_wait_stable);