Icenowy Zheng 95bcc0d980 f2fs: use EINVAL for superblock with invalid magic
[ Upstream commit 38fb6d0ea34299d97b031ed64fe994158b6f8eb3 ]

The kernel mount_block_root() function expects -EACESS or -EINVAL for a
unmountable filesystem when trying to mount the root with different
filesystem types.

However, in 5.3-rc1 the behavior when F2FS code cannot find valid block
changed to return -EFSCORRUPTED(-EUCLEAN), and this error code makes
mount_block_root() fail when trying to probe F2FS.

When the magic number of the superblock mismatches, it has a high
probability that it's just not a F2FS. In this case return -EINVAL seems
to be a better result, and this return value can make mount_block_root()
probing work again.

Return -EINVAL when the superblock has magic mismatch, -EFSCORRUPTED in
other cases (the magic matches but the superblock cannot be recognized).

Fixes: 10f966bbf521 ("f2fs: use generic EFSBADCRC/EFSCORRUPTED")
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-10-17 13:44:47 -07:00
..
2019-08-06 19:06:51 +02:00
2018-12-17 09:24:41 +01:00
2018-08-17 16:20:28 -07:00
2018-08-15 22:47:23 -07:00
2018-08-17 16:20:27 -07:00
2019-10-07 18:56:59 +02:00
2018-08-18 11:44:53 -07:00
2019-05-02 09:58:59 +02:00
2018-07-03 16:44:45 -04:00
2018-08-21 18:19:09 -07:00
2018-08-21 18:19:09 -07:00