Linux XFS filesystem development
 help / color / mirror / Atom feed
* SegFault in cache code 2
@ 2025-10-11  8:39 Torsten Rupp
  2025-10-11 18:36 ` Darrick J. Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Torsten Rupp @ 2025-10-11  8:39 UTC (permalink / raw)
  To: linux-xfs

Dear XFS developers,

it seems the fix for the segmentation fault in xfsprogs 6.16.0 in the 
initialization of the cache is caused by a double initialization and 
free of "xfs_extfree_item_cache" in init.c:init_caches() resp. 
init.c:destroy_caches. This is already done in xfs_alloc.c as also 
valgrind showed me.

This patch remove the double initialization and free. The segmentation 
fault disappear with this patch and valgrind is also happy:

--- xfsprogs-6.16.0.org/libxfs/init.c   2025-06-23 13:48:41.000000000 +0200
+++ xfsprogs-6.16.0/libxfs/init.c       2025-10-11 10:17:27.101472681 +0200
@@ -214,9 +214,6 @@
                 fprintf(stderr, "Could not allocate btree cursor 
caches.\n");
                 abort();
         }
-       xfs_extfree_item_cache = kmem_cache_init(
-                       sizeof(struct xfs_extent_free_item),
-                       "xfs_extfree_item");
         xfs_trans_cache = kmem_cache_init(
                         sizeof(struct xfs_trans), "xfs_trans");
         xfs_parent_args_cache = kmem_cache_init(
@@ -236,7 +233,6 @@
         leaked += kmem_cache_destroy(xfs_da_state_cache);
         xfs_defer_destroy_item_caches();
         xfs_btree_destroy_cur_caches();
-       leaked += kmem_cache_destroy(xfs_extfree_item_cache);
         leaked += kmem_cache_destroy(xfs_trans_cache);
         leaked += kmem_cache_destroy(xfs_parent_args_cache);

Best regards, Torsten


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

* Re: SegFault in cache code 2
  2025-10-11  8:39 SegFault in cache code 2 Torsten Rupp
@ 2025-10-11 18:36 ` Darrick J. Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Darrick J. Wong @ 2025-10-11 18:36 UTC (permalink / raw)
  To: Torsten Rupp; +Cc: linux-xfs

On Sat, Oct 11, 2025 at 10:39:24AM +0200, Torsten Rupp wrote:
> Dear XFS developers,
> 
> it seems the fix for the segmentation fault in xfsprogs 6.16.0 in the
> initialization of the cache is caused by a double initialization and free of
> "xfs_extfree_item_cache" in init.c:init_caches() resp.
> init.c:destroy_caches. This is already done in xfs_alloc.c as also valgrind
> showed me.
> 
> This patch remove the double initialization and free. The segmentation fault
> disappear with this patch and valgrind is also happy:
> 
> --- xfsprogs-6.16.0.org/libxfs/init.c   2025-06-23 13:48:41.000000000 +0200
> +++ xfsprogs-6.16.0/libxfs/init.c       2025-10-11 10:17:27.101472681 +0200
> @@ -214,9 +214,6 @@
>                 fprintf(stderr, "Could not allocate btree cursor
> caches.\n");
>                 abort();
>         }
> -       xfs_extfree_item_cache = kmem_cache_init(
> -                       sizeof(struct xfs_extent_free_item),
> -                       "xfs_extfree_item");
>         xfs_trans_cache = kmem_cache_init(
>                         sizeof(struct xfs_trans), "xfs_trans");
>         xfs_parent_args_cache = kmem_cache_init(
> @@ -236,7 +233,6 @@
>         leaked += kmem_cache_destroy(xfs_da_state_cache);
>         xfs_defer_destroy_item_caches();
>         xfs_btree_destroy_cur_caches();
> -       leaked += kmem_cache_destroy(xfs_extfree_item_cache);

Oh, yeah, that is redundant.  Can you add a Signed-off-by tag so that we
can review/include this?

--D

>         leaked += kmem_cache_destroy(xfs_trans_cache);
>         leaked += kmem_cache_destroy(xfs_parent_args_cache);
> 
> Best regards, Torsten
> 
> 

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

end of thread, other threads:[~2025-10-11 18:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-11  8:39 SegFault in cache code 2 Torsten Rupp
2025-10-11 18:36 ` Darrick J. Wong

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