Skip to content

Commit

Permalink
btrfs: dev-replace: replace's scrub must not be running in suspended …
Browse files Browse the repository at this point in the history
…state

When the replace state is in the suspended state, btrfs_scrub_cancel()
should fail with -ENOTCONN as there is no scrub running. As a safety
catch check if btrfs_scrub_cancel() returns -ENOTCONN and assert if it
doesn't.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
  • Loading branch information
Anand Jain authored and David Sterba committed Dec 17, 2018
1 parent b47dda2 commit fe97e2e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/btrfs/dev-replace.c
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,9 @@ int btrfs_dev_replace_cancel(struct btrfs_fs_info *fs_info)

btrfs_dev_replace_write_unlock(dev_replace);

btrfs_scrub_cancel(fs_info);
/* Scrub for replace must not be running in suspended state */
ret = btrfs_scrub_cancel(fs_info);
ASSERT(ret != -ENOTCONN);

trans = btrfs_start_transaction(root, 0);
if (IS_ERR(trans)) {
Expand Down

0 comments on commit fe97e2e

Please sign in to comment.