lkml.org 
[lkml]   [2004]   [May]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
DateSun, 23 May 2004 15:50:43 -0400
FromJohn Zielinski <>
Subject[RFC] sysfs rename dir problem
In the sysfs_rename_dir function if something goes wrong then the 
directory name would no longer match the internal kobj name. Here's a
patch I made to fix that but I'm not sure if it's 100% correct.

John



diff -urNX dontdiff linux-2.6.6/fs/sysfs/dir.c linux/fs/sysfs/dir.c
--- linux-2.6.6/fs/sysfs/dir.c 2004-05-09 22:32:28.000000000 -0400
+++ linux/fs/sysfs/dir.c 2004-05-23 15:16:40.000000000 -0400
@@ -169,8 +169,14 @@
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)) {
+ if (kobject_set_name(kobj,new_name))
+ d_move(kobj->dentry, new_dentry);
+ else {
+ d_delete(new_dentry);
+ dput(new_dentry);
+ }
+ }
up(&parent->d_inode->i_sem);
}
\
 
 \ /
  Last update: 2005-03-22 14:03    [from the cache]
©2003-2010