lkml.org 
[lkml]   [2004]   [Apr]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [RFC] fix sysfs symlinks
    On Thu, Apr 29, 2004 at 06:33:53PM +0530, Maneesh Soni wrote:

    [snip]

    > @@ -167,10 +175,14 @@ void sysfs_rename_dir(struct kobject * k
    > parent = kobj->parent->dentry;
    >
    > down(&parent->d_inode->i_sem);
    > -
    > new_dentry = sysfs_get_dentry(parent, new_name);
    > - d_move(kobj->dentry, new_dentry);
    > - kobject_set_name(kobj,new_name);
    > + if (!IS_ERR(new_dentry)) {
    > + down_write(&sysfs_rename_sem);
    > + d_move(kobj->dentry, new_dentry);
    > + kobject_set_name(kobj,new_name);
    > + up_write(&sysfs_rename_sem);
    > + dput(new_dentry);
    > + }
    > up(&parent->d_inode->i_sem);
    > }

    I would probably lift that rwsem all way up - in front of any other locks
    in sysfs_rename_dir(). Note that kobject_set_name() can very well lead to
    allocations, so just to make the lock hierarchy cleaner... Another thing:
    please, check that new_dentry is negative here. Other than that, I've
    got no problems with the patch.
    -
    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/

    \
     
     \ /
      Last update: 2005-03-22 14:02    [W:0.019 / U:59.680 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site