lkml.org 
[lkml]   [2013]   [May]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] kernel/workqueue.c: need call device_remove_file() when failure occurs after called device_create_file()
On 05/17/2013 01:50 AM, Tejun Heo wrote:
> Hey,
>
> On Thu, May 16, 2013 at 12:48:43PM +0800, Chen Gang wrote:
>> __sysfs_remove_dir() remove all related things, but not deref the count.
>>
>> For __sysfs_remove_dir() ->
>> ...
>> sysfs_addrm_start()
>> ...
>> while() {
>> ...
>> sysfs_remove_one() (not deref the related file)
>> }
>> sysfs_addrm_finish() (will deref current dir)
>>
>> For device_remove_file() ->
>> sysfs_remove_file() ->
>> sysfs_hash_and_remove() ->
>> ...
>> sysfs_addrm_start()
>> ...
>> sysfs_remove_one() (not deref the current file)
>> sysfs_addrm_finish() (will deref current file)
>>
>>
>> So if not call device_remove_file() firstly, the all files under the
>> directory are removed, but the related resources are not released which
>> will cause resource leak.
>
> Can you please be more specific on what gets leaked and if possible
> fix it from sysfs side?
>

Oh, it is my fault. It is not the correct reason.

But I will continue to analyse why it should be add device_remove_file()
before device_unregister() in all 'drivers/*' and 'arch/*' source files.


Thanks.
--
Chen Gang

Asianux Corporation


\
 
 \ /
  Last update: 2013-05-17 05:41    [W:0.139 / U:0.364 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site