]> git.ipfire.org Git - people/ms/linux.git/commit - fs/btrfs/ioctl.c
btrfs: protect exclusive_operation by super_lock
authorDavid Sterba <dsterba@suse.com>
Fri, 14 May 2021 15:42:30 +0000 (17:42 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 21 Jun 2021 13:19:06 +0000 (15:19 +0200)
commit0d7ed32c1eebfa34e28d24930ea598a4492d289e
tree810d274da2a745f835dec62e2cf5bbee33f8ca21
parent24880be59c5abdb4f686e17fcf4414518d7fec31
btrfs: protect exclusive_operation by super_lock

The exclusive operation is now atomically checked and set using bit
operations. Switch it to protection by spinlock. The super block lock is
not frequently used and adding a new lock seems like an overkill so it
should be safe to reuse it.

The reason to use spinlock is to enhance the locking context so more
checks can be done, eg. allowing the same exclusive operation enter
the exclop section and cancel the running one. This will be used for
resize and device delete.

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ctree.h
fs/btrfs/ioctl.c