diff options
author | Namjae Jeon <namjae.jeon@samsung.com> | 2013-03-17 04:26:53 -0400 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2013-03-20 05:30:15 -0400 |
commit | c0d39e65ba324390eb0ffb60661ab12104e5fcc7 (patch) | |
tree | 938dce83283d812e69ab3daea6c5f511210b3269 /fs/f2fs/super.c | |
parent | 7c909772f1222dd82098659da4d0c41d8a051790 (diff) |
f2fs: fix return values from validate superblock
validate super block is not returning with proper values.
When failure from sb_bread it should reflect there is an EIO otherwise
it should return of EINVAL.
Returning, '1' is not conveying proper message as the return type.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Amit Sahrawat <a.sahrawat@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs/super.c')
-rw-r--r-- | fs/f2fs/super.c | 11 |
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 | ||
492 | static int f2fs_fill_super(struct super_block *sb, void *data, int silent) | 492 | static 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 */ |