ext4: fix error code in ext4_commit_super

We should set the error code when ext4_commit_super check argument failed.
Found in code review.
Fixes: c4be0c1dc4 ("filesystem freeze: add error handling of write_super_lockfs/unlockfs").

Cc: stable@kernel.org
Signed-off-by: Fengnan Chang <changfengnan@vivo.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Link: https://lore.kernel.org/r/20210402101631.561-1-changfengnan@vivo.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
Fengnan Chang 2021-04-02 18:16:31 +08:00 committed by Theodore Ts'o
parent ac2f7ca51b
commit f88f1466e2

View File

@ -5585,8 +5585,10 @@ static int ext4_commit_super(struct super_block *sb)
struct buffer_head *sbh = EXT4_SB(sb)->s_sbh;
int error = 0;
if (!sbh || block_device_ejected(sb))
return error;
if (!sbh)
return -EINVAL;
if (block_device_ejected(sb))
return -ENODEV;
ext4_update_super(sb);