fix disorder of nilfs_write_super in nilfs_sync_fs.
commiting super block must be the end of the function
so that every chanages are reflected.

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

Signed-off-by: Jiro SEKIBA <[email protected]>
---
 fs/nilfs2/super.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c
index 63ab2d1..13614d8 100644
--- a/fs/nilfs2/super.c
+++ b/fs/nilfs2/super.c
@@ -384,12 +384,18 @@ static void nilfs_write_super(struct super_block *sb)
 static int nilfs_sync_fs(struct super_block *sb, int wait)
 {
        int err = 0;
-
-       nilfs_write_super(sb);
+       struct nilfs_sb_info *sbi = NILFS_SB(sb);
+       struct the_nilfs *nilfs = sbi->s_nilfs;
 
        /* 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(NILFS_SB(sb), 1);
+       up_write(&nilfs->ns_sem);
+
        return err;
 }
 
-- 
1.5.6.5

_______________________________________________
users mailing list
[email protected]
https://www.nilfs.org/mailman/listinfo/users

Reply via email to