Teach sysfs_chmod_file how to handle multiple sysfs superblocks. We need to iterate over each superblock so that we give all of the appropriate filesystem modification notifications. Signed-off-by: Eric W. Biederman <[email protected]> --- fs/sysfs/file.c | 41 +++++++++++++++++++++++++---------------- 1 files changed, 25 insertions(+), 16 deletions(-) diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index f954b9f..cff054f 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c @@ -501,7 +501,8 @@ int sysfs_update_file(struct kobject * kobj, const struct attribute * attr) int sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode) { struct sysfs_dirent *victim_sd = NULL; - struct dentry *victim = NULL; + struct super_block *sb; + struct dentry *victim; struct inode * inode; struct iattr newattrs; int rc; @@ -512,22 +513,30 @@ int sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode) goto out; mutex_lock(&sysfs_rename_mutex); - victim = sysfs_get_dentry(sysfs_sb, victim_sd); - mutex_unlock(&sysfs_rename_mutex); - if (IS_ERR(victim)) { - rc = PTR_ERR(victim); - victim = NULL; - goto out; + sysfs_grab_supers(); + list_for_each_entry(sb, &sysfs_fs_type.fs_supers, s_instances) { + victim = sysfs_get_dentry(sb, victim_sd); + if (!victim) + continue; + if (IS_ERR(victim)) { + rc = PTR_ERR(victim); + victim = NULL; + goto out_unlock; + } + + inode = victim->d_inode; + mutex_lock(&inode->i_mutex); + newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO); + newattrs.ia_valid = ATTR_MODE | ATTR_CTIME; + rc = notify_change(victim, &newattrs); + mutex_unlock(&inode->i_mutex); + + dput(victim); } - - inode = victim->d_inode; - mutex_lock(&inode->i_mutex); - newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO); - newattrs.ia_valid = ATTR_MODE | ATTR_CTIME; - rc = notify_change(victim, &newattrs); - mutex_unlock(&inode->i_mutex); - out: - dput(victim); +out_unlock: + sysfs_release_supers(); + mutex_unlock(&sysfs_rename_mutex); +out: sysfs_put(victim_sd); return rc; } -- 1.5.1.1.181.g2de0 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
- Follow-Ups:
- Re: [PATCH 21/25] sysfs: sysfs_chmod_file handle multiple superblocks
- From: Tejun Heo <[email protected]>
- [PATCH 22/25] sysfs: sysfs_uptdate_file handle multiple superblocks
- From: [email protected] (Eric W. Biederman)
- Re: [PATCH 21/25] sysfs: sysfs_chmod_file handle multiple superblocks
- References:
- [PATCH 5/5] sysfs: make sysfs_addrm_finish() return void
- From: Tejun Heo <[email protected]>
- [PATCH 01/25] sysfs: Move all of inode initialization into sysfs_init_inode
- From: [email protected] (Eric W. Biederman)
- [PATCH 02/25] sysfs: Remove sysfs_instantiate
- From: [email protected] (Eric W. Biederman)
- [PATCH 03/25] sysfs: Use kill_anon_super
- From: [email protected] (Eric W. Biederman)
- [PATCH 04/25] sysfs: Make sysfs_mount static
- From: [email protected] (Eric W. Biederman)
- [PATCH 05/25] sysfs: In sysfs_lookup don't open code sysfs_find_dirent
- From: [email protected] (Eric W. Biederman)
- [PATCH 06/25] sysfs: Simplify readdir.
- From: [email protected] (Eric W. Biederman)
- [PATCH 07/25] sysfs: Rewrite sysfs_drop_dentry.
- From: [email protected] (Eric W. Biederman)
- [PATCH 08/25] sysfs: Implement __sysfs_get_dentry
- From: [email protected] (Eric W. Biederman)
- [PATCH 09/25] sysfs: Move sysfs_get_dentry below __sysfs_get_dentry
- From: [email protected] (Eric W. Biederman)
- [PATCH 10/25] sysfs: Rewrite sysfs_get_dentry in terms of __sysfs_get_dentry
- From: [email protected] (Eric W. Biederman)
- [PATCH 11/25] sysfs: Remove s_dentry
- From: [email protected] (Eric W. Biederman)
- [PATCH 12/25] sysfs: Introduce sysfs_rename_mutex
- From: [email protected] (Eric W. Biederman)
- [PATCH 13/25] sysfs: Simply sysfs_get_dentry
- From: [email protected] (Eric W. Biederman)
- [PATCH 14/25] sysfs: Don't use lookup_one_len_kern
- From: [email protected] (Eric W. Biederman)
- [PATCH 15/25] vfs: Remove lookup_one_len_kern
- From: [email protected] (Eric W. Biederman)
- [PATCH 16/25] sysfs: Support for preventing unmounts.
- From: [email protected] (Eric W. Biederman)
- [PATCH 17/25] sysfs: Rewrite rename in terms of sysfs dirents
- From: [email protected] (Eric W. Biederman)
- [PATCH 18/25] sysfs: Rewrite sysfs_move_dir in terms of sysfs dirents
- From: [email protected] (Eric W. Biederman)
- [PATCH 19/25] sysfs: sysfs_get_dentry add a sb parameter
- From: [email protected] (Eric W. Biederman)
- [PATCH 20/25] sysfs: Rename Support multiple superblocks
- From: [email protected] (Eric W. Biederman)
- [PATCH 5/5] sysfs: make sysfs_addrm_finish() return void
- Prev by Date: [PATCH 20/25] sysfs: Rename Support multiple superblocks
- Next by Date: Re: [RESEND][PATCH 1/3] ehea: Fix workqueue handling
- Previous by thread: [PATCH 20/25] sysfs: Rename Support multiple superblocks
- Next by thread: [PATCH 22/25] sysfs: sysfs_uptdate_file handle multiple superblocks
- Index(es):