Re: [RFC PATCH 0/3] sysfs: allow suicide

From: Alan Stern
Date: Wed Mar 25 2009 - 10:45:21 EST


On Tue, 24 Mar 2009, Alex Chiang wrote:

> Hi all,
>
> This is a refreshed version of the patch series Tejun posted quite a while
> ago that allowed sysfs attributes to commit suicide directly:
>
> http://thread.gmane.org/gmane.linux.kernel/582130/

> The most contentious part is patch 1/3, wherein sysfs abuses the
> module notifier call chain, and basically prevents all module unloads
> until suicidal sysfs attributes have completed.
>
> This is poison of a different flavor from last time. The earlier version
> of this series modified the module API and created an interface that
> allowed anyone to inhibit module unload.
>
> This time, only sysfs is allowed to be so... special. Which is a slight
> improvement, but the question as to whether sysfs should be allowed to
> do something like this is unresolved.

I tend to agree with Eric that this feels a little like a band-aid, and
a more general solution would be preferable. But I don't have one to
offer, and getting the immediate problems fixed is also important.

Why change the inhibit-module-unload interface? This new approach
seems a lot more complicated than needed; a simple rwsem should work
okay. Exposing it to the entire kernel when only sysfs uses it doesn't
matter -- there must be plenty of EXPORTed symbols with only one user.

Which reminds me... What happens if two different processes write to
the same suicidal sysfs attribute at the same time?

Alan Stern

--
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/