Skip to content

Commit 1898efc

Browse files
Christoph Hellwigbrauner
authored andcommitted
block: update the stable_writes flag in bdev_add
Propagate the per-queue stable_write flags into each bdev inode in bdev_add. This makes sure devices that require stable writes have it set for I/O on the block device node as well. Note that this doesn't cover the case of a flag changing on a live device yet. We should handle that as well, but I plan to cover it as part of a more general rework of how changing runtime paramters on block devices works. Fixes: 1cb039f ("bdi: replace BDI_CAP_STABLE_WRITES with a queue and a sb flag") Reported-by: Ilya Dryomov <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Link: https://lore.kernel.org/r/[email protected] Tested-by: Ilya Dryomov <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent 762321d commit 1898efc

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

block/bdev.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,8 @@ void bdev_set_nr_sectors(struct block_device *bdev, sector_t sectors)
425425

426426
void bdev_add(struct block_device *bdev, dev_t dev)
427427
{
428+
if (bdev_stable_writes(bdev))
429+
mapping_set_stable_writes(bdev->bd_inode->i_mapping);
428430
bdev->bd_dev = dev;
429431
bdev->bd_inode->i_rdev = dev;
430432
bdev->bd_inode->i_ino = dev;

0 commit comments

Comments
 (0)