mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-08 19:09:57 +00:00
f2fs: fix to restrict mount condition on readonly block device
When we mount an unclean f2fs image in a readonly block device, let's
make mount() succeed only when there is no recoverable data in that
image, otherwise after mount(), file fsyned won't be recovered as user
expected.
Fixes: 938a184265 ("f2fs: give a warning only for readonly partition")
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
@@ -3966,10 +3966,18 @@ try_onemore:
|
|||||||
* previous checkpoint was not done by clean system shutdown.
|
* previous checkpoint was not done by clean system shutdown.
|
||||||
*/
|
*/
|
||||||
if (f2fs_hw_is_readonly(sbi)) {
|
if (f2fs_hw_is_readonly(sbi)) {
|
||||||
if (!is_set_ckpt_flags(sbi, CP_UMOUNT_FLAG))
|
if (!is_set_ckpt_flags(sbi, CP_UMOUNT_FLAG)) {
|
||||||
f2fs_err(sbi, "Need to recover fsync data, but write access unavailable");
|
err = f2fs_recover_fsync_data(sbi, true);
|
||||||
else
|
if (err > 0) {
|
||||||
f2fs_info(sbi, "write access unavailable, skipping recovery");
|
err = -EROFS;
|
||||||
|
f2fs_err(sbi, "Need to recover fsync data, but "
|
||||||
|
"write access unavailable, please try "
|
||||||
|
"mount w/ disable_roll_forward or norecovery");
|
||||||
|
}
|
||||||
|
if (err < 0)
|
||||||
|
goto free_meta;
|
||||||
|
}
|
||||||
|
f2fs_info(sbi, "write access unavailable, skipping recovery");
|
||||||
goto reset_checkpoint;
|
goto reset_checkpoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user