[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 11 Nov 2022 16:27:03 +0800
From: Liu Shixin <liushixin2@...wei.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
CC: "Rafael J. Wysocki" <rafael@...nel.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] kobject: hide illegible sysfs warning of kobject_del()
On 2022/11/11 14:26, Greg Kroah-Hartman wrote:
> On Fri, Nov 11, 2022 at 02:58:07PM +0800, Liu Shixin wrote:
>> Some consumers do not care whether kobject_add() succeed or failed such as
>> irqdesc. They call kobject_del() all the time even if kobject_add() failed.
>> Then kernel will report some illegible sysfs warning like this:
>>
>> kernfs: can not remove 'actions', no directory
>> WARNING: CPU: 0 PID: 277 at fs/kernfs/dir.c:1615 kernfs_remove_by_name_ns+0xd5/0xe0
> Why not fix the caller here? Is that somehow not possible?
The caller should be freed by kobject_put() if kobject_add() failed. But in fact, the failure does not affect
the function of the caller. So the caller do not call kobject_put() Immediately.
If want to fix the caller, we can check konj->state_in_sysfs before call kobject_del(). This way has no difference
with check kobj->state_in_sysfs in kobject_del().
By the way, I'm not sure how many callers have this problem. So I think it's better to fix in kobject_del().
thanks,
>
> thanks,
>
> greg k-h
> .
>
Powered by blists - more mailing lists