• David Sterba's avatar
    btrfs: add proper safety check before resuming dev-replace · 010a47bd
    David Sterba authored
    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: default avatarAnand Jain <anand.jain@oracle.com>
    Reviewed-by: default avatarNikolay Borisov <nborisov@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    010a47bd
dev-replace.c 31.7 KB