diff mbox series

[V2] ext4: don't complain about incorrect features when probing

Message ID e5c4f332-a61a-372a-5396-0ce05f258967@redhat.com
State Accepted, archived
Headers show
Series [V2] ext4: don't complain about incorrect features when probing | expand

Commit Message

Eric Sandeen March 2, 2018, 4:51 p.m. UTC
If mount is auto-probing for filesystem type, it will try various
filesystems in order, with the MS_SILENT flag set.  We get
that flag as the silent arg to ext4_fill_super.

If we're probing (silent==1) then don't complain about feature
incompatibilities that are found if it looks like it's actually
a different valid extN type - failed probes should be silent
in this case.

If the on-disk features are unknown even to ext4, then complain.

Reported-by: Joakim Tjernlund <Joakim.Tjernlund@infinera.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

compile-tested only, sorry.

V2.  I lied.  (actually I hand-edited the patch in mail)  /Now/ it's compile tested,
with the proper args to ext4_feature_set_ok :/

Having 2 gotos like this might not be preferable, but trying
to write it more compactly led to what I thought was more
difficult-to-read logic.

Comments

Joakim Tjernlund March 2, 2018, 5:06 p.m. UTC | #1
On Fri, 2018-03-02 at 10:51 -0600, Eric Sandeen wrote:
> CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.

> 

> 

> If mount is auto-probing for filesystem type, it will try various

> filesystems in order, with the MS_SILENT flag set.  We get

> that flag as the silent arg to ext4_fill_super.

> 

> If we're probing (silent==1) then don't complain about feature

> incompatibilities that are found if it looks like it's actually

> a different valid extN type - failed probes should be silent

> in this case.

> 

> If the on-disk features are unknown even to ext4, then complain.

> 

> Reported-by: Joakim Tjernlund <Joakim.Tjernlund@infinera.com>

> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

> ---

> 

> compile-tested only, sorry.

> 

> V2.  I lied.  (actually I hand-edited the patch in mail)  /Now/ it's compile tested,

> with the proper args to ext4_feature_set_ok :/

> 

> Having 2 gotos like this might not be preferable, but trying

> to write it more compactly led to what I thought was more

> difficult-to-read logic.


Did a quick & dirty backport to 4.14.12 and tested and it works.
(yes, I noticed the error too :)

Thanks

Would be nice if sent to stable as well.

Tested-by: Joakim Tjernlund <Joakim.Tjernlund@infinera.com>


> 

> 

> 

> 

> diff --git a/fs/ext4/super.c b/fs/ext4/super.c

> index b0915b7..ae40368 100644

> --- a/fs/ext4/super.c

> +++ b/fs/ext4/super.c

> @@ -3659,6 +3659,12 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)

>                         ext4_msg(sb, KERN_INFO, "mounting ext2 file system "

>                                  "using the ext4 subsystem");

>                 else {

> +                       /*

> +                        * If we're probing be silent, if this looks like

> +                        * it's actually an ext[34] filesystem.

> +                        */

> +                       if (silent && ext4_feature_set_ok(sb, sb_rdonly(sb)))

> +                               goto failed_mount;

>                         ext4_msg(sb, KERN_ERR, "couldn't mount as ext2 due "

>                                  "to feature incompatibilities");

>                         goto failed_mount;

> @@ -3670,6 +3676,12 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)

>                         ext4_msg(sb, KERN_INFO, "mounting ext3 file system "

>                                  "using the ext4 subsystem");

>                 else {

> +                       /*

> +                        * If we're probing be silent, if this looks like

> +                        * it's actually an ext4 filesystem.

> +                        */

> +                       if (silent && ext4_feature_set_ok(sb, sb_rdonly(sb)))

> +                               goto failed_mount;

>                         ext4_msg(sb, KERN_ERR, "couldn't mount as ext3 due "

>                                  "to feature incompatibilities");

>                         goto failed_mount;

> 

>
Jan Kara March 6, 2018, 11:02 a.m. UTC | #2
On Fri 02-03-18 10:51:28, Eric Sandeen wrote:
> 
> 
> If mount is auto-probing for filesystem type, it will try various
> filesystems in order, with the MS_SILENT flag set.  We get
> that flag as the silent arg to ext4_fill_super.
> 
> If we're probing (silent==1) then don't complain about feature
> incompatibilities that are found if it looks like it's actually
> a different valid extN type - failed probes should be silent
> in this case.
> 
> If the on-disk features are unknown even to ext4, then complain.
> 
> Reported-by: Joakim Tjernlund <Joakim.Tjernlund@infinera.com>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

The patch looks good. You can add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza


> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index b0915b7..ae40368 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -3659,6 +3659,12 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
>  			ext4_msg(sb, KERN_INFO, "mounting ext2 file system "
>  				 "using the ext4 subsystem");
>  		else {
> +			/*
> +			 * If we're probing be silent, if this looks like
> +			 * it's actually an ext[34] filesystem.
> +			 */
> +			if (silent && ext4_feature_set_ok(sb, sb_rdonly(sb)))
> +				goto failed_mount;
>  			ext4_msg(sb, KERN_ERR, "couldn't mount as ext2 due "
>  				 "to feature incompatibilities");
>  			goto failed_mount;
> @@ -3670,6 +3676,12 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
>  			ext4_msg(sb, KERN_INFO, "mounting ext3 file system "
>  				 "using the ext4 subsystem");
>  		else {
> +			/*
> +			 * If we're probing be silent, if this looks like
> +			 * it's actually an ext4 filesystem.
> +			 */
> +			if (silent && ext4_feature_set_ok(sb, sb_rdonly(sb)))
> +				goto failed_mount;
>  			ext4_msg(sb, KERN_ERR, "couldn't mount as ext3 due "
>  				 "to feature incompatibilities");
>  			goto failed_mount;
> 
>
Theodore Ts'o March 22, 2018, 4 p.m. UTC | #3
On Fri, Mar 02, 2018 at 10:51:28AM -0600, Eric Sandeen wrote:
> 
> 
> If mount is auto-probing for filesystem type, it will try various
> filesystems in order, with the MS_SILENT flag set.  We get
> that flag as the silent arg to ext4_fill_super.
> 
> If we're probing (silent==1) then don't complain about feature
> incompatibilities that are found if it looks like it's actually
> a different valid extN type - failed probes should be silent
> in this case.
> 
> If the on-disk features are unknown even to ext4, then complain.
> 
> Reported-by: Joakim Tjernlund <Joakim.Tjernlund@infinera.com>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Thanks, applied.

						- Ted
diff mbox series

Patch

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index b0915b7..ae40368 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3659,6 +3659,12 @@  static int ext4_fill_super(struct super_block *sb, void *data, int silent)
 			ext4_msg(sb, KERN_INFO, "mounting ext2 file system "
 				 "using the ext4 subsystem");
 		else {
+			/*
+			 * If we're probing be silent, if this looks like
+			 * it's actually an ext[34] filesystem.
+			 */
+			if (silent && ext4_feature_set_ok(sb, sb_rdonly(sb)))
+				goto failed_mount;
 			ext4_msg(sb, KERN_ERR, "couldn't mount as ext2 due "
 				 "to feature incompatibilities");
 			goto failed_mount;
@@ -3670,6 +3676,12 @@  static int ext4_fill_super(struct super_block *sb, void *data, int silent)
 			ext4_msg(sb, KERN_INFO, "mounting ext3 file system "
 				 "using the ext4 subsystem");
 		else {
+			/*
+			 * If we're probing be silent, if this looks like
+			 * it's actually an ext4 filesystem.
+			 */
+			if (silent && ext4_feature_set_ok(sb, sb_rdonly(sb)))
+				goto failed_mount;
 			ext4_msg(sb, KERN_ERR, "couldn't mount as ext3 due "
 				 "to feature incompatibilities");
 			goto failed_mount;