From: Artem Bityutskiy <Artem.Bityutskiy@xxxxxxxxx> When synchronizing the file-system, hfs first initiates the SB write (a) and then marks the superblock as clean (b). However, meanwhile (between (a) and (b)) someone else can modify the superblock and mark it as dirty. This would be a race condition, and the result would be that we'd end up with a modified superblock which would nevertheless be marked as clean (because of (b)). This means that 'sync_supers()' would never call our '->write_super()', at least not until yet another SB change happens. This patch fixes this race condition by marking the superblock as clean before initiating the write operation. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@xxxxxxxxx> --- fs/hfs/mdb.c | 1 + fs/hfs/super.c | 3 --- 2 files changed, 1 insertions(+), 3 deletions(-) diff --git a/fs/hfs/mdb.c b/fs/hfs/mdb.c index 86428f5..957945e 100644 --- a/fs/hfs/mdb.c +++ b/fs/hfs/mdb.c @@ -260,6 +260,7 @@ void hfs_mdb_commit(struct super_block *sb) { struct hfs_mdb *mdb = HFS_SB(sb)->mdb; + sb_mark_clean(sb); if (test_and_clear_bit(HFS_FLG_MDB_DIRTY, &HFS_SB(sb)->flags)) { /* These parameters may have been modified, so write them back */ mdb->drLsMod = hfs_mtime(); diff --git a/fs/hfs/super.c b/fs/hfs/super.c index bf71f6f..2f062ea 100644 --- a/fs/hfs/super.c +++ b/fs/hfs/super.c @@ -52,8 +52,6 @@ MODULE_LICENSE("GPL"); static void hfs_write_super(struct super_block *sb) { lock_super(sb); - sb_mark_clean(sb); - /* sync everything to the buffers */ if (!(sb->s_flags & MS_RDONLY)) hfs_mdb_commit(sb); @@ -64,7 +62,6 @@ static int hfs_sync_fs(struct super_block *sb, int wait) { lock_super(sb); hfs_mdb_commit(sb); - sb_mark_clean(sb); unlock_super(sb); return 0; -- 1.7.0.1 -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html