]> git.hungrycats.org Git - linux/commitdiff
btrfs: Fix the bug that fs_info->pending_changes is never cleared.
authorQu Wenruo <quwenruo@cn.fujitsu.com>
Tue, 20 Jan 2015 09:05:33 +0000 (17:05 +0800)
committerZygo Blaxell <zblaxell@serenity.furryterror.org>
Fri, 23 Jan 2015 13:25:42 +0000 (08:25 -0500)
Fs_info->pending_changes is never cleared since the original code uses
cmpxchg(&fs_info->pending_changes, 0, 0), which will only clear it if
pending_changes is already 0.

This will cause a lot of problem when mount it with inode_cache mount
option.
If the btrfs is mounted as inode_cache, pending_changes will always be
1, even when the fs is frozen.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Reviewed-by: David Sterba <dsterba@suse.cz>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
(cherry picked from commit 6c9fe14f9d64cc12401a825a60ec5c5723496ca4)

fs/btrfs/transaction.c

index e955342916d6fc9ab5adbdb2ea9020bbaa98afc1..54658b251c7d02793c3f28535f7b246e141e5c66 100644 (file)
@@ -2115,7 +2115,7 @@ void btrfs_apply_pending_changes(struct btrfs_fs_info *fs_info)
        unsigned long prev;
        unsigned long bit;
 
-       prev = cmpxchg(&fs_info->pending_changes, 0, 0);
+       prev = xchg(&fs_info->pending_changes, 0);
        if (!prev)
                return;