Commit c4be0c1d authored by Takashi Sato's avatar Takashi Sato Committed by Linus Torvalds

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: default avatarTakashi Sato <t-sato@yk.jp.nec.com>
Signed-off-by: default avatarMasayuki 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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 69347a23
...@@ -97,8 +97,8 @@ prototypes: ...@@ -97,8 +97,8 @@ prototypes:
void (*put_super) (struct super_block *); void (*put_super) (struct super_block *);
void (*write_super) (struct super_block *); void (*write_super) (struct super_block *);
int (*sync_fs)(struct super_block *sb, int wait); int (*sync_fs)(struct super_block *sb, int wait);
void (*write_super_lockfs) (struct super_block *); int (*freeze_fs) (struct super_block *);
void (*unlockfs) (struct super_block *); int (*unfreeze_fs) (struct super_block *);
int (*statfs) (struct dentry *, struct kstatfs *); int (*statfs) (struct dentry *, struct kstatfs *);
int (*remount_fs) (struct super_block *, int *, char *); int (*remount_fs) (struct super_block *, int *, char *);
void (*clear_inode) (struct inode *); void (*clear_inode) (struct inode *);
...@@ -119,8 +119,8 @@ delete_inode: no ...@@ -119,8 +119,8 @@ delete_inode: no
put_super: yes yes no put_super: yes yes no
write_super: no yes read write_super: no yes read
sync_fs: no no read sync_fs: no no read
write_super_lockfs: ? freeze_fs: ?
unlockfs: ? unfreeze_fs: ?
statfs: no no no statfs: no no no
remount_fs: yes yes maybe (see below) remount_fs: yes yes maybe (see below)
clear_inode: no clear_inode: no
......
...@@ -210,8 +210,8 @@ struct super_operations { ...@@ -210,8 +210,8 @@ struct super_operations {
void (*put_super) (struct super_block *); void (*put_super) (struct super_block *);
void (*write_super) (struct super_block *); void (*write_super) (struct super_block *);
int (*sync_fs)(struct super_block *sb, int wait); int (*sync_fs)(struct super_block *sb, int wait);
void (*write_super_lockfs) (struct super_block *); int (*freeze_fs) (struct super_block *);
void (*unlockfs) (struct super_block *); int (*unfreeze_fs) (struct super_block *);
int (*statfs) (struct dentry *, struct kstatfs *); int (*statfs) (struct dentry *, struct kstatfs *);
int (*remount_fs) (struct super_block *, int *, char *); int (*remount_fs) (struct super_block *, int *, char *);
void (*clear_inode) (struct inode *); void (*clear_inode) (struct inode *);
...@@ -270,11 +270,11 @@ or bottom half). ...@@ -270,11 +270,11 @@ or bottom half).
a superblock. The second parameter indicates whether the method a superblock. The second parameter indicates whether the method
should wait until the write out has been completed. Optional. should wait until the write out has been completed. Optional.
write_super_lockfs: called when VFS is locking a filesystem and freeze_fs: called when VFS is locking a filesystem and
forcing it into a consistent state. This method is currently forcing it into a consistent state. This method is currently
used by the Logical Volume Manager (LVM). used by the Logical Volume Manager (LVM).
unlockfs: called when VFS is unlocking a filesystem and making it writable unfreeze_fs: called when VFS is unlocking a filesystem and making it writable
again. again.
statfs: called when the VFS needs to get filesystem statistics. This statfs: called when the VFS needs to get filesystem statistics. This
......
...@@ -221,8 +221,8 @@ struct super_block *freeze_bdev(struct block_device *bdev) ...@@ -221,8 +221,8 @@ struct super_block *freeze_bdev(struct block_device *bdev)
sync_blockdev(sb->s_bdev); sync_blockdev(sb->s_bdev);
if (sb->s_op->write_super_lockfs) if (sb->s_op->freeze_fs)
sb->s_op->write_super_lockfs(sb); sb->s_op->freeze_fs(sb);
} }
sync_blockdev(bdev); sync_blockdev(bdev);
...@@ -242,8 +242,8 @@ void thaw_bdev(struct block_device *bdev, struct super_block *sb) ...@@ -242,8 +242,8 @@ void thaw_bdev(struct block_device *bdev, struct super_block *sb)
if (sb) { if (sb) {
BUG_ON(sb->s_bdev != bdev); BUG_ON(sb->s_bdev != bdev);
if (sb->s_op->unlockfs) if (sb->s_op->unfreeze_fs)
sb->s_op->unlockfs(sb); sb->s_op->unfreeze_fs(sb);
sb->s_frozen = SB_UNFROZEN; sb->s_frozen = SB_UNFROZEN;
smp_wmb(); smp_wmb();
wake_up(&sb->s_wait_unfrozen); wake_up(&sb->s_wait_unfrozen);
......
...@@ -48,8 +48,8 @@ static int ext3_load_journal(struct super_block *, struct ext3_super_block *, ...@@ -48,8 +48,8 @@ static int ext3_load_journal(struct super_block *, struct ext3_super_block *,
unsigned long journal_devnum); unsigned long journal_devnum);
static int ext3_create_journal(struct super_block *, struct ext3_super_block *, static int ext3_create_journal(struct super_block *, struct ext3_super_block *,
unsigned int); unsigned int);
static void ext3_commit_super (struct super_block * sb, static int ext3_commit_super(struct super_block *sb,
struct ext3_super_block * es, struct ext3_super_block *es,
int sync); int sync);
static void ext3_mark_recovery_complete(struct super_block * sb, static void ext3_mark_recovery_complete(struct super_block * sb,
struct ext3_super_block * es); struct ext3_super_block * es);
...@@ -60,9 +60,9 @@ static const char *ext3_decode_error(struct super_block * sb, int errno, ...@@ -60,9 +60,9 @@ static const char *ext3_decode_error(struct super_block * sb, int errno,
char nbuf[16]); char nbuf[16]);
static int ext3_remount (struct super_block * sb, int * flags, char * data); static int ext3_remount (struct super_block * sb, int * flags, char * data);
static int ext3_statfs (struct dentry * dentry, struct kstatfs * buf); static int ext3_statfs (struct dentry * dentry, struct kstatfs * buf);
static void ext3_unlockfs(struct super_block *sb); static int ext3_unfreeze(struct super_block *sb);
static void ext3_write_super (struct super_block * sb); static void ext3_write_super (struct super_block * sb);
static void ext3_write_super_lockfs(struct super_block *sb); static int ext3_freeze(struct super_block *sb);
/* /*
* Wrappers for journal_start/end. * Wrappers for journal_start/end.
...@@ -759,8 +759,8 @@ static const struct super_operations ext3_sops = { ...@@ -759,8 +759,8 @@ static const struct super_operations ext3_sops = {
.put_super = ext3_put_super, .put_super = ext3_put_super,
.write_super = ext3_write_super, .write_super = ext3_write_super,
.sync_fs = ext3_sync_fs, .sync_fs = ext3_sync_fs,
.write_super_lockfs = ext3_write_super_lockfs, .freeze_fs = ext3_freeze,
.unlockfs = ext3_unlockfs, .unfreeze_fs = ext3_unfreeze,
.statfs = ext3_statfs, .statfs = ext3_statfs,
.remount_fs = ext3_remount, .remount_fs = ext3_remount,
.clear_inode = ext3_clear_inode, .clear_inode = ext3_clear_inode,
...@@ -2311,21 +2311,23 @@ static int ext3_create_journal(struct super_block * sb, ...@@ -2311,21 +2311,23 @@ static int ext3_create_journal(struct super_block * sb,
return 0; return 0;
} }
static void ext3_commit_super (struct super_block * sb, static int ext3_commit_super(struct super_block *sb,
struct ext3_super_block * es, struct ext3_super_block *es,
int sync) int sync)
{ {
struct buffer_head *sbh = EXT3_SB(sb)->s_sbh; struct buffer_head *sbh = EXT3_SB(sb)->s_sbh;
int error = 0;
if (!sbh) if (!sbh)
return; return error;
es->s_wtime = cpu_to_le32(get_seconds()); es->s_wtime = cpu_to_le32(get_seconds());
es->s_free_blocks_count = cpu_to_le32(ext3_count_free_blocks(sb)); es->s_free_blocks_count = cpu_to_le32(ext3_count_free_blocks(sb));
es->s_free_inodes_count = cpu_to_le32(ext3_count_free_inodes(sb)); es->s_free_inodes_count = cpu_to_le32(ext3_count_free_inodes(sb));
BUFFER_TRACE(sbh, "marking dirty"); BUFFER_TRACE(sbh, "marking dirty");
mark_buffer_dirty(sbh); mark_buffer_dirty(sbh);
if (sync) if (sync)
sync_dirty_buffer(sbh); error = sync_dirty_buffer(sbh);
return error;
} }
...@@ -2439,12 +2441,14 @@ static int ext3_sync_fs(struct super_block *sb, int wait) ...@@ -2439,12 +2441,14 @@ static int ext3_sync_fs(struct super_block *sb, int wait)
* LVM calls this function before a (read-only) snapshot is created. This * LVM calls this function before a (read-only) snapshot is created. This
* gives us a chance to flush the journal completely and mark the fs clean. * gives us a chance to flush the journal completely and mark the fs clean.
*/ */
static void ext3_write_super_lockfs(struct super_block *sb) static int ext3_freeze(struct super_block *sb)
{ {
int error = 0;
journal_t *journal;
sb->s_dirt = 0; sb->s_dirt = 0;
if (!(sb->s_flags & MS_RDONLY)) { if (!(sb->s_flags & MS_RDONLY)) {
journal_t *journal = EXT3_SB(sb)->s_journal; journal = EXT3_SB(sb)->s_journal;
/* Now we set up the journal barrier. */ /* Now we set up the journal barrier. */
journal_lock_updates(journal); journal_lock_updates(journal);
...@@ -2453,20 +2457,28 @@ static void ext3_write_super_lockfs(struct super_block *sb) ...@@ -2453,20 +2457,28 @@ static void ext3_write_super_lockfs(struct super_block *sb)
* We don't want to clear needs_recovery flag when we failed * We don't want to clear needs_recovery flag when we failed
* to flush the journal. * to flush the journal.
*/ */
if (journal_flush(journal) < 0) error = journal_flush(journal);
return; if (error < 0)
goto out;
/* Journal blocked and flushed, clear needs_recovery flag. */ /* Journal blocked and flushed, clear needs_recovery flag. */
EXT3_CLEAR_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER); EXT3_CLEAR_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER);
ext3_commit_super(sb, EXT3_SB(sb)->s_es, 1); error = ext3_commit_super(sb, EXT3_SB(sb)->s_es, 1);
if (error)
goto out;
} }
return 0;
out:
journal_unlock_updates(journal);
return error;
} }
/* /*
* Called by LVM after the snapshot is done. We need to reset the RECOVER * Called by LVM after the snapshot is done. We need to reset the RECOVER
* flag here, even though the filesystem is not technically dirty yet. * flag here, even though the filesystem is not technically dirty yet.
*/ */
static void ext3_unlockfs(struct super_block *sb) static int ext3_unfreeze(struct super_block *sb)
{ {
if (!(sb->s_flags & MS_RDONLY)) { if (!(sb->s_flags & MS_RDONLY)) {
lock_super(sb); lock_super(sb);
...@@ -2476,6 +2488,7 @@ static void ext3_unlockfs(struct super_block *sb) ...@@ -2476,6 +2488,7 @@ static void ext3_unlockfs(struct super_block *sb)
unlock_super(sb); unlock_super(sb);
journal_unlock_updates(EXT3_SB(sb)->s_journal); journal_unlock_updates(EXT3_SB(sb)->s_journal);
} }
return 0;
} }
static int ext3_remount (struct super_block * sb, int * flags, char * data) static int ext3_remount (struct super_block * sb, int * flags, char * data)
......
...@@ -51,7 +51,7 @@ struct proc_dir_entry *ext4_proc_root; ...@@ -51,7 +51,7 @@ struct proc_dir_entry *ext4_proc_root;
static int ext4_load_journal(struct super_block *, struct ext4_super_block *, static int ext4_load_journal(struct super_block *, struct ext4_super_block *,
unsigned long journal_devnum); unsigned long journal_devnum);
static void ext4_commit_super(struct super_block *sb, static int ext4_commit_super(struct super_block *sb,
struct ext4_super_block *es, int sync); struct ext4_super_block *es, int sync);
static void ext4_mark_recovery_complete(struct super_block *sb, static void ext4_mark_recovery_complete(struct super_block *sb,
struct ext4_super_block *es); struct ext4_super_block *es);
...@@ -62,9 +62,9 @@ static const char *ext4_decode_error(struct super_block *sb, int errno, ...@@ -62,9 +62,9 @@ static const char *ext4_decode_error(struct super_block *sb, int errno,
char nbuf[16]); char nbuf[16]);
static int ext4_remount(struct super_block *sb, int *flags, char *data); static int ext4_remount(struct super_block *sb, int *flags, char *data);
static int ext4_statfs(struct dentry *dentry, struct kstatfs *buf); static int ext4_statfs(struct dentry *dentry, struct kstatfs *buf);
static void ext4_unlockfs(struct super_block *sb); static int ext4_unfreeze(struct super_block *sb);
static void ext4_write_super(struct super_block *sb); static void ext4_write_super(struct super_block *sb);
static void ext4_write_super_lockfs(struct super_block *sb); static int ext4_freeze(struct super_block *sb);
ext4_fsblk_t ext4_block_bitmap(struct super_block *sb, ext4_fsblk_t ext4_block_bitmap(struct super_block *sb,
...@@ -978,8 +978,8 @@ static const struct super_operations ext4_sops = { ...@@ -978,8 +978,8 @@ static const struct super_operations ext4_sops = {
.put_super = ext4_put_super, .put_super = ext4_put_super,
.write_super = ext4_write_super, .write_super = ext4_write_super,
.sync_fs = ext4_sync_fs, .sync_fs = ext4_sync_fs,
.write_super_lockfs = ext4_write_super_lockfs, .freeze_fs = ext4_freeze,
.unlockfs = ext4_unlockfs, .unfreeze_fs = ext4_unfreeze,
.statfs = ext4_statfs, .statfs = ext4_statfs,
.remount_fs = ext4_remount, .remount_fs = ext4_remount,
.clear_inode = ext4_clear_inode, .clear_inode = ext4_clear_inode,
...@@ -2888,13 +2888,14 @@ static int ext4_load_journal(struct super_block *sb, ...@@ -2888,13 +2888,14 @@ static int ext4_load_journal(struct super_block *sb,
return 0; return 0;
} }
static void ext4_commit_super(struct super_block *sb, static int ext4_commit_super(struct super_block *sb,
struct ext4_super_block *es, int sync) struct ext4_super_block *es, int sync)
{ {
struct buffer_head *sbh = EXT4_SB(sb)->s_sbh; struct buffer_head *sbh = EXT4_SB(sb)->s_sbh;
int error = 0;
if (!sbh) if (!sbh)
return; return error;
if (buffer_write_io_error(sbh)) { if (buffer_write_io_error(sbh)) {
/* /*
* Oh, dear. A previous attempt to write the * Oh, dear. A previous attempt to write the
...@@ -2918,14 +2919,19 @@ static void ext4_commit_super(struct super_block *sb, ...@@ -2918,14 +2919,19 @@ static void ext4_commit_super(struct super_block *sb,
BUFFER_TRACE(sbh, "marking dirty"); BUFFER_TRACE(sbh, "marking dirty");
mark_buffer_dirty(sbh); mark_buffer_dirty(sbh);
if (sync) { if (sync) {
sync_dirty_buffer(sbh); error = sync_dirty_buffer(sbh);
if (buffer_write_io_error(sbh)) { if (error)
return error;
error = buffer_write_io_error(sbh);
if (error) {
printk(KERN_ERR "EXT4-fs: I/O error while writing " printk(KERN_ERR "EXT4-fs: I/O error while writing "
"superblock for %s.\n", sb->s_id); "superblock for %s.\n", sb->s_id);
clear_buffer_write_io_error(sbh); clear_buffer_write_io_error(sbh);
set_buffer_uptodate(sbh); set_buffer_uptodate(sbh);
} }
} }
return error;
} }
...@@ -3058,12 +3064,14 @@ static int ext4_sync_fs(struct super_block *sb, int wait) ...@@ -3058,12 +3064,14 @@ static int ext4_sync_fs(struct super_block *sb, int wait)
* LVM calls this function before a (read-only) snapshot is created. This * LVM calls this function before a (read-only) snapshot is created. This
* gives us a chance to flush the journal completely and mark the fs clean. * gives us a chance to flush the journal completely and mark the fs clean.
*/ */
static void ext4_write_super_lockfs(struct super_block *sb) static int ext4_freeze(struct super_block *sb)
{ {
int error = 0;
journal_t *journal;
sb->s_dirt = 0; sb->s_dirt = 0;
if (!(sb->s_flags & MS_RDONLY)) { if (!(sb->s_flags & MS_RDONLY)) {
journal_t *journal = EXT4_SB(sb)->s_journal; journal = EXT4_SB(sb)->s_journal;
if (journal) { if (journal) {
/* Now we set up the journal barrier. */ /* Now we set up the journal barrier. */
...@@ -3073,21 +3081,29 @@ static void ext4_write_super_lockfs(struct super_block *sb) ...@@ -3073,21 +3081,29 @@ static void ext4_write_super_lockfs(struct super_block *sb)
* We don't want to clear needs_recovery flag when we * We don't want to clear needs_recovery flag when we
* failed to flush the journal. * failed to flush the journal.
*/ */
if (jbd2_journal_flush(journal) < 0) error = jbd2_journal_flush(journal);
return; if (error < 0)
goto out;
} }
/* Journal blocked and flushed, clear needs_recovery flag. */ /* Journal blocked and flushed, clear needs_recovery flag. */
EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER); EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER);
ext4_commit_super(sb, EXT4_SB(sb)->s_es, 1); ext4_commit_super(sb, EXT4_SB(sb)->s_es, 1);
error = ext4_commit_super(sb, EXT4_SB(sb)->s_es, 1);
if (error)
goto out;
} }
return 0;
out:
jbd2_journal_unlock_updates(journal);
return error;
} }
/* /*
* Called by LVM after the snapshot is done. We need to reset the RECOVER * Called by LVM after the snapshot is done. We need to reset the RECOVER
* flag here, even though the filesystem is not technically dirty yet. * flag here, even though the filesystem is not technically dirty yet.
*/ */
static void ext4_unlockfs(struct super_block *sb) static int ext4_unfreeze(struct super_block *sb)
{ {
if (EXT4_SB(sb)->s_journal && !(sb->s_flags & MS_RDONLY)) { if (EXT4_SB(sb)->s_journal && !(sb->s_flags & MS_RDONLY)) {
lock_super(sb); lock_super(sb);
...@@ -3097,6 +3113,7 @@ static void ext4_unlockfs(struct super_block *sb) ...@@ -3097,6 +3113,7 @@ static void ext4_unlockfs(struct super_block *sb)
unlock_super(sb); unlock_super(sb);
jbd2_journal_unlock_updates(EXT4_SB(sb)->s_journal); jbd2_journal_unlock_updates(EXT4_SB(sb)->s_journal);
} }
return 0;
} }
static int ext4_remount(struct super_block *sb, int *flags, char *data) static int ext4_remount(struct super_block *sb, int *flags, char *data)
......
...@@ -211,18 +211,18 @@ static int gfs2_sync_fs(struct super_block *sb, int wait) ...@@ -211,18 +211,18 @@ static int gfs2_sync_fs(struct super_block *sb, int wait)
} }
/** /**
* gfs2_write_super_lockfs - prevent further writes to the filesystem * gfs2_freeze - prevent further writes to the filesystem
* @sb: the VFS structure for the filesystem * @sb: the VFS structure for the filesystem
* *
*/ */
static void gfs2_write_super_lockfs(struct super_block *sb) static int gfs2_freeze(struct super_block *sb)
{ {
struct gfs2_sbd *sdp = sb->s_fs_info; struct gfs2_sbd *sdp = sb->s_fs_info;
int error; int error;
if (test_bit(SDF_SHUTDOWN, &sdp->sd_flags)) if (test_bit(SDF_SHUTDOWN, &sdp->sd_flags))
return; return -EINVAL;
for (;;) { for (;;) {
error = gfs2_freeze_fs(sdp); error = gfs2_freeze_fs(sdp);
...@@ -242,17 +242,19 @@ static void gfs2_write_super_lockfs(struct super_block *sb) ...@@ -242,17 +242,19 @@ static void gfs2_write_super_lockfs(struct super_block *sb)
fs_err(sdp, "retrying...\n"); fs_err(sdp, "retrying...\n");
msleep(1000); msleep(1000);
} }
return 0;
} }
/** /**
* gfs2_unlockfs - reallow writes to the filesystem * gfs2_unfreeze - reallow writes to the filesystem
* @sb: the VFS structure for the filesystem * @sb: the VFS structure for the filesystem
* *
*/ */
static void gfs2_unlockfs(struct super_block *sb) static int gfs2_unfreeze(struct super_block *sb)
{ {
gfs2_unfreeze_fs(sb->s_fs_info); gfs2_unfreeze_fs(sb->s_fs_info);
return 0;
} }
/** /**
...@@ -688,8 +690,8 @@ const struct super_operations gfs2_super_ops = { ...@@ -688,8 +690,8 @@ const struct super_operations gfs2_super_ops = {
.put_super = gfs2_put_super, .put_super = gfs2_put_super,
.write_super = gfs2_write_super, .write_super = gfs2_write_super,
.sync_fs = gfs2_sync_fs, .sync_fs = gfs2_sync_fs,
.write_super_lockfs = gfs2_write_super_lockfs, .freeze_fs = gfs2_freeze,
.unlockfs = gfs2_unlockfs, .unfreeze_fs = gfs2_unfreeze,
.statfs = gfs2_statfs, .statfs = gfs2_statfs,
.remount_fs = gfs2_remount_fs, .remount_fs = gfs2_remount_fs,
.clear_inode = gfs2_clear_inode, .clear_inode = gfs2_clear_inode,
......
...@@ -543,7 +543,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -543,7 +543,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
return ret; return ret;
} }
static void jfs_write_super_lockfs(struct super_block *sb) static int jfs_freeze(struct super_block *sb)
{ {
struct jfs_sb_info *sbi = JFS_SBI(sb); struct jfs_sb_info *sbi = JFS_SBI(sb);
struct jfs_log *log = sbi->log; struct jfs_log *log = sbi->log;
...@@ -553,9 +553,10 @@ static void jfs_write_super_lockfs(struct super_block *sb) ...@@ -553,9 +553,10 @@ static void jfs_write_super_lockfs(struct super_block *sb)
lmLogShutdown(log); lmLogShutdown(log);
updateSuper(sb, FM_CLEAN); updateSuper(sb, FM_CLEAN);
} }
return 0;
} }
static void jfs_unlockfs(struct super_block *sb) static int jfs_unfreeze(struct super_block *sb)
{ {
struct jfs_sb_info *sbi = JFS_SBI(sb); struct jfs_sb_info *sbi = JFS_SBI(sb);
struct jfs_log *log = sbi->log; struct jfs_log *log = sbi->log;
...@@ -568,6 +569,7 @@ static void jfs_unlockfs(struct super_block *sb) ...@@ -568,6 +569,7 @@ static void jfs_unlockfs(struct super_block *sb)
else else
txResume(sb); txResume(sb);
} }
return 0;
} }
static int jfs_get_sb(struct file_system_type *fs_type, static int jfs_get_sb(struct file_system_type *fs_type,
...@@ -735,8 +737,8 @@ static const struct super_operations jfs_super_operations = { ...@@ -735,8 +737,8 @@ static const struct super_operations jfs_super_operations = {
.delete_inode = jfs_delete_inode, .delete_inode = jfs_delete_inode,
.put_super = jfs_put_super, .put_super = jfs_put_super,
.sync_fs = jfs_sync_fs, .sync_fs = jfs_sync_fs,
.write_super_lockfs = jfs_write_super_lockfs, .freeze_fs = jfs_freeze,
.unlockfs = jfs_unlockfs, .unfreeze_fs = jfs_unfreeze,
.statfs = jfs_statfs, .statfs = jfs_statfs,
.remount_fs = jfs_remount, .remount_fs = jfs_remount,
.show_options = jfs_show_options, .show_options = jfs_show_options,
......
...@@ -83,7 +83,7 @@ static void reiserfs_write_super(struct super_block *s) ...@@ -83,7 +83,7 @@ static void reiserfs_write_super(struct super_block *s)
reiserfs_sync_fs(s, 1); reiserfs_sync_fs(s, 1);
} }
static void reiserfs_write_super_lockfs(struct super_block *s) static int reiserfs_freeze(struct super_block *s)
{ {
struct reiserfs_transaction_handle th; struct reiserfs_transaction_handle th;
reiserfs_write_lock(s); reiserfs_write_lock(s);
...@@ -101,11 +101,13 @@ static void reiserfs_write_super_lockfs(struct super_block *s) ...@@ -101,11 +101,13 @@ static void reiserfs_write_super_lockfs(struct super_block *s)
} }
s->s_dirt = 0; s->s_dirt = 0;
reiserfs_write_unlock(s); reiserfs_write_unlock(s);
return 0;
} }
static void reiserfs_unlockfs(struct super_block *s) static int reiserfs_unfreeze(struct super_block *s)
{ {
reiserfs_allow_writes(s); reiserfs_allow_writes(s);
return 0;
} }
extern const struct in_core_key MAX_IN_CORE_KEY; extern const struct in_core_key MAX_IN_CORE_KEY;
...@@ -613,8 +615,8 @@ static const struct super_operations reiserfs_sops = { ...@@ -613,8 +615,8 @@ static const struct super_operations reiserfs_sops = {
.put_super = reiserfs_put_super, .put_super = reiserfs_put_super,
.write_super = reiserfs_write_super, .write_super = reiserfs_write_super,
.sync_fs = reiserfs_sync_fs, .sync_fs = reiserfs_sync_fs,
.write_super_lockfs = reiserfs_write_super_lockfs, .freeze_fs = reiserfs_freeze,
.unlockfs = reiserfs_unlockfs, .unfreeze_fs = reiserfs_unfreeze,
.statfs = reiserfs_statfs, .statfs = reiserfs_statfs,
.remount_fs = reiserfs_remount, .remount_fs = reiserfs_remount,
.show_options = generic_show_options, .show_options = generic_show_options,
......
...@@ -1269,14 +1269,14 @@ xfs_fs_remount( ...@@ -1269,14 +1269,14 @@ xfs_fs_remount(
* need to take care of the metadata. Once that's done write a dummy * need to take care of the metadata. Once that's done write a dummy
* record to dirty the log in case of a crash while frozen. * record to dirty the log in case of a crash while frozen.
*/ */
STATIC void STATIC int
xfs_fs_lockfs( xfs_fs_freeze(
struct super_block *sb) struct super_block *sb)
{ {
struct xfs_mount *mp = XFS_M(sb); struct xfs_mount *mp = XFS_M(sb);
xfs_quiesce_attr(mp); xfs_quiesce_attr(mp);
xfs_fs_log_dummy(mp); return -xfs_fs_log_dummy(mp);
} }
STATIC int STATIC int
...@@ -1557,7 +1557,7 @@ static struct super_operations xfs_super_operations = { ...@@ -1557,7 +1557,7 @@ static struct super_operations xfs_super_operations = {
.put_super = xfs_fs_put_super, .put_super = xfs_fs_put_super,
.write_super = xfs_fs_write_super, .write_super = xfs_fs_write_super,
.sync_fs = xfs_fs_sync_super, .sync_fs = xfs_fs_sync_super,
.write_super_lockfs = xfs_fs_lockfs, .freeze_fs = xfs_fs_freeze,
.statfs = xfs_fs_statfs, .statfs = xfs_fs_statfs,
.remount_fs = xfs_fs_remount, .remount_fs = xfs_fs_remount,
.show_options = xfs_fs_show_options, .show_options = xfs_fs_show_options,
......
...@@ -595,17 +595,19 @@ xfs_reserve_blocks( ...@@ -595,17 +595,19 @@ xfs_reserve_blocks(
return 0; return 0;
} }
void int
xfs_fs_log_dummy( xfs_fs_log_dummy(
xfs_mount_t *mp) xfs_mount_t *mp)
{ {
xfs_trans_t *tp; xfs_trans_t *tp;
xfs_inode_t *ip; xfs_inode_t *ip;
int error;
tp = _xfs_trans_alloc(mp, XFS_TRANS_DUMMY1); tp = _xfs_trans_alloc(mp, XFS_TRANS_DUMMY1);
if (xfs_trans_reserve(tp, 0, XFS_ICHANGE_LOG_RES(mp), 0, 0, 0)) { error = xfs_trans_reserve(tp, 0, XFS_ICHANGE_LOG_RES(mp), 0, 0, 0);
if (error) {
xfs_trans_cancel(tp, 0); xfs_trans_cancel(tp, 0);
return; return error;
} }
ip = mp->m_rootip; ip = mp->m_rootip;
...@@ -615,9 +617,10 @@ xfs_fs_log_dummy( ...@@ -615,9 +617,10 @@ xfs_fs_log_dummy(
xfs_trans_ihold(tp, ip); xfs_trans_ihold(tp, ip);
xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
xfs_trans_set_sync(tp); xfs_trans_set_sync(tp);
xfs_trans_commit(tp, 0); error = xfs_trans_commit(tp, 0);
xfs_iunlock(ip, XFS_ILOCK_EXCL); xfs_iunlock(ip, XFS_ILOCK_EXCL);
return error;
} }
int int
......
...@@ -25,6 +25,6 @@ extern int xfs_fs_counts(xfs_mount_t *mp, xfs_fsop_counts_t *cnt); ...@@ -25,6 +25,6 @@ extern int xfs_fs_counts(xfs_mount_t *mp, xfs_fsop_counts_t *cnt);
extern int xfs_reserve_blocks(xfs_mount_t *mp, __uint64_t *inval, extern int xfs_reserve_blocks(xfs_mount_t *mp, __uint64_t *inval,
xfs_fsop_resblks_t *outval); xfs_fsop_resblks_t *outval);
extern int xfs_fs_goingdown(xfs_mount_t *mp, __uint32_t inflags); extern int xfs_fs_goingdown(xfs_mount_t *mp, __uint32_t inflags);
extern void xfs_fs_log_dummy(xfs_mount_t *mp); extern int xfs_fs_log_dummy(xfs_mount_t *mp);
#endif /* __XFS_FSOPS_H__ */ #endif /* __XFS_FSOPS_H__ */
...@@ -1377,8 +1377,8 @@ struct super_operations { ...@@ -1377,8 +1377,8 @@ struct super_operations {
void (*put_super) (struct super_block *); void (*put_super) (struct super_block *);
void (*write_super) (struct super_block *); void (*write_super) (struct super_block *);
int (*sync_fs)(struct super_block *sb, int wait); int (*sync_fs)(struct super_block *sb, int wait);
void (*write_super_lockfs) (struct super_block *); int (*freeze_fs) (struct super_block *);
void (*unlockfs) (struct super_block *); int (*unfreeze_fs) (struct super_block *);
int (*statfs) (struct dentry *, struct kstatfs *); int (*statfs) (struct dentry *, struct kstatfs *);
int (*remount_fs) (struct super_block *, int *, char *); int (*remount_fs) (struct super_block *, int *, char *);
void (*clear_inode) (struct inode *); void (*clear_inode) (struct inode *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment