]> err.no Git - linux-2.6/blobdiff - fs/sysfs/inode.c
Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mfashe...
[linux-2.6] / fs / sysfs / inode.c
index ccb7d722c55897a6105e93457b923e5b1b741c0d..bdd30e74de6b00c16685e98745d2fe96325c483b 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/backing-dev.h>
 #include <linux/capability.h>
 #include <linux/errno.h>
+#include <linux/sched.h>
 #include <asm/semaphore.h>
 #include "sysfs.h"
 
@@ -222,13 +223,17 @@ const unsigned char * sysfs_get_name(struct sysfs_dirent *sd)
 
 static inline void orphan_all_buffers(struct inode *node)
 {
-       struct sysfs_buffer_collection *set = node->i_private;
+       struct sysfs_buffer_collection *set;
        struct sysfs_buffer *buf;
 
        mutex_lock_nested(&node->i_mutex, I_MUTEX_CHILD);
-       if (node->i_private) {
-               list_for_each_entry(buf, &set->associates, associates)
+       set = node->i_private;
+       if (set) {
+               list_for_each_entry(buf, &set->associates, associates) {
+                       down(&buf->sem);
                        buf->orphaned = 1;
+                       up(&buf->sem);
+               }
        }
        mutex_unlock(&node->i_mutex);
 }