f2fs: give a chance to mount again when encountering errors
This patch gives another chance to try mount process when we encounter an error. This makes an effect on the roll-forward recovery failures as well. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
6f12ac25f0
commit
ed2e621a95
|
@ -902,8 +902,10 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
|
||||||
struct buffer_head *raw_super_buf;
|
struct buffer_head *raw_super_buf;
|
||||||
struct inode *root;
|
struct inode *root;
|
||||||
long err = -EINVAL;
|
long err = -EINVAL;
|
||||||
|
bool retry = true;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
try_onemore:
|
||||||
/* allocate memory for f2fs-specific super block info */
|
/* allocate memory for f2fs-specific super block info */
|
||||||
sbi = kzalloc(sizeof(struct f2fs_sb_info), GFP_KERNEL);
|
sbi = kzalloc(sizeof(struct f2fs_sb_info), GFP_KERNEL);
|
||||||
if (!sbi)
|
if (!sbi)
|
||||||
|
@ -1083,9 +1085,11 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
|
||||||
/* recover fsynced data */
|
/* recover fsynced data */
|
||||||
if (!test_opt(sbi, DISABLE_ROLL_FORWARD)) {
|
if (!test_opt(sbi, DISABLE_ROLL_FORWARD)) {
|
||||||
err = recover_fsync_data(sbi);
|
err = recover_fsync_data(sbi);
|
||||||
if (err)
|
if (err) {
|
||||||
f2fs_msg(sb, KERN_ERR,
|
f2fs_msg(sb, KERN_ERR,
|
||||||
"Cannot recover all fsync data errno=%ld", err);
|
"Cannot recover all fsync data errno=%ld", err);
|
||||||
|
goto free_kobj;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1126,6 +1130,13 @@ free_sb_buf:
|
||||||
brelse(raw_super_buf);
|
brelse(raw_super_buf);
|
||||||
free_sbi:
|
free_sbi:
|
||||||
kfree(sbi);
|
kfree(sbi);
|
||||||
|
|
||||||
|
/* give only one another chance */
|
||||||
|
if (retry) {
|
||||||
|
retry = !retry;
|
||||||
|
shrink_dcache_sb(sb);
|
||||||
|
goto try_onemore;
|
||||||
|
}
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue