Commit 4a221953 authored by Steven Whitehouse's avatar Steven Whitehouse

[GFS2] Fix incorrect fs sync behaviour.

This adds a sync_fs superblock operation for GFS2 and removes
the journal flush from write_super in favour of sync_fs where it
ought to be. This is more or less identical to the way in which ext3
does this.

This bug was pointed out by Russell Cattelan <cattelan@redhat.com>

Cc: Russell Cattelan <cattelan@redhat.com>
Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
parent eb1dc33a
...@@ -138,16 +138,27 @@ static void gfs2_put_super(struct super_block *sb) ...@@ -138,16 +138,27 @@ static void gfs2_put_super(struct super_block *sb)
} }
/** /**
* gfs2_write_super - disk commit all incore transactions * gfs2_write_super
* @sb: the filesystem * @sb: the superblock
* *
* This function is called every time sync(2) is called.
* After this exits, all dirty buffers are synced.
*/ */
static void gfs2_write_super(struct super_block *sb) static void gfs2_write_super(struct super_block *sb)
{ {
sb->s_dirt = 0;
}
/**
* gfs2_sync_fs - sync the filesystem
* @sb: the superblock
*
* Flushes the log to disk.
*/
static int gfs2_sync_fs(struct super_block *sb, int wait)
{
sb->s_dirt = 0;
gfs2_log_flush(sb->s_fs_info, NULL); gfs2_log_flush(sb->s_fs_info, NULL);
return 0;
} }
/** /**
...@@ -458,6 +469,7 @@ struct super_operations gfs2_super_ops = { ...@@ -458,6 +469,7 @@ struct super_operations gfs2_super_ops = {
.delete_inode = gfs2_delete_inode, .delete_inode = gfs2_delete_inode,
.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,
.write_super_lockfs = gfs2_write_super_lockfs, .write_super_lockfs = gfs2_write_super_lockfs,
.unlockfs = gfs2_unlockfs, .unlockfs = gfs2_unlockfs,
.statfs = gfs2_statfs, .statfs = gfs2_statfs,
......
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