summaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorAnand Jain <anand.jain@oracle.com>2018-11-11 22:22:21 +0800
committerDavid Sterba <dsterba@suse.com>2018-12-17 14:51:35 +0100
commitfe97e2e173afb61f1bb889c45f9597102c9f4849 (patch)
treed5947fbc1a7f966ac30f9df28da139f2bdea05bf /fs/btrfs
parentb47dda2ef6d793b67fd5979032dcd106e3f0a5c9 (diff)
downloadlinux-fe97e2e173afb61f1bb889c45f9597102c9f4849.tar.bz2
btrfs: dev-replace: replace's scrub must not be running in suspended 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>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/dev-replace.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
index c0878ff8185a..a84affa425d4 100644
--- a/fs/btrfs/dev-replace.c
+++ b/fs/btrfs/dev-replace.c
@@ -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)) {