Skip to content
  • Ilya Dryomov's avatar
    Btrfs: make btrfs_rm_device() fail gracefully · 9b3517e9
    Ilya Dryomov authored
    
    
    If shrinking done as part of the online device removal fails add that
    device back to the allocation list and increment the rw_devices counter.
    This fixes two bugs:
    
    1) we could have a perfectly good device out of alloc list for no good
    reason;
    
    2) in the btrfs consisting of two devices, failure in btrfs_rm_device()
    could lead to a situation where it was impossible to remove any of the
    devices because of the "unable to remove the only writeable device"
    error.
    
    Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
    Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
    9b3517e9