]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] suspend regression: sysfs deadlock
authorHugh Dickins <hugh@veritas.com>
Tue, 6 Mar 2007 19:20:11 +0000 (19:20 +0000)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Wed, 7 Mar 2007 01:59:14 +0000 (17:59 -0800)
Suspend deadlocks when trying to unregister /sys/block/sr0.

This comes from Oliver's commit 94bebf4d1b8e7719f0f3944c037a21cfd99a4af7
"Driver core: fix race in sysfs between sysfs_remove_file() and
read()/write()".

sysfs_write_file downs buffer->sem while calling flush_write_buffer, and
flushing that particular write buffer entails downing buffer->sem in
orphan_all_buffers, resulting in the obvious self-deadlock.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/sysfs/inode.c

index dd1344b007f59baf3b0d5ba05fadecd83f8d0604..ccb7d722c55897a6105e93457b923e5b1b741c0d 100644 (file)
@@ -227,11 +227,8 @@ static inline void orphan_all_buffers(struct inode *node)
 
        mutex_lock_nested(&node->i_mutex, I_MUTEX_CHILD);
        if (node->i_private) {
-               list_for_each_entry(buf, &set->associates, associates) {
-                       down(&buf->sem);
+               list_for_each_entry(buf, &set->associates, associates)
                        buf->orphaned = 1;
-                       up(&buf->sem);
-               }
        }
        mutex_unlock(&node->i_mutex);
 }