Commit f2353d7b authored by Jaegeuk Kim's avatar Jaegeuk Kim

f2fs: give RO message when recovering superblock

When one of superblocks is missing, f2fs recovers it with the valid one.
But, even if f2fs is mounted as RO, we'd better notify that too.
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 806fdcce
...@@ -1298,6 +1298,9 @@ int f2fs_commit_super(struct f2fs_sb_info *sbi, bool recover) ...@@ -1298,6 +1298,9 @@ int f2fs_commit_super(struct f2fs_sb_info *sbi, bool recover)
struct buffer_head *bh; struct buffer_head *bh;
int err; int err;
if (f2fs_readonly(sbi->sb) || bdev_read_only(sbi->sb->s_bdev))
return -EROFS;
/* write back-up superblock first */ /* write back-up superblock first */
bh = sb_getblk(sbi->sb, sbi->valid_super_block ? 0: 1); bh = sb_getblk(sbi->sb, sbi->valid_super_block ? 0: 1);
if (!bh) if (!bh)
...@@ -1565,7 +1568,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -1565,7 +1568,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
kfree(options); kfree(options);
/* recover broken superblock */ /* recover broken superblock */
if (recovery && !f2fs_readonly(sb) && !bdev_read_only(sb->s_bdev)) { if (recovery) {
err = f2fs_commit_super(sbi, true); err = f2fs_commit_super(sbi, true);
f2fs_msg(sb, KERN_INFO, f2fs_msg(sb, KERN_INFO,
"Try to recover %dth superblock, ret: %ld", "Try to recover %dth superblock, ret: %ld",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment