aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_transport_iscsi.c
diff options
context:
space:
mode:
authorMike Christie <michaelc@cs.wisc.edu>2006-06-28 13:00:27 -0400
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-06-29 11:08:10 -0400
commitf53a88da18e3c04c3ade07bc5eff520ee4259c3e (patch)
treea3b89b4d0e621d5dbf051fd7b2191de7f053d312 /drivers/scsi/scsi_transport_iscsi.c
parent5c75b7fcf0c0e3921391fd93f5fa58ec9a6c428f (diff)
[SCSI] iscsi: fix session refcouting
iscsi_tcp and iser cannot be rmmod from the kernel when sessions are running because session removal is driven from userspace. For those modules we get a module reference when a session is created then drop it when the session is removed. For qla4xxx, they can jsut remove the sessions from the pci remove function like normal HW drivers, so this patch moves the module reference from the transport class functions shared by all drivers to the libiscsi functions only used be software iscsi modules. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> 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.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 147c854e1d4d..8717ff51ba4b 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -228,13 +228,11 @@ static struct iscsi_cls_conn *iscsi_conn_lookup(uint32_t sid, uint32_t cid)
228static void iscsi_session_release(struct device *dev) 228static void iscsi_session_release(struct device *dev)
229{ 229{
230 struct iscsi_cls_session *session = iscsi_dev_to_session(dev); 230 struct iscsi_cls_session *session = iscsi_dev_to_session(dev);
231 struct iscsi_transport *transport = session->transport;
232 struct Scsi_Host *shost; 231 struct Scsi_Host *shost;
233 232
234 shost = iscsi_session_to_shost(session); 233 shost = iscsi_session_to_shost(session);
235 scsi_host_put(shost); 234 scsi_host_put(shost);
236 kfree(session); 235 kfree(session);
237 module_put(transport->owner);
238} 236}
239 237
240static int iscsi_is_session_dev(const struct device *dev) 238static int iscsi_is_session_dev(const struct device *dev)
@@ -305,13 +303,11 @@ iscsi_create_session(struct Scsi_Host *shost,
305 struct iscsi_cls_session *session; 303 struct iscsi_cls_session *session;
306 int err; 304 int err;
307 305
308 if (!try_module_get(transport->owner))
309 return NULL;
310
311 session = kzalloc(sizeof(*session) + transport->sessiondata_size, 306 session = kzalloc(sizeof(*session) + transport->sessiondata_size,
312 GFP_KERNEL); 307 GFP_KERNEL);
313 if (!session) 308 if (!session)
314 goto module_put; 309 return NULL;
310
315 session->transport = transport; 311 session->transport = transport;
316 session->recovery_tmo = 120; 312 session->recovery_tmo = 120;
317 INIT_WORK(&session->recovery_work, session_recovery_timedout, session); 313 INIT_WORK(&session->recovery_work, session_recovery_timedout, session);
@@ -349,8 +345,6 @@ iscsi_create_session(struct Scsi_Host *shost,
349 345
350free_session: 346free_session:
351 kfree(session); 347 kfree(session);
352module_put:
353 module_put(transport->owner);
354 return NULL; 348 return NULL;
355} 349}
356 350