mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 12:42:02 +00:00
f2fs: fix write pointers all the time
Even if the roll forward recovery stopped due to any error, we have to fix the write pointers in order to mount the disk from the previous checkpoint. Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
7af2df0f67
commit
4d4c593893
@ -863,7 +863,6 @@ int f2fs_recover_fsync_data(struct f2fs_sb_info *sbi, bool check_only)
|
||||
int ret = 0;
|
||||
unsigned long s_flags = sbi->sb->s_flags;
|
||||
bool need_writecp = false;
|
||||
bool fix_curseg_write_pointer = false;
|
||||
|
||||
if (is_sbi_flag_set(sbi, SBI_IS_WRITABLE))
|
||||
f2fs_info(sbi, "recover fsync data on readonly fs");
|
||||
@ -894,8 +893,6 @@ int f2fs_recover_fsync_data(struct f2fs_sb_info *sbi, bool check_only)
|
||||
else
|
||||
f2fs_bug_on(sbi, sbi->sb->s_flags & SB_ACTIVE);
|
||||
skip:
|
||||
fix_curseg_write_pointer = !check_only || list_empty(&inode_list);
|
||||
|
||||
destroy_fsync_dnodes(&inode_list, err);
|
||||
destroy_fsync_dnodes(&tmp_inode_list, err);
|
||||
|
||||
@ -913,11 +910,13 @@ skip:
|
||||
* and the f2fs is not read only, check and fix zoned block devices'
|
||||
* write pointer consistency.
|
||||
*/
|
||||
if (!err && fix_curseg_write_pointer && !f2fs_readonly(sbi->sb) &&
|
||||
f2fs_sb_has_blkzoned(sbi)) {
|
||||
err = f2fs_fix_curseg_write_pointer(sbi);
|
||||
if (!err)
|
||||
err = f2fs_check_write_pointer(sbi);
|
||||
if (f2fs_sb_has_blkzoned(sbi) && !f2fs_readonly(sbi->sb)) {
|
||||
int err2 = f2fs_fix_curseg_write_pointer(sbi);
|
||||
|
||||
if (!err2)
|
||||
err2 = f2fs_check_write_pointer(sbi);
|
||||
if (err2)
|
||||
err = err2;
|
||||
ret = err;
|
||||
}
|
||||
|
||||
|
@ -4674,11 +4674,14 @@ reset_checkpoint:
|
||||
* If the f2fs is not readonly and fsync data recovery succeeds,
|
||||
* check zoned block devices' write pointer consistency.
|
||||
*/
|
||||
if (!err && !f2fs_readonly(sb) && f2fs_sb_has_blkzoned(sbi)) {
|
||||
err = f2fs_check_write_pointer(sbi);
|
||||
if (err)
|
||||
goto free_meta;
|
||||
if (f2fs_sb_has_blkzoned(sbi) && !f2fs_readonly(sb)) {
|
||||
int err2 = f2fs_check_write_pointer(sbi);
|
||||
|
||||
if (err2)
|
||||
err = err2;
|
||||
}
|
||||
if (err)
|
||||
goto free_meta;
|
||||
|
||||
f2fs_init_inmem_curseg(sbi);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user