btrfs: fix missing snapshot drew unlock when root is dead during swap activation
[ Upstream commit 9c803c474c6c002d8ade68ebe99026cc39c37f85 ]
When activating a swap file we acquire the root's snapshot drew lock and
then check if the root is dead, failing and returning with -EPERM if it's
dead but without unlocking the root's snapshot lock. Fix this by adding
the missing unlock.
Fixes: 60021bd754
("btrfs: prevent subvol with swapfile from being deleted")
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
641e9638aa
commit
b15437fb26
@ -11228,6 +11228,7 @@ static int btrfs_swap_activate(struct swap_info_struct *sis, struct file *file,
|
|||||||
if (btrfs_root_dead(root)) {
|
if (btrfs_root_dead(root)) {
|
||||||
spin_unlock(&root->root_item_lock);
|
spin_unlock(&root->root_item_lock);
|
||||||
|
|
||||||
|
btrfs_drew_write_unlock(&root->snapshot_lock);
|
||||||
btrfs_exclop_finish(fs_info);
|
btrfs_exclop_finish(fs_info);
|
||||||
btrfs_warn(fs_info,
|
btrfs_warn(fs_info,
|
||||||
"cannot activate swapfile because subvolume %llu is being deleted",
|
"cannot activate swapfile because subvolume %llu is being deleted",
|
||||||
|
Loading…
Reference in New Issue
Block a user