diff options
Diffstat (limited to 'fs/sysfs/file.c')
| -rw-r--r-- | fs/sysfs/file.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index d72c1ce48559..4013d7905e84 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | */ | 3 | */ |
| 4 | 4 | ||
| 5 | #include <linux/module.h> | 5 | #include <linux/module.h> |
| 6 | #include <linux/dnotify.h> | 6 | #include <linux/fsnotify.h> |
| 7 | #include <linux/kobject.h> | 7 | #include <linux/kobject.h> |
| 8 | #include <linux/namei.h> | 8 | #include <linux/namei.h> |
| 9 | #include <asm/uaccess.h> | 9 | #include <asm/uaccess.h> |
| @@ -391,9 +391,6 @@ int sysfs_create_file(struct kobject * kobj, const struct attribute * attr) | |||
| 391 | * sysfs_update_file - update the modified timestamp on an object attribute. | 391 | * sysfs_update_file - update the modified timestamp on an object attribute. |
| 392 | * @kobj: object we're acting for. | 392 | * @kobj: object we're acting for. |
| 393 | * @attr: attribute descriptor. | 393 | * @attr: attribute descriptor. |
| 394 | * | ||
| 395 | * Also call dnotify for the dentry, which lots of userspace programs | ||
| 396 | * use. | ||
| 397 | */ | 394 | */ |
| 398 | int sysfs_update_file(struct kobject * kobj, const struct attribute * attr) | 395 | int sysfs_update_file(struct kobject * kobj, const struct attribute * attr) |
| 399 | { | 396 | { |
| @@ -408,7 +405,7 @@ int sysfs_update_file(struct kobject * kobj, const struct attribute * attr) | |||
| 408 | if (victim->d_inode && | 405 | if (victim->d_inode && |
| 409 | (victim->d_parent->d_inode == dir->d_inode)) { | 406 | (victim->d_parent->d_inode == dir->d_inode)) { |
| 410 | victim->d_inode->i_mtime = CURRENT_TIME; | 407 | victim->d_inode->i_mtime = CURRENT_TIME; |
| 411 | dnotify_parent(victim, DN_MODIFY); | 408 | fsnotify_modify(victim); |
| 412 | 409 | ||
| 413 | /** | 410 | /** |
| 414 | * Drop reference from initial sysfs_get_dentry(). | 411 | * Drop reference from initial sysfs_get_dentry(). |
| @@ -440,8 +437,8 @@ int sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode) | |||
| 440 | { | 437 | { |
| 441 | struct dentry *dir = kobj->dentry; | 438 | struct dentry *dir = kobj->dentry; |
| 442 | struct dentry *victim; | 439 | struct dentry *victim; |
| 443 | struct sysfs_dirent *sd; | 440 | struct inode * inode; |
| 444 | umode_t umode = (mode & S_IALLUGO) | S_IFREG; | 441 | struct iattr newattrs; |
| 445 | int res = -ENOENT; | 442 | int res = -ENOENT; |
| 446 | 443 | ||
| 447 | down(&dir->d_inode->i_sem); | 444 | down(&dir->d_inode->i_sem); |
| @@ -449,13 +446,15 @@ int sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode) | |||
| 449 | if (!IS_ERR(victim)) { | 446 | if (!IS_ERR(victim)) { |
| 450 | if (victim->d_inode && | 447 | if (victim->d_inode && |
| 451 | (victim->d_parent->d_inode == dir->d_inode)) { | 448 | (victim->d_parent->d_inode == dir->d_inode)) { |
| 452 | sd = victim->d_fsdata; | 449 | inode = victim->d_inode; |
| 453 | attr->mode = mode; | 450 | down(&inode->i_sem); |
| 454 | sd->s_mode = umode; | 451 | newattrs.ia_mode = (mode & S_IALLUGO) | |
| 455 | victim->d_inode->i_mode = umode; | 452 | (inode->i_mode & ~S_IALLUGO); |
| 456 | dput(victim); | 453 | newattrs.ia_valid = ATTR_MODE | ATTR_CTIME; |
| 457 | res = 0; | 454 | res = notify_change(victim, &newattrs); |
| 455 | up(&inode->i_sem); | ||
| 458 | } | 456 | } |
| 457 | dput(victim); | ||
| 459 | } | 458 | } |
| 460 | up(&dir->d_inode->i_sem); | 459 | up(&dir->d_inode->i_sem); |
| 461 | 460 | ||
