Re: [RFC] fix sysfs symlinks

From: Greg KH
Date: Thu Apr 15 2004 - 17:21:02 EST


On Tue, Apr 13, 2004 at 02:36:15PM +0100, viro@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx wrote:
> On Tue, Apr 13, 2004 at 06:10:37PM +0530, Maneesh Soni wrote:
> > Hi,
> >
> > As pointed by Al Viro, the current symlinks support in sysfs is incorrect as
> > it always sees the old target if target is renamed and obviously does not
> > follow the new target. The page symlink operations as used by current sysfs
> > code always see the target information at the time of creation.
>
> a) we ought to take a reference to target when creating a symlink (and drop
> it on removal)

No, we don't want that. It's ok to have a dangling symlink in the fs if
the device the link was pointing to is now gone. All of the struct
class_device stuff relies on the fact that a struct device can go away
at any time, and nothing bad will happen (with the exception of a stale
symlink.)

Yeah, it can cause a few odd looking trees when you unplug and replug a
device a bunch of times, all the while grabbing a reference to the class
device, but once everything is released by the user, it is cleaned up
properly, with no harm done to anything.

thanks,

greg k-h
-
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/