Re: [PATCH 8/19]: SCST SYSFS interface implementation

From: Vladislav Bolkhovitin
Date: Mon Nov 15 2010 - 15:37:24 EST


Dmitry Torokhov, on 11/15/2010 10:04 AM wrote:
>> 1. What to do if another SCST object is being created with the same name
>> as supposed to be deleted, but not completely dead yet?
>
> The same rules as with files - the object disappears from the
> "directories" so no new users can get it but is not destroyed till last
> reference is gone.
>
>>
>> 2. What to do if a dieing object is found on some list and reference for
>> is supposed to be taken? If the object deleted from the list before it
>> marked dieing, i.e. the latest internal put() done, it made additional
>> problems during deleting it after the latest external put done.
>
> You delete the object from the list, then mark it as dead, notify users,
> drop refcount. No new users will get it (as it is not on the list
> anymore) and existing ones should notice that it is dead and stop using
> it.

Those are good in theory, but on practice, you know, devil is in the
details..

>> This is because SYSFS doesn't hold references for the corresponding
>> kobjects for every open file handle. It holds references only when
>> show() and store() functions called. So, everything is under control and
>> a malicious user can do nothing to hold a reference forever.
>
> Right, Tejun plugged this particular (and very annoying) attributes
> behavior

This behavior isn't annoying, it's GREAT, because it allows to use SYSFS
simply and reliably.

>, but that does not mean that this is the only way kobject's
> reference might be pinned.

Could you be more specific and point out on exact ways for that? From my
quite deep SYSFS source code study I see such cases should not exist.

Thanks,
Vlad
--
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/