summaryrefslogtreecommitdiff
path: root/fs/nilfs2
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nilfs2')
-rw-r--r--fs/nilfs2/super.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c
index e543eda0d939..9926a1d6d225 100644
--- a/fs/nilfs2/super.c
+++ b/fs/nilfs2/super.c
@@ -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;
}