]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
mm: always respect QUEUE_FLAG_STABLE_WRITES on the block device wip-stable-writes
authorIlya Dryomov <idryomov@gmail.com>
Thu, 4 May 2023 10:31:26 +0000 (12:31 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Fri, 5 May 2023 19:47:43 +0000 (21:47 +0200)
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 <idryomov@gmail.com>
mm/page-writeback.c

index 516b1aa247e83fd4564dfcea0f8892c8481a1dab..068a63badaa366fa6d4777323b98b7afdc1a956d 100644 (file)
@@ -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);