]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: add proper safety check before resuming dev-replace
authorDavid Sterba <dsterba@suse.com>
Tue, 20 Mar 2018 18:51:04 +0000 (19:51 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 28 May 2018 16:07:24 +0000 (18:07 +0200)
commitac8caa76ff5370e7e9da5375b4978e0b6d2d9c67
treec47bd9d3bd18895b0e894a8303eb0f73cbd74a6b
parent859dc79d51984c21b3fe814a2fdfd2770cb06d40
btrfs: add proper safety check before resuming dev-replace

The device replace is paused by unmount or read only remount, and
resumed on next mount or write remount.

The exclusive status should be checked properly as it's a global
invariant and we must not allow 2 operations run. In this case, the
balance can be also paused and resumed under same conditions. It's
always checked first so dev-replace could see the EXCL_OP already taken,
BUT, the ioctl would never let start both at the same time.

Replace the WARN_ON with message and return 0, indicating no error as
this is purely theoretical and the user will be informed. Resolving that
manually should be possible by waiting for the other operation to finish
or cancel the paused state.

Reviewed-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/dev-replace.c