Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 174716
b: refs/heads/master
c: 0234576
h: refs/heads/master
v: v3
  • Loading branch information
Ryusuke Konishi committed Nov 20, 2009
1 parent 4aac978 commit ce4eafc
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a057d2c01161444c48b12a60351ae6c7135f6e61
refs/heads/master: 0234576d041b9b2cc7043691ea61d2c2ca597aaa
4 changes: 4 additions & 0 deletions trunk/Documentation/filesystems/nilfs2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ order=strict Apply strict in-order semantics that preserves sequence
blocks. That means, it is guaranteed that no
overtaking of events occurs in the recovered file
system after a crash.
norecovery Disable recovery of the filesystem on mount.
This disables every write access on the device for
read-only mounts or snapshots. This option will fail
for r/w mounts on an unclean volume.

NILFS2 usage
============
Expand Down
16 changes: 15 additions & 1 deletion trunk/fs/nilfs2/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,8 @@ static int nilfs_show_options(struct seq_file *seq, struct vfsmount *vfs)
seq_printf(seq, ",errors=panic");
if (nilfs_test_opt(sbi, STRICT_ORDER))
seq_printf(seq, ",order=strict");
if (nilfs_test_opt(sbi, NORECOVERY))
seq_printf(seq, ",norecovery");

return 0;
}
Expand Down Expand Up @@ -547,7 +549,7 @@ static const struct export_operations nilfs_export_ops = {

enum {
Opt_err_cont, Opt_err_panic, Opt_err_ro,
Opt_nobarrier, Opt_snapshot, Opt_order,
Opt_nobarrier, Opt_snapshot, Opt_order, Opt_norecovery,
Opt_err,
};

Expand All @@ -558,6 +560,7 @@ static match_table_t tokens = {
{Opt_nobarrier, "nobarrier"},
{Opt_snapshot, "cp=%u"},
{Opt_order, "order=%s"},
{Opt_norecovery, "norecovery"},
{Opt_err, NULL}
};

Expand Down Expand Up @@ -608,6 +611,9 @@ static int parse_options(char *options, struct super_block *sb)
sbi->s_snapshot_cno = option;
nilfs_set_opt(sbi, SNAPSHOT);
break;
case Opt_norecovery:
nilfs_set_opt(sbi, NORECOVERY);
break;
default:
printk(KERN_ERR
"NILFS: Unrecognized mount option \"%s\"\n", p);
Expand Down Expand Up @@ -863,6 +869,14 @@ static int nilfs_remount(struct super_block *sb, int *flags, char *data)
goto restore_opts;
}

if (!nilfs_valid_fs(nilfs)) {
printk(KERN_WARNING "NILFS (device %s): couldn't "
"remount because the filesystem is in an "
"incomplete recovery state.\n", sb->s_id);
err = -EINVAL;
goto restore_opts;
}

if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY))
goto out;
if (*flags & MS_RDONLY) {
Expand Down
20 changes: 18 additions & 2 deletions trunk/fs/nilfs2/the_nilfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,14 @@ int load_nilfs(struct the_nilfs *nilfs, struct nilfs_sb_info *sbi)
int valid_fs = nilfs_valid_fs(nilfs);
int err;

if (nilfs_loaded(nilfs))
return 0;
if (nilfs_loaded(nilfs)) {
if (valid_fs ||
((s_flags & MS_RDONLY) && nilfs_test_opt(sbi, NORECOVERY)))
return 0;
printk(KERN_ERR "NILFS: the filesystem is in an incomplete "
"recovery state.\n");
return -EINVAL;
}

if (!valid_fs) {
printk(KERN_WARNING "NILFS warning: mounting unchecked fs\n");
Expand Down Expand Up @@ -295,13 +301,23 @@ int load_nilfs(struct the_nilfs *nilfs, struct nilfs_sb_info *sbi)
goto skip_recovery;

if (s_flags & MS_RDONLY) {
if (nilfs_test_opt(sbi, NORECOVERY)) {
printk(KERN_INFO "NILFS: norecovery option specified. "
"skipping roll-forward recovery\n");
goto skip_recovery;
}
if (really_read_only) {
printk(KERN_ERR "NILFS: write access "
"unavailable, cannot proceed.\n");
err = -EROFS;
goto failed_unload;
}
sbi->s_super->s_flags &= ~MS_RDONLY;
} else if (nilfs_test_opt(sbi, NORECOVERY)) {
printk(KERN_ERR "NILFS: recovery cancelled because norecovery "
"option was specified for a read/write mount\n");
err = -EINVAL;
goto failed_unload;
}

err = nilfs_recover_logical_segments(nilfs, sbi, &ri);
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/nilfs2_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ struct nilfs_super_root {
#define NILFS_MOUNT_BARRIER 0x1000 /* Use block barriers */
#define NILFS_MOUNT_STRICT_ORDER 0x2000 /* Apply strict in-order
semantics also for data */
#define NILFS_MOUNT_NORECOVERY 0x4000 /* Disable write access during
mount-time recovery */


/**
Expand Down

0 comments on commit ce4eafc

Please sign in to comment.