Re: [PATCH] xfs: add __GFP_NOLOCKDEP when allocating memory in xfs_attr_shortform_list()

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

 



On 6/29/24 01:01, Darrick J. Wong wrote:
> On Fri, Jun 28, 2024 at 11:25:10AM -0500, Eric Sandeen wrote:
>> On 6/27/24 8:12 AM, Jiwei Sun wrote:
>>> From: Jiwei Sun <sunjw10@xxxxxxxxxx>
>>>
>>> If the following configuration is set
>>> CONFIG_LOCKDEP=y
>>>
>>> The following warning log appears,
>>
>> Was just about to send this. :)
>>
>> I had talked to dchinner about this and he also suggested that this was 
>> missed in the series that removed GFP_NOFS, i.e.
>>
>> [PATCH 00/12] xfs: remove remaining kmem interfaces and GFP_NOFS usage
>> at https://lore.kernel.org/linux-mm/20240622094411.GA830005@ceph-admin/T/
>>
>> So, I think this could also use one or both of:
>>
>> Fixes: 204fae32d5f7 ("xfs: clean up remaining GFP_NOFS users")
>> Fixes: 94a69db2367e ("xfs: use __GFP_NOLOCKDEP instead of GFP_NOFS")
>>
>> ...
>>
>>> This is a false positive. If a node is getting reclaimed, it cannot be
>>> the target of a flistxattr operation. Commit 6dcde60efd94 ("xfs: more
>>> lockdep whackamole with kmem_alloc*") has the similar root cause.
>>>
>>> Fix the issue by adding __GFP_NOLOCKDEP in order to shut up lockdep.
>>>
>>> Signed-off-by: Jiwei Sun <sunjw10@xxxxxxxxxx>
>>> Suggested-by: Adrian Huang <ahuang12@xxxxxxxxxx>
>>> ---
>>>  fs/xfs/xfs_attr_list.c | 3 ++-
>>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/fs/xfs/xfs_attr_list.c b/fs/xfs/xfs_attr_list.c
>>> index 5c947e5ce8b8..506ade0befa4 100644
>>> --- a/fs/xfs/xfs_attr_list.c
>>> +++ b/fs/xfs/xfs_attr_list.c
>>> @@ -114,7 +114,8 @@ xfs_attr_shortform_list(
>>>  	 * It didn't all fit, so we have to sort everything on hashval.
>>>  	 */
>>>  	sbsize = sf->count * sizeof(*sbuf);
>>> -	sbp = sbuf = kmalloc(sbsize, GFP_KERNEL | __GFP_NOFAIL);
>>> +	sbp = sbuf = kmalloc(sbsize, GFP_KERNEL | __GFP_NOFAIL |
>>> +			     __GFP_NOLOCKDEP);
>>
>> Minor nitpick, style-wise we seem to do:
>>
>>         sbp = sbuf = kmalloc(sbsize,
>>                         GFP_KERNEL | __GFP_NOLOCKDEP | __GFP_NOFAIL);
>>
>> in most other places, and not split the flags onto 2 lines, since you need
>> to add a line anyway.
>>
>> Otherwise,
>>
>> Acked-by: Eric Sandeen <sandeen@xxxxxxxxxx>
> 
> Hey, could you all please read the list before sending duplicate
> patches?

I'm very sorry for wasting everyone's time because of missing that patch.
Thank you for pointing out this point, @Darrick.
And thank you also for your review and suggestions, @Eric.

Thanks,
Regards,
Jiwei

> 
> https://lore.kernel.org/linux-xfs/20240622082631.2661148-1-leo.lilong@xxxxxxxxxx/
> 
> --D
> 
>>>  	/*
>>>  	 * Scan the attribute list for the rest of the entries, storing
>>
>>




[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