aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/ioctl.c
diff options
context:
space:
mode:
authorBaokun Li <libaokun1@huawei.com>2025-01-22 19:41:27 +0800
committerTheodore Ts'o <tytso@mit.edu>2025-03-13 10:16:34 -0400
commit5bc27f4d73d3dadc5c71fb47ea741d31d92f41b1 (patch)
tree1c146e6092c2b19dd814e308070aa025ad0f0681 /fs/ext4/ioctl.c
parentext4: add ext4_emergency_state() helper function (diff)
downloadlinux-5bc27f4d73d3dadc5c71fb47ea741d31d92f41b1.tar.gz
linux-5bc27f4d73d3dadc5c71fb47ea741d31d92f41b1.zip
ext4: add more ext4_emergency_state() checks around sb_rdonly()
Some functions check sb_rdonly() to make sure the file system isn't modified after it's read-only. Since we also don't want the file system modified if it's in an emergency state (shutdown or emergency_ro), we're adding additional ext4_emergency_state() checks where sb_rdonly() is checked. Suggested-by: Jan Kara <jack@suse.cz> Signed-off-by: Baokun Li <libaokun1@huawei.com> Reviewed-by: Zhang Yi <yi.zhang@huawei.com> Reviewed-by: Jan Kara <jack@suse.cz> Link: https://patch.msgid.link/20250122114130.229709-5-libaokun@huaweicloud.com Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/ioctl.c')
-rw-r--r--fs/ext4/ioctl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
index 7b9ce71c1c81..0c5ce9c2cdfc 100644
--- a/fs/ext4/ioctl.c
+++ b/fs/ext4/ioctl.c
@@ -1705,7 +1705,7 @@ int ext4_update_overhead(struct super_block *sb, bool force)
{
struct ext4_sb_info *sbi = EXT4_SB(sb);
- if (sb_rdonly(sb))
+ if (ext4_emergency_state(sb) || sb_rdonly(sb))
return 0;
if (!force &&
(sbi->s_overhead == 0 ||