public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: make enough noise for fstests to catch extent buffer leakage
@ 2022-03-15 10:01 Qu Wenruo
  2022-03-15 11:45 ` Filipe Manana
  2022-03-15 20:05 ` David Sterba
  0 siblings, 2 replies; 3+ messages in thread
From: Qu Wenruo @ 2022-03-15 10:01 UTC (permalink / raw)
  To: linux-btrfs

Although we have btrfs_extent_buffer_leak_debug_check() (enabled by
CONFIG_BTRFS_DEBUG option) to detect and warn QA testers that we have
some extent buffer leakage, it's just pr_err(), not noisy enough for
fstests to cache.

So here we trigger a WARN_ON_ONCE() if the allocated_ebs list is not
empty.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 fs/btrfs/extent_io.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 78486bbd1ac9..593eafc30261 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -76,6 +76,7 @@ void btrfs_extent_buffer_leak_debug_check(struct btrfs_fs_info *fs_info)
 		return;
 
 	spin_lock_irqsave(&fs_info->eb_leak_lock, flags);
+	WARN_ON_ONCE(!list_empty(&fs_info->allocated_ebs));
 	while (!list_empty(&fs_info->allocated_ebs)) {
 		eb = list_first_entry(&fs_info->allocated_ebs,
 				      struct extent_buffer, leak_list);
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] btrfs: make enough noise for fstests to catch extent buffer leakage
  2022-03-15 10:01 [PATCH] btrfs: make enough noise for fstests to catch extent buffer leakage Qu Wenruo
@ 2022-03-15 11:45 ` Filipe Manana
  2022-03-15 20:05 ` David Sterba
  1 sibling, 0 replies; 3+ messages in thread
From: Filipe Manana @ 2022-03-15 11:45 UTC (permalink / raw)
  To: Qu Wenruo; +Cc: linux-btrfs

On Tue, Mar 15, 2022 at 06:01:33PM +0800, Qu Wenruo wrote:
> Although we have btrfs_extent_buffer_leak_debug_check() (enabled by
> CONFIG_BTRFS_DEBUG option) to detect and warn QA testers that we have
> some extent buffer leakage, it's just pr_err(), not noisy enough for
> fstests to cache.
> 
> So here we trigger a WARN_ON_ONCE() if the allocated_ebs list is not
> empty.
> 
> Signed-off-by: Qu Wenruo <wqu@suse.com>
> ---
>  fs/btrfs/extent_io.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
> index 78486bbd1ac9..593eafc30261 100644
> --- a/fs/btrfs/extent_io.c
> +++ b/fs/btrfs/extent_io.c
> @@ -76,6 +76,7 @@ void btrfs_extent_buffer_leak_debug_check(struct btrfs_fs_info *fs_info)
>  		return;
>  
>  	spin_lock_irqsave(&fs_info->eb_leak_lock, flags);
> +	WARN_ON_ONCE(!list_empty(&fs_info->allocated_ebs));

I would make it WARN_ON(), so that it's less likely to get unnoticed.

Anyway:

Reviewed-by: Filipe Manana <fdmanana@suse.com>

Thanks.

>  	while (!list_empty(&fs_info->allocated_ebs)) {
>  		eb = list_first_entry(&fs_info->allocated_ebs,
>  				      struct extent_buffer, leak_list);
> -- 
> 2.35.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] btrfs: make enough noise for fstests to catch extent buffer leakage
  2022-03-15 10:01 [PATCH] btrfs: make enough noise for fstests to catch extent buffer leakage Qu Wenruo
  2022-03-15 11:45 ` Filipe Manana
@ 2022-03-15 20:05 ` David Sterba
  1 sibling, 0 replies; 3+ messages in thread
From: David Sterba @ 2022-03-15 20:05 UTC (permalink / raw)
  To: Qu Wenruo; +Cc: linux-btrfs

On Tue, Mar 15, 2022 at 06:01:33PM +0800, Qu Wenruo wrote:
> Although we have btrfs_extent_buffer_leak_debug_check() (enabled by
> CONFIG_BTRFS_DEBUG option) to detect and warn QA testers that we have
> some extent buffer leakage, it's just pr_err(), not noisy enough for
> fstests to cache.
> 
> So here we trigger a WARN_ON_ONCE() if the allocated_ebs list is not
> empty.

I agree with Filipe that a WARN_ON is better here, changed and added to
misc-next, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-03-15 20:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-15 10:01 [PATCH] btrfs: make enough noise for fstests to catch extent buffer leakage Qu Wenruo
2022-03-15 11:45 ` Filipe Manana
2022-03-15 20:05 ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox