Skip to content

Commit

Permalink
nilfs2: fix disorder of nilfs_write_super in nilfs_sync_fs
Browse files Browse the repository at this point in the history
This fixes disorder of nilfs_write_super in nilfs_sync_fs.  Commiting
super block must be the end of the function so that every changes are
reflected.

->sync_fs() is not called frequently so this makes nilfs_sync_fs call
nilfs_commit_super instead of nilfs_write_super.

Signed-off-by: Jiro SEKIBA <jir@unicus.jp>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
  • Loading branch information
Jiro SEKIBA authored and Ryusuke Konishi committed Sep 14, 2009
1 parent ec5d66a commit 6233caa
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions fs/nilfs2/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,13 +385,19 @@ static void nilfs_write_super(struct super_block *sb)

static int nilfs_sync_fs(struct super_block *sb, int wait)
{
struct nilfs_sb_info *sbi = NILFS_SB(sb);
struct the_nilfs *nilfs = sbi->s_nilfs;
int err = 0;

nilfs_write_super(sb);

/* This function is called when super block should be written back */
if (wait)
err = nilfs_construct_segment(sb);

down_write(&nilfs->ns_sem);
if (sb->s_dirt)
nilfs_commit_super(sbi, 1);
up_write(&nilfs->ns_sem);

return err;
}

Expand Down

0 comments on commit 6233caa

Please sign in to comment.