Tejun Heo wrote: > Satyam Sharma wrote: >>>> sysfs_find_dirent() -- to check for -EEXIST -- should be called >>>> *before* we create the new dentry for the to-be-created symlink >>>> in the first place. [ It's weird to grab a reference on the target >>>> for ourselves (and in fact even allocate the new dirent for the >>>> to-be-created symlink) and /then/ check for erroneous usage, >>>> and then go about undoing all that we should never have done >>>> at all. ] So this test could, and should, be made earlier, IMHO. >>> Locking. >> Well s/sysfs_find_dirent/sysfs_get_dirent/ then. And then simply put >> down the reference later. > > Isn't that the current code? Oops, somehow thought you were talking about allocating it first. Gee... what difference does using sysfs_get_dirent() make? Do you think the following code is correct? sd = sysfs_get_dirent("some name"); if (sd != NULL) return -EEXIST; lock; add_new_node("some name"); unlock; sysfs_put_dirent(sd); -- tejun - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
- Follow-Ups:
- Re: [PATCH] sysfs: kill an extra put in sysfs_create_link() failure path
- From: "Satyam Sharma" <[email protected]>
- Re: [PATCH] sysfs: kill an extra put in sysfs_create_link() failure path
- References:
- Re: Oops while modprobing phy fixed module
- From: "Satyam Sharma" <[email protected]>
- Re: Oops while modprobing phy fixed module
- From: Tejun Heo <[email protected]>
- Re: Oops while modprobing phy fixed module
- From: Gabriel C <[email protected]>
- Re: Oops while modprobing phy fixed module
- From: Gabriel C <[email protected]>
- Re: Oops while modprobing phy fixed module
- From: Gabriel C <[email protected]>
- [PATCH] sysfs: kill an extra put in sysfs_create_link() failure path
- From: Tejun Heo <[email protected]>
- Re: [PATCH] sysfs: kill an extra put in sysfs_create_link() failure path
- From: "Satyam Sharma" <[email protected]>
- Re: [PATCH] sysfs: kill an extra put in sysfs_create_link() failure path
- From: Tejun Heo <[email protected]>
- Re: [PATCH] sysfs: kill an extra put in sysfs_create_link() failure path
- From: "Satyam Sharma" <[email protected]>
- Re: [PATCH] sysfs: kill an extra put in sysfs_create_link() failure path
- From: Tejun Heo <[email protected]>
- Re: [PATCH] sysfs: kill an extra put in sysfs_create_link() failure path
- From: "Satyam Sharma" <[email protected]>
- Re: [PATCH] sysfs: kill an extra put in sysfs_create_link() failure path
- From: Tejun Heo <[email protected]>
- Re: Oops while modprobing phy fixed module
- Prev by Date: Re: [kvm-devel] [RFC] Deferred interrupt handling.
- Next by Date: Re: XFS -git changes and Linux-VServer patch porting
- Previous by thread: Re: [PATCH] sysfs: kill an extra put in sysfs_create_link() failure path
- Next by thread: Re: [PATCH] sysfs: kill an extra put in sysfs_create_link() failure path
- Index(es):