diff options
author | Takashi Sato <t-sato@yk.jp.nec.com> | 2009-01-09 19:40:58 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-09 19:54:42 -0500 |
commit | c4be0c1dc4cdc37b175579be1460f15ac6495e9a (patch) | |
tree | 716ea88318211ed27cadcebda0fd85c1f8246edb /fs/jfs/super.c | |
parent | 69347a236b22c3962ea812511495e502dedfd50c (diff) |
filesystem freeze: add error handling of write_super_lockfs/unlockfs
Currently, ext3 in mainline Linux doesn't have the freeze feature which
suspends write requests. So, we cannot take a backup which keeps the
filesystem's consistency with the storage device's features (snapshot and
replication) while it is mounted.
In many case, a commercial filesystem (e.g. VxFS) has the freeze feature
and it would be used to get the consistent backup.
If Linux's standard filesystem ext3 has the freeze feature, we can do it
without a commercial filesystem.
So I have implemented the ioctls of the freeze feature.
I think we can take the consistent backup with the following steps.
1. Freeze the filesystem with the freeze ioctl.
2. Separate the replication volume or create the snapshot
with the storage device's feature.
3. Unfreeze the filesystem with the unfreeze ioctl.
4. Take the backup from the separated replication volume
or the snapshot.
This patch:
VFS:
Changed the type of write_super_lockfs and unlockfs from "void"
to "int" so that they can return an error.
Rename write_super_lockfs and unlockfs of the super block operation
freeze_fs and unfreeze_fs to avoid a confusion.
ext3, ext4, xfs, gfs2, jfs:
Changed the type of write_super_lockfs and unlockfs from "void"
to "int" so that write_super_lockfs returns an error if needed,
and unlockfs always returns 0.
reiserfs:
Changed the type of write_super_lockfs and unlockfs from "void"
to "int" so that they always return 0 (success) to keep a current behavior.
Signed-off-by: Takashi Sato <t-sato@yk.jp.nec.com>
Signed-off-by: Masayuki Hamaguchi <m-hamaguchi@ys.jp.nec.com>
Cc: <xfs-masters@oss.sgi.com>
Cc: <linux-ext4@vger.kernel.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Dave Kleikamp <shaggy@austin.ibm.com>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Alasdair G Kergon <agk@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/jfs/super.c')
-rw-r--r-- | fs/jfs/super.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/jfs/super.c b/fs/jfs/super.c index 0dae345e481b..b37d1f78b854 100644 --- a/fs/jfs/super.c +++ b/fs/jfs/super.c | |||
@@ -543,7 +543,7 @@ out_kfree: | |||
543 | return ret; | 543 | return ret; |
544 | } | 544 | } |
545 | 545 | ||
546 | static void jfs_write_super_lockfs(struct super_block *sb) | 546 | static int jfs_freeze(struct super_block *sb) |
547 | { | 547 | { |
548 | struct jfs_sb_info *sbi = JFS_SBI(sb); | 548 | struct jfs_sb_info *sbi = JFS_SBI(sb); |
549 | struct jfs_log *log = sbi->log; | 549 | struct jfs_log *log = sbi->log; |
@@ -553,9 +553,10 @@ static void jfs_write_super_lockfs(struct super_block *sb) | |||
553 | lmLogShutdown(log); | 553 | lmLogShutdown(log); |
554 | updateSuper(sb, FM_CLEAN); | 554 | updateSuper(sb, FM_CLEAN); |
555 | } | 555 | } |
556 | return 0; | ||
556 | } | 557 | } |
557 | 558 | ||
558 | static void jfs_unlockfs(struct super_block *sb) | 559 | static int jfs_unfreeze(struct super_block *sb) |
559 | { | 560 | { |
560 | struct jfs_sb_info *sbi = JFS_SBI(sb); | 561 | struct jfs_sb_info *sbi = JFS_SBI(sb); |
561 | struct jfs_log *log = sbi->log; | 562 | struct jfs_log *log = sbi->log; |
@@ -568,6 +569,7 @@ static void jfs_unlockfs(struct super_block *sb) | |||
568 | else | 569 | else |
569 | txResume(sb); | 570 | txResume(sb); |
570 | } | 571 | } |
572 | return 0; | ||
571 | } | 573 | } |
572 | 574 | ||
573 | static int jfs_get_sb(struct file_system_type *fs_type, | 575 | static int jfs_get_sb(struct file_system_type *fs_type, |
@@ -735,8 +737,8 @@ static const struct super_operations jfs_super_operations = { | |||
735 | .delete_inode = jfs_delete_inode, | 737 | .delete_inode = jfs_delete_inode, |
736 | .put_super = jfs_put_super, | 738 | .put_super = jfs_put_super, |
737 | .sync_fs = jfs_sync_fs, | 739 | .sync_fs = jfs_sync_fs, |
738 | .write_super_lockfs = jfs_write_super_lockfs, | 740 | .freeze_fs = jfs_freeze, |
739 | .unlockfs = jfs_unlockfs, | 741 | .unfreeze_fs = jfs_unfreeze, |
740 | .statfs = jfs_statfs, | 742 | .statfs = jfs_statfs, |
741 | .remount_fs = jfs_remount, | 743 | .remount_fs = jfs_remount, |
742 | .show_options = jfs_show_options, | 744 | .show_options = jfs_show_options, |