[7/9] btrfs: quiten warn if the replace is canceled at finish
diff mbox series

Message ID 1541591010-29789-8-git-send-email-anand.jain@oracle.com
State New
Headers show
Series
  • fix replace-start and replace-cancel racing
Related show

Commit Message

Anand Jain Nov. 7, 2018, 11:43 a.m. UTC
When we successfully cancel the replace its scrub returns -ECANCELED,
which then passed to btrfs_dev_replace_finishing(), it cleans up based
on the scrub returned status and propagates the same -ECANCELED back
the parent function. So skip the -ECANCELED error to log the WARN.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 fs/btrfs/dev-replace.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Nikolay Borisov Nov. 7, 2018, 12:17 p.m. UTC | #1
On 7.11.18 г. 13:43 ч., Anand Jain wrote:
> -	WARN_ON(ret);
> +	if (ret != -ECANCELED)
> +		WARN_ON(ret);

WARN_ON(ret && ret != -ECANCELED)
Anand Jain Nov. 8, 2018, 8:06 a.m. UTC | #2
On 11/07/2018 08:17 PM, Nikolay Borisov wrote:
> 
> 
> On 7.11.18 г. 13:43 ч., Anand Jain wrote:
>> -	WARN_ON(ret);
>> +	if (ret != -ECANCELED)
>> +		WARN_ON(ret);
> 
> WARN_ON(ret && ret != -ECANCELED)
> 

Will fix.
Thanks, Anand

Patch
diff mbox series

diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
index dae2b920f1a9..c14c41b70287 100644
--- a/fs/btrfs/dev-replace.c
+++ b/fs/btrfs/dev-replace.c
@@ -497,7 +497,7 @@  static int btrfs_dev_replace_start(struct btrfs_fs_info *fs_info,
 	ret = btrfs_dev_replace_finishing(fs_info, ret);
 	if (ret == -EINPROGRESS) {
 		ret = BTRFS_IOCTL_DEV_REPLACE_RESULT_SCRUB_INPROGRESS;
-	} else {
+	} else if (ret != -ECANCELED) {
 		WARN_ON(ret);
 	}
 
@@ -956,7 +956,8 @@  static int btrfs_dev_replace_kthread(void *data)
 			      btrfs_device_get_total_bytes(dev_replace->srcdev),
 			      &dev_replace->scrub_progress, 0, 1);
 	ret = btrfs_dev_replace_finishing(fs_info, ret);
-	WARN_ON(ret);
+	if (ret != -ECANCELED)
+		WARN_ON(ret);
 
 	clear_bit(BTRFS_FS_EXCL_OP, &fs_info->flags);
 	return 0;