aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_transport_iscsi.c
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@infradead.org>2006-01-11 07:16:10 -0500
committerJames Bottomley <jejb@mulgrave.(none)>2006-01-12 12:53:11 -0500
commit0b9506723826c68b50fa33e345700ddcac1bed36 (patch)
treeda3e432ef4517c47ebdc088c6322d0ac51193127 /drivers/scsi/scsi_transport_iscsi.c
parentdacee84b070c4e705a5b6446f1f0a6a6e2f8d7a4 (diff)
[SCSI] turn most scsi semaphores into mutexes
the scsi layer is using semaphores in a mutex way, this patch converts these into using mutexes instead Signed-off-by: Arjan van de Ven <arjan@infradead.org> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/scsi_transport_iscsi.c')
-rw-r--r--drivers/scsi/scsi_transport_iscsi.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index e08462d50c97..50ed88f98f46 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -24,6 +24,7 @@
24#include <linux/string.h> 24#include <linux/string.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/mempool.h> 26#include <linux/mempool.h>
27#include <linux/mutex.h>
27#include <net/tcp.h> 28#include <net/tcp.h>
28 29
29#include <scsi/scsi.h> 30#include <scsi/scsi.h>
@@ -46,7 +47,7 @@ struct iscsi_internal {
46 struct list_head sessions; 47 struct list_head sessions;
47 /* 48 /*
48 * lock to serialize access to the sessions list which must 49 * lock to serialize access to the sessions list which must
49 * be taken after the rx_queue_sema 50 * be taken after the rx_queue_mutex
50 */ 51 */
51 spinlock_t session_lock; 52 spinlock_t session_lock;
52 /* 53 /*
@@ -70,7 +71,7 @@ struct iscsi_internal {
70/* 71/*
71 * list of registered transports and lock that must 72 * list of registered transports and lock that must
72 * be held while accessing list. The iscsi_transport_lock must 73 * be held while accessing list. The iscsi_transport_lock must
73 * be acquired after the rx_queue_sema. 74 * be acquired after the rx_queue_mutex.
74 */ 75 */
75static LIST_HEAD(iscsi_transports); 76static LIST_HEAD(iscsi_transports);
76static DEFINE_SPINLOCK(iscsi_transport_lock); 77static DEFINE_SPINLOCK(iscsi_transport_lock);
@@ -145,7 +146,7 @@ static DECLARE_TRANSPORT_CLASS(iscsi_connection_class,
145 146
146static struct sock *nls; 147static struct sock *nls;
147static int daemon_pid; 148static int daemon_pid;
148static DECLARE_MUTEX(rx_queue_sema); 149static DEFINE_MUTEX(rx_queue_mutex);
149 150
150struct mempool_zone { 151struct mempool_zone {
151 mempool_t *pool; 152 mempool_t *pool;
@@ -881,7 +882,7 @@ iscsi_if_rx(struct sock *sk, int len)
881{ 882{
882 struct sk_buff *skb; 883 struct sk_buff *skb;
883 884
884 down(&rx_queue_sema); 885 mutex_lock(&rx_queue_mutex);
885 while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) { 886 while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) {
886 while (skb->len >= NLMSG_SPACE(0)) { 887 while (skb->len >= NLMSG_SPACE(0)) {
887 int err; 888 int err;
@@ -923,7 +924,7 @@ iscsi_if_rx(struct sock *sk, int len)
923 } 924 }
924 kfree_skb(skb); 925 kfree_skb(skb);
925 } 926 }
926 up(&rx_queue_sema); 927 mutex_unlock(&rx_queue_mutex);
927} 928}
928 929
929/* 930/*
@@ -1159,7 +1160,7 @@ int iscsi_unregister_transport(struct iscsi_transport *tt)
1159 1160
1160 BUG_ON(!tt); 1161 BUG_ON(!tt);
1161 1162
1162 down(&rx_queue_sema); 1163 mutex_lock(&rx_queue_mutex);
1163 1164
1164 priv = iscsi_if_transport_lookup(tt); 1165 priv = iscsi_if_transport_lookup(tt);
1165 BUG_ON (!priv); 1166 BUG_ON (!priv);
@@ -1167,7 +1168,7 @@ int iscsi_unregister_transport(struct iscsi_transport *tt)
1167 spin_lock_irqsave(&priv->session_lock, flags); 1168 spin_lock_irqsave(&priv->session_lock, flags);
1168 if (!list_empty(&priv->sessions)) { 1169 if (!list_empty(&priv->sessions)) {
1169 spin_unlock_irqrestore(&priv->session_lock, flags); 1170 spin_unlock_irqrestore(&priv->session_lock, flags);
1170 up(&rx_queue_sema); 1171 mutex_unlock(&rx_queue_mutex);
1171 return -EPERM; 1172 return -EPERM;
1172 } 1173 }
1173 spin_unlock_irqrestore(&priv->session_lock, flags); 1174 spin_unlock_irqrestore(&priv->session_lock, flags);
@@ -1181,7 +1182,7 @@ int iscsi_unregister_transport(struct iscsi_transport *tt)
1181 1182
1182 sysfs_remove_group(&priv->cdev.kobj, &iscsi_transport_group); 1183 sysfs_remove_group(&priv->cdev.kobj, &iscsi_transport_group);
1183 class_device_unregister(&priv->cdev); 1184 class_device_unregister(&priv->cdev);
1184 up(&rx_queue_sema); 1185 mutex_unlock(&rx_queue_mutex);
1185 1186
1186 return 0; 1187 return 0;
1187} 1188}