Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH] btrfs-progs: Initialize btrfs_path before use
@ 2016-10-24 14:57 Goldwyn Rodrigues
  2016-10-24 15:06 ` Filipe Manana
  2016-10-24 15:14 ` Goldwyn Rodrigues
  0 siblings, 2 replies; 3+ messages in thread
From: Goldwyn Rodrigues @ 2016-10-24 14:57 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Goldwyn Rodrigues

From: Goldwyn Rodrigues <rgoldwyn@suse.com>

While performing an fsck, an assertion failure occurs because of reusing path in a loop.
ctree.c:1112: btrfs_search_slot: Warning: assertion `p->nodes[0] != NULL` failed, value 0

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>

diff --git a/cmds-check.c b/cmds-check.c
index 670ccd1..a6f281c 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -7541,6 +7541,7 @@ static int record_orphan_data_extents(struct btrfs_fs_info *fs_info,
 		key.objectid = dback->owner;
 		key.type = BTRFS_EXTENT_DATA_KEY;
 		key.offset = dback->offset;
+		btrfs_init_path(path);
 
 		ret = btrfs_search_slot(NULL, dest_root, &key, path, 0, 0);
 		/*

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

* Re: [PATCH] btrfs-progs: Initialize btrfs_path before use
  2016-10-24 14:57 [PATCH] btrfs-progs: Initialize btrfs_path before use Goldwyn Rodrigues
@ 2016-10-24 15:06 ` Filipe Manana
  2016-10-24 15:14 ` Goldwyn Rodrigues
  1 sibling, 0 replies; 3+ messages in thread
From: Filipe Manana @ 2016-10-24 15:06 UTC (permalink / raw)
  To: Goldwyn Rodrigues; +Cc: linux-btrfs@vger.kernel.org, Goldwyn Rodrigues

On Mon, Oct 24, 2016 at 3:57 PM, Goldwyn Rodrigues <rgoldwyn@suse.de> wrote:
> From: Goldwyn Rodrigues <rgoldwyn@suse.com>
>
> While performing an fsck, an assertion failure occurs because of reusing path in a loop.
> ctree.c:1112: btrfs_search_slot: Warning: assertion `p->nodes[0] != NULL` failed, value 0
>
> Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
>
> diff --git a/cmds-check.c b/cmds-check.c
> index 670ccd1..a6f281c 100644
> --- a/cmds-check.c
> +++ b/cmds-check.c
> @@ -7541,6 +7541,7 @@ static int record_orphan_data_extents(struct btrfs_fs_info *fs_info,
>                 key.objectid = dback->owner;
>                 key.type = BTRFS_EXTENT_DATA_KEY;
>                 key.offset = dback->offset;
> +               btrfs_init_path(path);

Hi Goldwyn,

You want to call btrfs_release_path(), otherwise you leak memory. And
it would be better placed before the 'continue' statement.

thanks

>
>                 ret = btrfs_search_slot(NULL, dest_root, &key, path, 0, 0);
>                 /*
> --
> 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



-- 
Filipe David Manana,

"People will forget what you said,
 people will forget what you did,
 but people will never forget how you made them feel."

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

* Re: [PATCH] btrfs-progs: Initialize btrfs_path before use
  2016-10-24 14:57 [PATCH] btrfs-progs: Initialize btrfs_path before use Goldwyn Rodrigues
  2016-10-24 15:06 ` Filipe Manana
@ 2016-10-24 15:14 ` Goldwyn Rodrigues
  1 sibling, 0 replies; 3+ messages in thread
From: Goldwyn Rodrigues @ 2016-10-24 15:14 UTC (permalink / raw)
  To: linux-btrfs



On 10/24/2016 09:57 AM, Goldwyn Rodrigues wrote:
> From: Goldwyn Rodrigues <rgoldwyn@suse.com>
> 
> While performing an fsck, an assertion failure occurs because of reusing path in a loop.
> ctree.c:1112: btrfs_search_slot: Warning: assertion `p->nodes[0] != NULL` failed, value 0
> 
> Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
> 
> diff --git a/cmds-check.c b/cmds-check.c
> index 670ccd1..a6f281c 100644
> --- a/cmds-check.c
> +++ b/cmds-check.c
> @@ -7541,6 +7541,7 @@ static int record_orphan_data_extents(struct btrfs_fs_info *fs_info,
>  		key.objectid = dback->owner;
>  		key.type = BTRFS_EXTENT_DATA_KEY;
>  		key.offset = dback->offset;
> +		btrfs_init_path(path);
>  
>  		ret = btrfs_search_slot(NULL, dest_root, &key, path, 0, 0);
>  		/*
> 

This is an incorrect fix. Please ignore. I shall send the correct fix
shortly. It should be release_path() instead.

-- 
Goldwyn

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

end of thread, other threads:[~2016-10-24 15:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-24 14:57 [PATCH] btrfs-progs: Initialize btrfs_path before use Goldwyn Rodrigues
2016-10-24 15:06 ` Filipe Manana
2016-10-24 15:14 ` Goldwyn Rodrigues

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