btrfs: add wrapper for conditional start of exclusive operation
authorDavid Sterba <dsterba@suse.com>
Fri, 14 May 2021 19:32:44 +0000 (21:32 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 21 Jun 2021 13:19:07 +0000 (15:19 +0200)
commit17aaa434ed39cbad48824ef4bb9ec3707091ae5b
tree4bbb2a49d93e70f5fd0f8363ad8ab3d904bd27ce
parent578bda9e17fdb6b6eaab1980f87dd1819b123da0
btrfs: add wrapper for conditional start of exclusive operation

To support optional cancellation of some operations, add helper that will
wrap all the combinations. In normal mode it's same as
btrfs_exclop_start, in cancellation mode it checks if it's already
running and request cancellation and waits until completion.

The error codes can be returned to to user space and semantics is not
changed, adding ECANCELED. This should be evaluated as an error and that
the operation has not completed and the operation should be restarted
or the filesystem status reviewed.

Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ioctl.c