add patch dont-complain-about-incorrect-features-when-probing
[ext4-patch-queue.git] / dont-complain-about-incorrect-features-when-probing
blob7a6abeec2bc4c1c2cc395ea7c3236ddcb97e3e46
1 ext4: don't complain about incorrect features when probing
3 From: Eric Sandeen <sandeen@redhat.com>
5 If mount is auto-probing for filesystem type, it will try various
6 filesystems in order, with the MS_SILENT flag set.  We get
7 that flag as the silent arg to ext4_fill_super.
9 If we're probing (silent==1) then don't complain about feature
10 incompatibilities that are found if it looks like it's actually
11 a different valid extN type - failed probes should be silent
12 in this case.
14 If the on-disk features are unknown even to ext4, then complain.
16 Reported-by: Joakim Tjernlund <Joakim.Tjernlund@infinera.com>
17 Tested-by: Joakim Tjernlund <Joakim.Tjernlund@infinera.com>
18 Signed-off-by: Eric Sandeen <sandeen@redhat.com>
19 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
20 Reviewed-by: Jan Kara <jack@suse.cz>
21 ---
23 compile-tested only, sorry.
25 V2.  I lied.  (actually I hand-edited the patch in mail)  /Now/ it's compile tested,
26 with the proper args to ext4_feature_set_ok :/
28 Having 2 gotos like this might not be preferable, but trying
29 to write it more compactly led to what I thought was more
30 difficult-to-read logic.
35 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
36 index b0915b7..ae40368 100644
37 --- a/fs/ext4/super.c
38 +++ b/fs/ext4/super.c
39 @@ -3659,6 +3659,12 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
40                         ext4_msg(sb, KERN_INFO, "mounting ext2 file system "
41                                  "using the ext4 subsystem");
42                 else {
43 +                       /*
44 +                        * If we're probing be silent, if this looks like
45 +                        * it's actually an ext[34] filesystem.
46 +                        */
47 +                       if (silent && ext4_feature_set_ok(sb, sb_rdonly(sb)))
48 +                               goto failed_mount;
49                         ext4_msg(sb, KERN_ERR, "couldn't mount as ext2 due "
50                                  "to feature incompatibilities");
51                         goto failed_mount;
52 @@ -3670,6 +3676,12 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
53                         ext4_msg(sb, KERN_INFO, "mounting ext3 file system "
54                                  "using the ext4 subsystem");
55                 else {
56 +                       /*
57 +                        * If we're probing be silent, if this looks like
58 +                        * it's actually an ext4 filesystem.
59 +                        */
60 +                       if (silent && ext4_feature_set_ok(sb, sb_rdonly(sb)))
61 +                               goto failed_mount;
62                         ext4_msg(sb, KERN_ERR, "couldn't mount as ext3 due "
63                                  "to feature incompatibilities");
64                         goto failed_mount;