aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/f2fs/super.c')
-rw-r--r--fs/f2fs/super.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 022b32a14f34..1db5ebe6692e 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -474,7 +474,7 @@ static int validate_superblock(struct super_block *sb,
474 if (!*raw_super_buf) { 474 if (!*raw_super_buf) {
475 f2fs_msg(sb, KERN_ERR, "unable to read %s superblock", 475 f2fs_msg(sb, KERN_ERR, "unable to read %s superblock",
476 super); 476 super);
477 return 1; 477 return -EIO;
478 } 478 }
479 479
480 *raw_super = (struct f2fs_super_block *) 480 *raw_super = (struct f2fs_super_block *)
@@ -486,7 +486,7 @@ static int validate_superblock(struct super_block *sb,
486 486
487 f2fs_msg(sb, KERN_ERR, "Can't find a valid F2FS filesystem " 487 f2fs_msg(sb, KERN_ERR, "Can't find a valid F2FS filesystem "
488 "in %s superblock", super); 488 "in %s superblock", super);
489 return 1; 489 return -EINVAL;
490} 490}
491 491
492static int f2fs_fill_super(struct super_block *sb, void *data, int silent) 492static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
@@ -509,9 +509,12 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
509 goto free_sbi; 509 goto free_sbi;
510 } 510 }
511 511
512 if (validate_superblock(sb, &raw_super, &raw_super_buf, 0)) { 512 err = validate_superblock(sb, &raw_super, &raw_super_buf, 0);
513 if (err) {
513 brelse(raw_super_buf); 514 brelse(raw_super_buf);
514 if (validate_superblock(sb, &raw_super, &raw_super_buf, 1)) 515 /* check secondary superblock when primary failed */
516 err = validate_superblock(sb, &raw_super, &raw_super_buf, 1);
517 if (err)
515 goto free_sb_buf; 518 goto free_sb_buf;
516 } 519 }
517 /* init some FS parameters */ 520 /* init some FS parameters */