diff mbox series

ext4: stop overwrite the errcode in ext4_setup_super

Message ID 20200601073404.3712492-1-yangerkun@huawei.com
State Awaiting Upstream
Headers show
Series ext4: stop overwrite the errcode in ext4_setup_super | expand

Commit Message

yangerkun June 1, 2020, 7:34 a.m. UTC
Now the errcode from ext4_commit_super will overwrite EROFS exists in
ext4_setup_super. Actually, no need to call ext4_commit_super since we
will return EROFS. Fix it by goto done directly.

Fixes: c89128a00838 ("ext4: handle errors on ext4_commit_super")
Signed-off-by: yangerkun <yangerkun@huawei.com>
---
 fs/ext4/super.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Jan Kara June 1, 2020, 11:47 a.m. UTC | #1
On Mon 01-06-20 15:34:04, yangerkun wrote:
> Now the errcode from ext4_commit_super will overwrite EROFS exists in
> ext4_setup_super. Actually, no need to call ext4_commit_super since we
> will return EROFS. Fix it by goto done directly.
> 
> Fixes: c89128a00838 ("ext4: handle errors on ext4_commit_super")
> Signed-off-by: yangerkun <yangerkun@huawei.com>

Yeah, makes sense. You can add:

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

								Honza

> ---
>  fs/ext4/super.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index bf5fcb477f66..87c5611a4c67 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -2344,6 +2344,7 @@ static int ext4_setup_super(struct super_block *sb, struct ext4_super_block *es,
>  		ext4_msg(sb, KERN_ERR, "revision level too high, "
>  			 "forcing read-only mode");
>  		err = -EROFS;
> +		goto done;
>  	}
>  	if (read_only)
>  		goto done;
> -- 
> 2.25.4
>
Theodore Ts'o June 11, 2020, 2:59 p.m. UTC | #2
On Mon, Jun 01, 2020 at 01:47:08PM +0200, Jan Kara wrote:
> On Mon 01-06-20 15:34:04, yangerkun wrote:
> > Now the errcode from ext4_commit_super will overwrite EROFS exists in
> > ext4_setup_super. Actually, no need to call ext4_commit_super since we
> > will return EROFS. Fix it by goto done directly.
> > 
> > Fixes: c89128a00838 ("ext4: handle errors on ext4_commit_super")
> > Signed-off-by: yangerkun <yangerkun@huawei.com>
> 
> Yeah, makes sense. You can add:
> 
> Reviewed-by: Jan Kara <jack@suse.cz>

Thanks, applied.

					- Ted
diff mbox series

Patch

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index bf5fcb477f66..87c5611a4c67 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -2344,6 +2344,7 @@  static int ext4_setup_super(struct super_block *sb, struct ext4_super_block *es,
 		ext4_msg(sb, KERN_ERR, "revision level too high, "
 			 "forcing read-only mode");
 		err = -EROFS;
+		goto done;
 	}
 	if (read_only)
 		goto done;