summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2016-03-23 18:42:01 +0100
committerJaegeuk Kim <jaegeuk@kernel.org>2016-04-15 17:49:47 +0200
commitf2353d7bd4221dfe0e230c5be49038d4a57d97e9 (patch)
tree8e345ad89b07da81fe2792b3c2ccd51c1f21d169 /fs
parentMerge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/ker... (diff)
downloadlinux-f2353d7bd4221dfe0e230c5be49038d4a57d97e9.tar.xz
linux-f2353d7bd4221dfe0e230c5be49038d4a57d97e9.zip
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: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/f2fs/super.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 006f87d69921..ffe4616376ca 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -1298,6 +1298,9 @@ int f2fs_commit_super(struct f2fs_sb_info *sbi, bool recover)
struct buffer_head *bh;
int err;
+ if (f2fs_readonly(sbi->sb) || bdev_read_only(sbi->sb->s_bdev))
+ return -EROFS;
+
/* write back-up superblock first */
bh = sb_getblk(sbi->sb, sbi->valid_super_block ? 0: 1);
if (!bh)
@@ -1565,7 +1568,7 @@ try_onemore:
kfree(options);
/* recover broken superblock */
- if (recovery && !f2fs_readonly(sb) && !bdev_read_only(sb->s_bdev)) {
+ if (recovery) {
err = f2fs_commit_super(sbi, true);
f2fs_msg(sb, KERN_INFO,
"Try to recover %dth superblock, ret: %ld",