Commit cb3806ec authored by Stefan Behrens's avatar Stefan Behrens Committed by Chris Mason

Btrfs: fix race in check-integrity caused by usage of bitfield

The structure member mirror_num is modified concurrently to the
structure member is_iodone. This doesn't require any locking by
design, unless everything is stored in the same 32 bits of a
bit field. This was the case and xfstest 284 was able to
trigger false warnings from the checker code. This patch
seperates the bits and fixes the race.
Signed-off-by: default avatarStefan Behrens <sbehrens@giantdisaster.de>
Signed-off-by: default avatarChris Mason <chris.mason@fusionio.com>
parent b66f00da
...@@ -137,7 +137,7 @@ struct btrfsic_block { ...@@ -137,7 +137,7 @@ struct btrfsic_block {
unsigned int never_written:1; /* block was added because it was unsigned int never_written:1; /* block was added because it was
* referenced, not because it was * referenced, not because it was
* written */ * written */
unsigned int mirror_num:2; /* large enough to hold unsigned int mirror_num; /* large enough to hold
* BTRFS_SUPER_MIRROR_MAX */ * BTRFS_SUPER_MIRROR_MAX */
struct btrfsic_dev_state *dev_state; struct btrfsic_dev_state *dev_state;
u64 dev_bytenr; /* key, physical byte num on disk */ u64 dev_bytenr; /* key, physical byte num on disk */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment