[PATCH] sysfs: fix sysfs_setattr
authorManeesh Soni <maneesh@in.ibm.com>
Fri, 29 Jul 2005 19:14:19 +0000 (12:14 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 29 Jul 2005 20:12:49 +0000 (13:12 -0700)
o sysfs_dirent's s_mode field should also be updated in sysfs_setattr(), else
  there could be inconsistency in the two fields. s_mode is used while
  ->readdir so as not to bring in the inode to cache.

Signed-off-by: Maneesh Soni <maneesh@in.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/sysfs/inode.c

index 8de13bafaa76732ec184733ebef14cfd4c79e546..d727dc960634a28de3df914ccb26cdc63fac98a9 100644 (file)
@@ -85,7 +85,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;