aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs/super.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2015-01-23 22:16:59 -0500
committerJaegeuk Kim <jaegeuk@kernel.org>2015-02-11 20:04:42 -0500
commit081d78c2fc4ab2fef4cdf1100dd22155c73f8657 (patch)
tree05d74a3b4845e636b539661709e241012ba472e1 /fs/f2fs/super.c
parent119ee9144534141822462e3e8a5ccc8dc537f712 (diff)
f2fs: should fail mount when trying to recover data on read-only dev
If device is read-only, we should not proceed data recovery. But, if the previous checkpoint was done by normal clean shutdown, it's safe to proceed the recovery, since there will be no data to be recovered. Reviewed-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/super.c')
-rw-r--r--fs/f2fs/super.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index bfeab3c81a48..1e92c2ea6bc1 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -1149,6 +1149,15 @@ try_onemore:
1149 1149
1150 /* recover fsynced data */ 1150 /* recover fsynced data */
1151 if (!test_opt(sbi, DISABLE_ROLL_FORWARD)) { 1151 if (!test_opt(sbi, DISABLE_ROLL_FORWARD)) {
1152 /*
1153 * mount should be failed, when device has readonly mode, and
1154 * previous checkpoint was not done by clean system shutdown.
1155 */
1156 if (bdev_read_only(sb->s_bdev) &&
1157 !is_set_ckpt_flags(sbi->ckpt, CP_UMOUNT_FLAG)) {
1158 err = -EROFS;
1159 goto free_kobj;
1160 }
1152 err = recover_fsync_data(sbi); 1161 err = recover_fsync_data(sbi);
1153 if (err) { 1162 if (err) {
1154 f2fs_msg(sb, KERN_ERR, 1163 f2fs_msg(sb, KERN_ERR,