add patch compare-old-and-new-mode-before-setting-update_mode-flag
[ext4-patch-queue.git] / fix-EXT4_IOC_GROUP_ADD-ioctl
blob9c30716958cbe8a580ad898a27632d19ca5f1696
1 ext4: fix EXT4_IOC_GROUP_ADD ioctl
3 From: ruippan (潘睿) <ruippan@tencent.com>
5 Commit e2b911c53584 ("ext4: clean up feature test macros with
6 predicate functions") broke the EXT4_IOC_GROUP_ADD ioctl.  This was
7 not noticed since only very old versions of resize2fs (before
8 e2fsprogs 1.42) use this ioctl.  However, using a new kernel with an
9 enterprise Linux userspace will cause attempts to use online resize to
10 fail with "No reserved GDT blocks".
12 Fixes: e2b911c53584 ("ext4: clean up feature test macros with predicate...")
13 Cc: stable@kernel.org # v4.4
14 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
15 Signed-off-by: ruippan (潘睿) <ruippan@tencent.com>
16 ---
17  fs/ext4/resize.c | 2 +-
18  1 file changed, 1 insertion(+), 1 deletion(-)
20 diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
21 index 87350b642681..bc8ee0c498cc 100644
22 --- a/fs/ext4/resize.c
23 +++ b/fs/ext4/resize.c
24 @@ -1631,7 +1631,7 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input)
25         }
27         if (reserved_gdb || gdb_off == 0) {
28 -               if (ext4_has_feature_resize_inode(sb) ||
29 +               if (!ext4_has_feature_resize_inode(sb) ||
30                     !le16_to_cpu(es->s_reserved_gdt_blocks)) {
31                         ext4_warning(sb,
32                                      "No reserved GDT blocks, can't resize");