Skip to content

Commit fe97e2e

Browse files
asjkdave
authored andcommitted
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 <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent b47dda2 commit fe97e2e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

fs/btrfs/dev-replace.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,9 @@ int btrfs_dev_replace_cancel(struct btrfs_fs_info *fs_info)
840840

841841
btrfs_dev_replace_write_unlock(dev_replace);
842842

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

845847
trans = btrfs_start_transaction(root, 0);
846848
if (IS_ERR(trans)) {

0 commit comments

Comments
 (0)