[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20130730141056.GF12016@htj.dyndns.org>
Date: Tue, 30 Jul 2013 10:10:56 -0400
From: Tejun Heo <tj@...nel.org>
To: Dennis Chen <xschen@...oft.com.cn>
Cc: linux-kernel@...r.kernel.org, gregkh@...uxfoundation.org,
xiyou.wangcong@...il.com
Subject: Re: [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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists