]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ext4: prevent delalloc to nodelalloc on remount
authorNicolas Bretz <bretznic@gmail.com>
Mon, 14 Oct 2024 03:41:43 +0000 (20:41 -0700)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 13 Nov 2024 04:54:15 +0000 (23:54 -0500)
Implemented the suggested solution mentioned in the bug
https://bugzilla.kernel.org/show_bug.cgi?id=218820

Preventing the disabling of delayed allocation mode on remount.
delalloc to nodelalloc not permitted anymore
nodelalloc to delalloc permitted, not affected

Signed-off-by: Nicolas Bretz <bretznic@gmail.com>
Link: https://patch.msgid.link/20241014034143.59779-1-bretznic@gmail.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/super.c

index cb0ce57bd8968273a9b9a50e3379144a5f9f00cb..33a81ef3c08a17f93dabca7aeb573cd054033c4a 100644 (file)
@@ -6528,6 +6528,13 @@ static int __ext4_remount(struct fs_context *fc, struct super_block *sb)
                goto restore_opts;
        }
 
+       if ((old_opts.s_mount_opt & EXT4_MOUNT_DELALLOC) &&
+           !test_opt(sb, DELALLOC)) {
+               ext4_msg(sb, KERN_ERR, "can't disable delalloc during remount");
+               err = -EINVAL;
+               goto restore_opts;
+       }
+
        sb->s_flags = (sb->s_flags & ~SB_POSIXACL) |
                (test_opt(sb, POSIX_ACL) ? SB_POSIXACL : 0);