]> www.infradead.org Git - users/jedix/linux-maple.git/commit
btrfs: send: check for read-only send root under critical section
authorFilipe Manana <fdmanana@suse.com>
Wed, 6 Nov 2024 11:26:07 +0000 (11:26 +0000)
committerDavid Sterba <dsterba@suse.com>
Mon, 11 Nov 2024 13:34:23 +0000 (14:34 +0100)
commite82c936293aafb4f33b153c684c37291b3eed377
tree28cd75943c5dbf781ef5728eb69109bbb0dea4fc
parentdc058f5fda091abcdccc2487b48dbbc1cdde98d0
btrfs: send: check for read-only send root under critical section

We're checking if the send root is read-only without being under the
protection of the root's root_item_lock spinlock, which is what protects
the root's flags when clearing the read-only flag, done at
btrfs_ioctl_subvol_setflags(). Furthermore, it should be done in the
same critical section that increments the root's send_in_progress counter,
as btrfs_ioctl_subvol_setflags() clears the read-only flag in the same
critical section that checks the counter's value.

So fix this by moving the read-only check under the critical section
delimited by the root's root_item_lock which also increments the root's
send_in_progress counter.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/send.c