Messages in this thread | | | Date | Wed, 7 Jan 2004 09:27:50 -0800 | From | Greg KH <> | Subject | Re: Inconsistency in sysfs behavior? |
| |
Note, Pat's email address has changed, I've changed in the CC:
On Wed, Jan 07, 2004 at 10:48:44AM -0500, Alan Stern wrote: > The following appears to be an inconsistency in the way sysfs behaves. > Tell me what you think... > > When a user process parks its CWD in a kobject's sysfs directory and then > the kobject is unregistered, of course the directory is forced to remain > in existence (albeit unlinked) because of the reference held by the > process. But it does not in turn hold a reference to the kobject; the > kobject will be deleted immediately if nothing else refers to it. > > On the other hand, if a user process opens a sysfs attribute file and then > sysfs_remove_file() is called, again the file is forced to remain in > existence (albeit unlinked) because of the reference held by the process. > But now it _does_ hold a reference to the kobject; if the kobject is > unregistered it will not be deleted until the user process closes the > attribute file. > > Why this non-parallel behavior?
Because it is very difficult to determine when a user goes into a directory because we are using the ramfs/libfs code. It also does not cause any errors if the kobject is removed, as the vfs cleans up properly.
Only when a file is opened does a kobject need to be pinned, due to possible errors that could happen.
Hope this helps,
greg k-h - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |