diff options
Diffstat (limited to 'fs/nilfs2/the_nilfs.c')
-rw-r--r-- | fs/nilfs2/the_nilfs.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/fs/nilfs2/the_nilfs.c b/fs/nilfs2/the_nilfs.c index 890a8d3886cf..6241e1722efc 100644 --- a/fs/nilfs2/the_nilfs.c +++ b/fs/nilfs2/the_nilfs.c | |||
@@ -264,8 +264,14 @@ int load_nilfs(struct the_nilfs *nilfs, struct nilfs_sb_info *sbi) | |||
264 | int valid_fs = nilfs_valid_fs(nilfs); | 264 | int valid_fs = nilfs_valid_fs(nilfs); |
265 | int err; | 265 | int err; |
266 | 266 | ||
267 | if (nilfs_loaded(nilfs)) | 267 | if (nilfs_loaded(nilfs)) { |
268 | return 0; | 268 | if (valid_fs || |
269 | ((s_flags & MS_RDONLY) && nilfs_test_opt(sbi, NORECOVERY))) | ||
270 | return 0; | ||
271 | printk(KERN_ERR "NILFS: the filesystem is in an incomplete " | ||
272 | "recovery state.\n"); | ||
273 | return -EINVAL; | ||
274 | } | ||
269 | 275 | ||
270 | if (!valid_fs) { | 276 | if (!valid_fs) { |
271 | printk(KERN_WARNING "NILFS warning: mounting unchecked fs\n"); | 277 | printk(KERN_WARNING "NILFS warning: mounting unchecked fs\n"); |
@@ -295,6 +301,11 @@ int load_nilfs(struct the_nilfs *nilfs, struct nilfs_sb_info *sbi) | |||
295 | goto skip_recovery; | 301 | goto skip_recovery; |
296 | 302 | ||
297 | if (s_flags & MS_RDONLY) { | 303 | if (s_flags & MS_RDONLY) { |
304 | if (nilfs_test_opt(sbi, NORECOVERY)) { | ||
305 | printk(KERN_INFO "NILFS: norecovery option specified. " | ||
306 | "skipping roll-forward recovery\n"); | ||
307 | goto skip_recovery; | ||
308 | } | ||
298 | if (really_read_only) { | 309 | if (really_read_only) { |
299 | printk(KERN_ERR "NILFS: write access " | 310 | printk(KERN_ERR "NILFS: write access " |
300 | "unavailable, cannot proceed.\n"); | 311 | "unavailable, cannot proceed.\n"); |
@@ -302,6 +313,11 @@ int load_nilfs(struct the_nilfs *nilfs, struct nilfs_sb_info *sbi) | |||
302 | goto failed_unload; | 313 | goto failed_unload; |
303 | } | 314 | } |
304 | sbi->s_super->s_flags &= ~MS_RDONLY; | 315 | sbi->s_super->s_flags &= ~MS_RDONLY; |
316 | } else if (nilfs_test_opt(sbi, NORECOVERY)) { | ||
317 | printk(KERN_ERR "NILFS: recovery cancelled because norecovery " | ||
318 | "option was specified for a read/write mount\n"); | ||
319 | err = -EINVAL; | ||
320 | goto failed_unload; | ||
305 | } | 321 | } |
306 | 322 | ||
307 | err = nilfs_recover_logical_segments(nilfs, sbi, &ri); | 323 | err = nilfs_recover_logical_segments(nilfs, sbi, &ri); |