]> pilppa.com Git - linux-2.6-omap-h63xx.git/commit
sysfs: fix race condition around sd->s_dentry, take#2
authorTejun Heo <htejun@gmail.com>
Mon, 11 Jun 2007 05:04:01 +0000 (14:04 +0900)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 12 Jun 2007 23:08:47 +0000 (16:08 -0700)
commitdd14cbc994709a1c5a64ed3621f583c49a27e521
treee48d38b7450661907c7b75490504c7f70b04d6cc
parent6aa054aadfea613a437ad0b15d38eca2b963fc0a
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>
fs/sysfs/dir.c
fs/sysfs/inode.c
fs/sysfs/sysfs.h