diff options
| author | Anton Altaparmakov <aia21@cantab.net> | 2006-01-19 11:39:33 -0500 | 
|---|---|---|
| committer | Anton Altaparmakov <aia21@cantab.net> | 2006-01-19 11:39:33 -0500 | 
| commit | 944d79559d154c12becde0dab327016cf438f46c (patch) | |
| tree | 50c101806f4d3b6585222dda060559eb4f3e005a /fs/sysfs/file.c | |
| parent | d087e4bdd24ebe3ae3d0b265b6573ec901af4b4b (diff) | |
| parent | 0f36b018b2e314d45af86449f1a97facb1fbe300 (diff) | |
Merge branch 'master' of /usr/src/ntfs-2.6/
Diffstat (limited to 'fs/sysfs/file.c')
| -rw-r--r-- | fs/sysfs/file.c | 17 | 
1 files changed, 8 insertions, 9 deletions
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index 4013d7905e84..d0e3d8495165 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c  | |||
| @@ -364,9 +364,9 @@ int sysfs_add_file(struct dentry * dir, const struct attribute * attr, int type) | |||
| 364 | umode_t mode = (attr->mode & S_IALLUGO) | S_IFREG; | 364 | umode_t mode = (attr->mode & S_IALLUGO) | S_IFREG; | 
| 365 | int error = 0; | 365 | int error = 0; | 
| 366 | 366 | ||
| 367 | down(&dir->d_inode->i_sem); | 367 | mutex_lock(&dir->d_inode->i_mutex); | 
| 368 | error = sysfs_make_dirent(parent_sd, NULL, (void *) attr, mode, type); | 368 | error = sysfs_make_dirent(parent_sd, NULL, (void *) attr, mode, type); | 
| 369 | up(&dir->d_inode->i_sem); | 369 | mutex_unlock(&dir->d_inode->i_mutex); | 
| 370 | 370 | ||
| 371 | return error; | 371 | return error; | 
| 372 | } | 372 | } | 
| @@ -398,7 +398,7 @@ int sysfs_update_file(struct kobject * kobj, const struct attribute * attr) | |||
| 398 | struct dentry * victim; | 398 | struct dentry * victim; | 
| 399 | int res = -ENOENT; | 399 | int res = -ENOENT; | 
| 400 | 400 | ||
| 401 | down(&dir->d_inode->i_sem); | 401 | mutex_lock(&dir->d_inode->i_mutex); | 
| 402 | victim = lookup_one_len(attr->name, dir, strlen(attr->name)); | 402 | victim = lookup_one_len(attr->name, dir, strlen(attr->name)); | 
| 403 | if (!IS_ERR(victim)) { | 403 | if (!IS_ERR(victim)) { | 
| 404 | /* make sure dentry is really there */ | 404 | /* make sure dentry is really there */ | 
| @@ -420,7 +420,7 @@ int sysfs_update_file(struct kobject * kobj, const struct attribute * attr) | |||
| 420 | */ | 420 | */ | 
| 421 | dput(victim); | 421 | dput(victim); | 
| 422 | } | 422 | } | 
| 423 | up(&dir->d_inode->i_sem); | 423 | mutex_unlock(&dir->d_inode->i_mutex); | 
| 424 | 424 | ||
| 425 | return res; | 425 | return res; | 
| 426 | } | 426 | } | 
| @@ -441,22 +441,22 @@ int sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode) | |||
| 441 | struct iattr newattrs; | 441 | struct iattr newattrs; | 
| 442 | int res = -ENOENT; | 442 | int res = -ENOENT; | 
| 443 | 443 | ||
| 444 | down(&dir->d_inode->i_sem); | 444 | mutex_lock(&dir->d_inode->i_mutex); | 
| 445 | victim = lookup_one_len(attr->name, dir, strlen(attr->name)); | 445 | victim = lookup_one_len(attr->name, dir, strlen(attr->name)); | 
| 446 | if (!IS_ERR(victim)) { | 446 | if (!IS_ERR(victim)) { | 
| 447 | if (victim->d_inode && | 447 | if (victim->d_inode && | 
| 448 | (victim->d_parent->d_inode == dir->d_inode)) { | 448 | (victim->d_parent->d_inode == dir->d_inode)) { | 
| 449 | inode = victim->d_inode; | 449 | inode = victim->d_inode; | 
| 450 | down(&inode->i_sem); | 450 | mutex_lock(&inode->i_mutex); | 
| 451 | newattrs.ia_mode = (mode & S_IALLUGO) | | 451 | newattrs.ia_mode = (mode & S_IALLUGO) | | 
| 452 | (inode->i_mode & ~S_IALLUGO); | 452 | (inode->i_mode & ~S_IALLUGO); | 
| 453 | newattrs.ia_valid = ATTR_MODE | ATTR_CTIME; | 453 | newattrs.ia_valid = ATTR_MODE | ATTR_CTIME; | 
| 454 | res = notify_change(victim, &newattrs); | 454 | res = notify_change(victim, &newattrs); | 
| 455 | up(&inode->i_sem); | 455 | mutex_unlock(&inode->i_mutex); | 
| 456 | } | 456 | } | 
| 457 | dput(victim); | 457 | dput(victim); | 
| 458 | } | 458 | } | 
| 459 | up(&dir->d_inode->i_sem); | 459 | mutex_unlock(&dir->d_inode->i_mutex); | 
| 460 | 460 | ||
| 461 | return res; | 461 | return res; | 
| 462 | } | 462 | } | 
| @@ -480,4 +480,3 @@ void sysfs_remove_file(struct kobject * kobj, const struct attribute * attr) | |||
| 480 | EXPORT_SYMBOL_GPL(sysfs_create_file); | 480 | EXPORT_SYMBOL_GPL(sysfs_create_file); | 
| 481 | EXPORT_SYMBOL_GPL(sysfs_remove_file); | 481 | EXPORT_SYMBOL_GPL(sysfs_remove_file); | 
| 482 | EXPORT_SYMBOL_GPL(sysfs_update_file); | 482 | EXPORT_SYMBOL_GPL(sysfs_update_file); | 
| 483 | |||
