Re: [PATCH 2/4] sysfs: Only take active references on attributes.

From: AmÃrico Wang
Date: Mon Feb 15 2010 - 04:26:28 EST


On Mon, Feb 15, 2010 at 04:15:27PM +0800, AmÃrico Wang wrote:
>On Mon, Feb 15, 2010 at 03:27:45PM +0800, AmÃrico Wang wrote:
>>On Thu, Feb 11, 2010 at 03:20:00PM -0800, Eric W. Biederman wrote:
>>>
>>>If we exclude directories and symlinks from the set of sysfs
>>>dirents where we need active references we are left with
>>>sysfs attributes (binary or not).
>>>
>>>- Tweak sysfs_deactivate to only do something on attributes
>>>- Move lockdep initialization into sysfs_file_add_mode to
>>> limit it to just attributes.
>>
>>Why?
>>
>>If I read your patch correctly, s_active will be useless
>>for non-attributes sysfs entries? For sysfs dir, maybe,
>>since it can only be removed by sysfs_remove_dir(),
>>but not sure about sysfs symlinks...
>>
>
>For sysfs dir's, opening it will not get s_active,
>since it doesn't have .open member. But it does
>put s_active when removing it. This seems buggy?

Oh, definitely no...

s_active of sysfs dir is only for kernel space,
after your previous patch.

>
>For symlinks, it seems sysfs totally ignores s_active,
>thus is safe for this patch.
>

Thus, your patch seems correct.

I think we could merge them for more testing.

Acked-by: WANG Cong <xiyou.wangcong@xxxxxxxxx>

Thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/