diff mbox series

[4/6] ext4: Block writes to journal device

Message ID 20230704125702.23180-4-jack@suse.cz (mailing list archive)
State New, archived
Headers show
Series block: Add config option to not allow writing to mounted devices | expand

Commit Message

Jan Kara July 4, 2023, 12:56 p.m. UTC
Ask block layer to not allow other writers to open block device used
for ext4 journal.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/ext4/super.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index cbeb8a555fe3..8181285b7549 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1112,8 +1112,9 @@  static struct bdev_handle *ext4_blkdev_get(dev_t dev, struct super_block *sb)
 {
 	struct bdev_handle *handle;
 
-	handle = blkdev_get_by_dev(dev, BLK_OPEN_READ | BLK_OPEN_WRITE, sb,
-				   &ext4_holder_ops);
+	handle = blkdev_get_by_dev(dev,
+			BLK_OPEN_READ | BLK_OPEN_WRITE | BLK_OPEN_BLOCK_WRITES,
+			sb, &ext4_holder_ops);
 	if (IS_ERR(handle))
 		goto fail;
 	return handle;