summaryrefslogtreecommitdiff
path: root/fs/sysfs/file.c
diff options
context:
space:
mode:
authorDave Kleikamp <shaggy@austin.ibm.com>2005-08-04 15:56:15 -0500
committerDave Kleikamp <shaggy@austin.ibm.com>2005-08-04 15:56:15 -0500
commita5c96cab8f3c4ca9b2177dceb5de5a0edb31418e (patch)
tree45692a1b3d770f721f4586ad81c206f1b8509b75 /fs/sysfs/file.c
parent30db1ae8640d3527ca7ac8df4bcbf14ccc6ae9cd (diff)
parent1c5ad84516ae7ea4ec868436a910a6bd8d20215a (diff)
Merge with /home/shaggy/git/linus-clean/
Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com>
Diffstat (limited to 'fs/sysfs/file.c')
-rw-r--r--fs/sysfs/file.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index 335288b9be0f..4013d7905e84 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -437,8 +437,8 @@ int sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode)
{
struct dentry *dir = kobj->dentry;
struct dentry *victim;
- struct sysfs_dirent *sd;
- umode_t umode = (mode & S_IALLUGO) | S_IFREG;
+ struct inode * inode;
+ struct iattr newattrs;
int res = -ENOENT;
down(&dir->d_inode->i_sem);
@@ -446,13 +446,15 @@ int sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode)
if (!IS_ERR(victim)) {
if (victim->d_inode &&
(victim->d_parent->d_inode == dir->d_inode)) {
- sd = victim->d_fsdata;
- attr->mode = mode;
- sd->s_mode = umode;
- victim->d_inode->i_mode = umode;
- dput(victim);
- res = 0;
+ inode = victim->d_inode;
+ down(&inode->i_sem);
+ newattrs.ia_mode = (mode & S_IALLUGO) |
+ (inode->i_mode & ~S_IALLUGO);
+ newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
+ res = notify_change(victim, &newattrs);
+ up(&inode->i_sem);
}
+ dput(victim);
}
up(&dir->d_inode->i_sem);