diff mbox

btrfs-progs: free-space-cache: Don't panic when free space cache is corrupted

Message ID 20180701024526.25740-1-wqu@suse.com (mailing list archive)
State New, archived
Headers show

Commit Message

Qu Wenruo July 1, 2018, 2:45 a.m. UTC
In btrfs_add_free_space(), if the free space to be added is already
here, we trigger ASSERT() which is just another BUG_ON().

Let's remove such BUG_ON() at all.

Reported-by: Lewis Diamond <me@lewisdiamond.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 free-space-cache.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Nikolay Borisov July 2, 2018, 7:40 a.m. UTC | #1
On  1.07.2018 05:45, Qu Wenruo wrote:
> In btrfs_add_free_space(), if the free space to be added is already
> here, we trigger ASSERT() which is just another BUG_ON().
> 
> Let's remove such BUG_ON() at all.
> 
> Reported-by: Lewis Diamond <me@lewisdiamond.com>
> Signed-off-by: Qu Wenruo <wqu@suse.com>

Reviewed-by: Nikolay Borisov <nborisov@suse.com>

> ---
>  free-space-cache.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/free-space-cache.c b/free-space-cache.c
> index 9b83a71ca59a..2ef2d307cc5d 100644
> --- a/free-space-cache.c
> +++ b/free-space-cache.c
> @@ -838,10 +838,8 @@ int btrfs_add_free_space(struct btrfs_free_space_ctl *ctl, u64 offset,
>  	try_merge_free_space(ctl, info);
>  
>  	ret = link_free_space(ctl, info);
> -	if (ret) {
> +	if (ret)
>  		printk(KERN_CRIT "btrfs: unable to add free space :%d\n", ret);
> -		BUG_ON(ret == -EEXIST);
> -	}
>  
>  	return ret;
>  }
> 
--
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
David Sterba July 2, 2018, 10:20 p.m. UTC | #2
On Sun, Jul 01, 2018 at 10:45:26AM +0800, Qu Wenruo wrote:
> In btrfs_add_free_space(), if the free space to be added is already
> here, we trigger ASSERT() which is just another BUG_ON().
> 
> Let's remove such BUG_ON() at all.
> 
> Reported-by: Lewis Diamond <me@lewisdiamond.com>
> Signed-off-by: Qu Wenruo <wqu@suse.com>

Applied, thanks.
--
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/free-space-cache.c b/free-space-cache.c
index 9b83a71ca59a..2ef2d307cc5d 100644
--- a/free-space-cache.c
+++ b/free-space-cache.c
@@ -838,10 +838,8 @@  int btrfs_add_free_space(struct btrfs_free_space_ctl *ctl, u64 offset,
 	try_merge_free_space(ctl, info);
 
 	ret = link_free_space(ctl, info);
-	if (ret) {
+	if (ret)
 		printk(KERN_CRIT "btrfs: unable to add free space :%d\n", ret);
-		BUG_ON(ret == -EEXIST);
-	}
 
 	return ret;
 }