Re: [PATCH 02/16] xfs: initialise attrd item to zero

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2022-04-14 at 19:44 +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner@xxxxxxxxxx>
> 
> On the first allocation of a attrd item, xfs_trans_add_item() fires
> an assert like so:
> 
>  XFS (pmem0): EXPERIMENTAL logged extended attributes feature added.
> Use at your own risk!
>  XFS: Assertion failed: !test_bit(XFS_LI_DIRTY, &lip->li_flags),
> file: fs/xfs/xfs_trans.c, line: 683
>  ------------[ cut here ]------------
>  kernel BUG at fs/xfs/xfs_message.c:102!
>  Call Trace:
>   <TASK>
>   xfs_trans_add_item+0x17e/0x190
>   xfs_trans_get_attrd+0x67/0x90
>   xfs_attr_create_done+0x13/0x20
>   xfs_defer_finish_noroll+0x100/0x690
>   __xfs_trans_commit+0x144/0x330
>   xfs_trans_commit+0x10/0x20
>   xfs_attr_set+0x3e2/0x4c0
>   xfs_initxattrs+0xaa/0xe0
>   security_inode_init_security+0xb0/0x130
>   xfs_init_security+0x18/0x20
>   xfs_generic_create+0x13a/0x340
>   xfs_vn_create+0x17/0x20
>   path_openat+0xff3/0x12f0
>   do_filp_open+0xb2/0x150
> 
> The attrd log item is allocated via kmem_cache_alloc, and
> xfs_log_item_init() does not zero the entire log item structure - it
> assumes that the structure is already all zeros as it only
> initialises non-zero fields. Fix the attr items to be allocated
> via the *zalloc methods.
> 
> Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx>
Ok, looks fine
Reviewed-by: Allison Henderson<allison.henderson@xxxxxxxxxx>

> ---
>  fs/xfs/xfs_attr_item.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_attr_item.c b/fs/xfs/xfs_attr_item.c
> index 0e2ef0dedb28..b6561861ef01 100644
> --- a/fs/xfs/xfs_attr_item.c
> +++ b/fs/xfs/xfs_attr_item.c
> @@ -725,7 +725,7 @@ xfs_trans_get_attrd(struct xfs_trans		
> *tp,
>  
>  	ASSERT(tp != NULL);
>  
> -	attrdp = kmem_cache_alloc(xfs_attrd_cache, GFP_NOFS |
> __GFP_NOFAIL);
> +	attrdp = kmem_cache_zalloc(xfs_attrd_cache, GFP_NOFS |
> __GFP_NOFAIL);
>  
>  	xfs_log_item_init(tp->t_mountp, &attrdp->attrd_item,
> XFS_LI_ATTRD,
>  			  &xfs_attrd_item_ops);




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux