diff options
author | Tejun Heo <htejun@gmail.com> | 2007-06-11 07:04:01 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-06-13 01:08:47 +0200 |
commit | dd14cbc994709a1c5a64ed3621f583c49a27e521 (patch) | |
tree | e48d38b7450661907c7b75490504c7f70b04d6cc /fs/sysfs/sysfs.h | |
parent | sysfs: fix condition check in sysfs_drop_dentry() (diff) | |
download | linux-dd14cbc994709a1c5a64ed3621f583c49a27e521.tar.xz linux-dd14cbc994709a1c5a64ed3621f583c49a27e521.zip |
sysfs: fix race condition around sd->s_dentry, take#2
Allowing attribute and symlink dentries to be reclaimed means
sd->s_dentry can change dynamically. However, updates to the field
are unsynchronized leading to race conditions. This patch adds
sysfs_lock and use it to synchronize updates to sd->s_dentry.
Due to the locking around ->d_iput, the check in sysfs_drop_dentry()
is complex. sysfs_lock only protect sd->s_dentry pointer itself. The
validity of the dentry is protected by dcache_lock, so whether dentry
is alive or not can only be tested while holding both locks.
This is minimal backport of sysfs_drop_dentry() rewrite in devel
branch.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs/sysfs/sysfs.h')
-rw-r--r-- | fs/sysfs/sysfs.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h index 1966e1a0a015..502c949c402d 100644 --- a/fs/sysfs/sysfs.h +++ b/fs/sysfs/sysfs.h @@ -33,6 +33,7 @@ extern const unsigned char * sysfs_get_name(struct sysfs_dirent *sd); extern void sysfs_drop_dentry(struct sysfs_dirent *sd, struct dentry *parent); extern int sysfs_setattr(struct dentry *dentry, struct iattr *iattr); +extern spinlock_t sysfs_lock; extern struct rw_semaphore sysfs_rename_sem; extern struct super_block * sysfs_sb; extern const struct file_operations sysfs_dir_operations; |