]> git.hungrycats.org Git - linux/commit
btrfs: scrub: fix race between scrub and scrub progress ioctl
authorFilipe Manana <fdmanana@suse.com>
Fri, 16 Oct 2026 17:02:23 +0000 (18:02 +0100)
committerDavid Sterba <dsterba@suse.com>
Fri, 30 Oct 2026 20:36:17 +0000 (21:36 +0100)
commit9065b20db1369c882b790f1fb94faad7ef871028
treeabcbd2b495212ce801cc7e5715888c34f30d6613
parent9f618b59ff51ccefadc45c66ab4e88beffacf2be
btrfs: scrub: fix race between scrub and scrub progress ioctl

The scrub progress ioctl is copying the scrub progress stats without
acquiring the spinlock that protects it and a concurrent scrub can be
updating the stats at the same time which can lead to load tearing
issues. So take the spinlock when copying the progress stats.

Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Daniel Vacek <neelx@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/scrub.c