All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chen Gang <gang.chen@asianux.com>
To: Tejun Heo <tj@kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] kernel/workqueue.c: need call device_remove_file() when failure occurs after called device_create_file()
Date: Fri, 17 May 2013 10:51:49 +0800	[thread overview]
Message-ID: <51959B45.30207@asianux.com> (raw)
In-Reply-To: <20130516175017.GA7171@mtj.dyndns.org>

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

      reply	other threads:[~2013-05-17  2:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-14 12:25 [PATCH] kernel/workqueue.c: better to free related resources when failure occurs in wq_numa_init() Chen Gang
2013-05-14 15:17 ` Tejun Heo
2013-05-15  2:16   ` Chen Gang
2013-05-15  6:13     ` [PATCH] kernel/workqueue.c: need call device_remove_file() when failure occurs after called device_create_file() Chen Gang
2013-05-15 21:22       ` Tejun Heo
2013-05-16  3:33         ` Chen Gang
2013-05-16  4:16           ` Chen Gang
2013-05-16  4:48             ` Chen Gang
2013-05-16 17:50               ` Tejun Heo
2013-05-17  2:51                 ` Chen Gang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51959B45.30207@asianux.com \
    --to=gang.chen@asianux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.