]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - fs/sysfs/inode.c
[IPV6]: Address autoconfiguration does not work after device down/up cycle
[karo-tx-linux.git] / fs / sysfs / inode.c
index 8de13bafaa76732ec184733ebef14cfd4c79e546..689f7bcfaf3043b5585853f33589d59a77398008 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/pagemap.h>
 #include <linux/namei.h>
 #include <linux/backing-dev.h>
+#include <linux/capability.h>
 #include "sysfs.h"
 
 extern struct super_block * sysfs_sb;
@@ -85,7 +86,7 @@ int sysfs_setattr(struct dentry * dentry, struct iattr * iattr)
 
                if (!in_group_p(inode->i_gid) && !capable(CAP_FSETID))
                        mode &= ~S_ISGID;
-               sd_iattr->ia_mode = mode;
+               sd_iattr->ia_mode = sd->s_mode = mode;
        }
 
        return error;
@@ -201,7 +202,7 @@ const unsigned char * sysfs_get_name(struct sysfs_dirent *sd)
 
 /*
  * Unhashes the dentry corresponding to given sysfs_dirent
- * Called with parent inode's i_sem held.
+ * Called with parent inode's i_mutex held.
  */
 void sysfs_drop_dentry(struct sysfs_dirent * sd, struct dentry * parent)
 {
@@ -228,7 +229,11 @@ void sysfs_hash_and_remove(struct dentry * dir, const char * name)
        struct sysfs_dirent * sd;
        struct sysfs_dirent * parent_sd = dir->d_fsdata;
 
-       down(&dir->d_inode->i_sem);
+       if (dir->d_inode == NULL)
+               /* no inode means this hasn't been made visible yet */
+               return;
+
+       mutex_lock(&dir->d_inode->i_mutex);
        list_for_each_entry(sd, &parent_sd->s_children, s_sibling) {
                if (!sd->s_element)
                        continue;
@@ -239,7 +244,5 @@ void sysfs_hash_and_remove(struct dentry * dir, const char * name)
                        break;
                }
        }
-       up(&dir->d_inode->i_sem);
+       mutex_unlock(&dir->d_inode->i_mutex);
 }
-
-