From: Jan Kara Date: Wed, 1 Nov 2023 17:43:10 +0000 (+0100) Subject: fs: Block writes to mounted block devices X-Git-Tag: v6.8-rc1~214^2~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6f861765464f43a71462d52026fbddfc858239a5;p=thirdparty%2Flinux.git fs: Block writes to mounted block devices Ask block layer to block writes to block devices mounted by filesystems. Signed-off-by: Jan Kara Link: https://lore.kernel.org/r/20231101174325.10596-5-jack@suse.cz Reviewed-by: Christian Brauner Reviewed-by: Jens Axboe Signed-off-by: Christian Brauner --- diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 0e0c0186aa321..9f6c3373f9fc5 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1494,7 +1494,8 @@ extern const struct blk_holder_ops fs_holder_ops; * as stored in sb->s_flags. */ #define sb_open_mode(flags) \ - (BLK_OPEN_READ | (((flags) & SB_RDONLY) ? 0 : BLK_OPEN_WRITE)) + (BLK_OPEN_READ | BLK_OPEN_RESTRICT_WRITES | \ + (((flags) & SB_RDONLY) ? 0 : BLK_OPEN_WRITE)) struct bdev_handle { struct block_device *bdev;