diff mbox

btrfs: remove BUG_ON in btrfs_rm_dev_replace_free_srcdev()

Message ID 20171012090041.7438-1-anand.jain@oracle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Anand Jain Oct. 12, 2017, 9 a.m. UTC
That was only an extra check to tackle few bugs around this
area, now its save to remove it.

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

Comments

David Sterba Oct. 16, 2017, 2:45 p.m. UTC | #1
On Thu, Oct 12, 2017 at 05:00:41PM +0800, Anand Jain wrote:
> That was only an extra check to tackle few bugs around this
> area, now its save to remove it.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
>  fs/btrfs/volumes.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 332e00e72b86..0a5251a34d58 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -2015,16 +2015,12 @@ void btrfs_rm_dev_replace_free_srcdev(struct btrfs_fs_info *fs_info,
>  	}
>  
>  	btrfs_close_bdev(srcdev);
> -
>  	call_rcu(&srcdev->rcu, free_device);
>  
>  	/*
> -	 * unless fs_devices is seed fs, num_devices shouldn't go
> -	 * zero
> +	 * If this is no devs we rather delete the fs_devices
> +	 * which is true in case of single device seeding fs.

Can you please rephrase the first part of the comment? I'm not sure I
understand what it's trying to say.

>  	 */
> -	BUG_ON(!fs_devices->num_devices && !fs_devices->seeding);

I think we could still keep the check as an ASSERT.

> -
> -	/* if this is no devs we rather delete the fs_devices */
>  	if (!fs_devices->num_devices) {
>  		struct btrfs_fs_devices *tmp_fs_devices;
>  
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Anand Jain Oct. 16, 2017, 11:32 p.m. UTC | #2
On 10/16/2017 10:45 PM, David Sterba wrote:
> On Thu, Oct 12, 2017 at 05:00:41PM +0800, Anand Jain wrote:
>> That was only an extra check to tackle few bugs around this
>> area, now its save to remove it.
>>
>> Signed-off-by: Anand Jain <anand.jain@oracle.com>
>> ---
>>   fs/btrfs/volumes.c | 8 ++------
>>   1 file changed, 2 insertions(+), 6 deletions(-)
>>
>> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
>> index 332e00e72b86..0a5251a34d58 100644
>> --- a/fs/btrfs/volumes.c
>> +++ b/fs/btrfs/volumes.c
>> @@ -2015,16 +2015,12 @@ void btrfs_rm_dev_replace_free_srcdev(struct btrfs_fs_info *fs_info,
>>   	}
>>   
>>   	btrfs_close_bdev(srcdev);
>> -
>>   	call_rcu(&srcdev->rcu, free_device);
>>   
>>   	/*
>> -	 * unless fs_devices is seed fs, num_devices shouldn't go
>> -	 * zero
>> +	 * If this is no devs we rather delete the fs_devices
>> +	 * which is true in case of single device seeding fs.
> 
> Can you please rephrase the first part of the comment? I'm not sure I
> understand what it's trying to say.
> 
>>   	 */
>> -	BUG_ON(!fs_devices->num_devices && !fs_devices->seeding);
> 
> I think we could still keep the check as an ASSERT.

  OK. I have fixed these in V2.

Thanks, Anand

>> -
>> -	/* if this is no devs we rather delete the fs_devices */
>>   	if (!fs_devices->num_devices) {
>>   		struct btrfs_fs_devices *tmp_fs_devices;
>>   
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 332e00e72b86..0a5251a34d58 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -2015,16 +2015,12 @@  void btrfs_rm_dev_replace_free_srcdev(struct btrfs_fs_info *fs_info,
 	}
 
 	btrfs_close_bdev(srcdev);
-
 	call_rcu(&srcdev->rcu, free_device);
 
 	/*
-	 * unless fs_devices is seed fs, num_devices shouldn't go
-	 * zero
+	 * If this is no devs we rather delete the fs_devices
+	 * which is true in case of single device seeding fs.
 	 */
-	BUG_ON(!fs_devices->num_devices && !fs_devices->seeding);
-
-	/* if this is no devs we rather delete the fs_devices */
 	if (!fs_devices->num_devices) {
 		struct btrfs_fs_devices *tmp_fs_devices;