[SCSI] correct attribute_container list usage

One of the changes in the attribute_container code in the scsi-misc tree
was to add a lock to protect the list of devices per container.  This,
unfortunately, leads to potential scheduling while atomic problems if
there's a sleep in the function called by a trigger.

The correct solution is to use the kernel klist infrastructure instead
which allows lockless traversal of a list.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
This commit is contained in:
James Bottomley 2005-08-22 10:06:19 -05:00 committed by James Bottomley
parent 51490c89f9
commit 53c165e0a6
2 changed files with 31 additions and 24 deletions

View file

@ -11,12 +11,12 @@
#include <linux/device.h>
#include <linux/list.h>
#include <linux/klist.h>
#include <linux/spinlock.h>
struct attribute_container {
struct list_head node;
struct list_head containers;
spinlock_t containers_lock;
struct klist containers;
struct class *class;
struct class_device_attribute **attrs;
int (*match)(struct attribute_container *, struct device *);