diff options
author | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2009-11-19 13:28:01 -0500 |
---|---|---|
committer | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2009-11-19 20:05:52 -0500 |
commit | 0234576d041b9b2cc7043691ea61d2c2ca597aaa (patch) | |
tree | 1fd5f397cf0a7cb010a3e383a715438e64582b65 /fs/nilfs2/the_nilfs.c | |
parent | a057d2c01161444c48b12a60351ae6c7135f6e61 (diff) |
nilfs2: add norecovery mount option
This adds "norecovery" mount option which disables temporal write
access to read-only mounts or snapshots during mount/recovery.
Without this option, write access will be even performed for those
types of mounts; the temporal write access is needed to mount root
file system read-only after an unclean shutdown.
This option will be helpful when user wants to prevent any write
access to the device.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Cc: Eric Sandeen <sandeen@redhat.com>
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); |