]> 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>
Sun, 8 Nov 2026 06:07:55 +0000 (01:07 -0500)
commit6be49f123f19903b35220b3bddd7615a8913fe79
tree83b0fce88cc68b3c3ea696938a99c3a4ae1d009e
parentd735bd6b20f9231aa77c9161e0cfe1fc2f75e5af
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>
(cherry picked from btrfs for-next commit 9065b20db1369c882b790f1fb94faad7ef871028)
fs/btrfs/scrub.c