btrfs: dev-replace: replace's scrub must not be running in suspended state
[sfrench/cifs-2.6.git] / fs / btrfs / dev-replace.c
index c0878ff8185a803e69024d5c13498855e2d594fd..a84affa425d4b0fa1e17fa89ca2253f2534f4264 100644 (file)
@@ -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)) {