Skip to content

Commit

Permalink
btrfs: Fix the bug that fs_info->pending_changes is never cleared.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Qu Wenruo authored and Chris Mason committed Jan 21, 2015
1 parent 6e1103a commit 6c9fe14
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/btrfs/transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -2118,7 +2118,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;

Expand Down

0 comments on commit 6c9fe14

Please sign in to comment.