lkml.org 
[lkml]   [2013]   [Jul]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] race condition fixing in sysfs_create_dir
Hello,

On Tue, Jul 30, 2013 at 02:34:56PM +0800, Dennis Chen wrote:
> >I don't think sysfs is supposed to handle multiple actors trying to
> >populate and destroy the directory at the same time at all, so this
> >seems kinda moot. Do you have a case where this actually matters?
>
> hello,Tejun. Nice. But seems I still have different opinion :). If
> you look at the 'sysfs_do_create_link_sd()' code, you will find a
> comment "target->sd can go away beneath us but is protected with
> sysfs_assoc_lock. Fetch target_sd from it", don't you think the
> sysfs_create_dir is the same as the sysfs_do_create_link_sd()
> essentially? if the answer is yes meaning the parent dir can go away

No, one is targetting an unrelated directory wherever in the hierarchy
and the other one is targetting its direct parent. They aren't the
same.

> when its sub-dir is creating by sysfs_create_dir, then the similar
> action should be taken as sysfs_create_link does. right?

If you own a sysfs directory, it's your responsibility to prevent
creation of new entries under it against your own removal. The
implementation implicitly assumes that in many places. Do you have a
use case where this is an actual problem?

Thanks.

--
tejun


\
 
 \ /
  Last update: 2013-07-30 16:21    [W:0.051 / U:0.248 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site