From: <vl...@us...> - 2009-03-27 13:22:22
|
Revision: 724 http://scst.svn.sourceforge.net/scst/?rev=724&view=rev Author: vlnb Date: 2009-03-27 12:14:41 +0000 (Fri, 27 Mar 2009) Log Message: ----------- - Minor fixes in error recovery paths - Minor cleanups Modified Paths: -------------- trunk/scst/src/scst_lib.c trunk/scst/src/scst_main.c Modified: trunk/scst/src/scst_lib.c =================================================================== --- trunk/scst/src/scst_lib.c 2009-03-26 19:01:28 UTC (rev 723) +++ trunk/scst/src/scst_lib.c 2009-03-27 12:14:41 UTC (rev 724) @@ -995,8 +995,7 @@ (long long unsigned int)tgt_dev->lun); } else { TRACE_MGMT_DBG("Virtual device %s on SCST lun=%lld", - dev->virt_name, - (long long unsigned int)tgt_dev->lun); + dev->virt_name, (long long unsigned int)tgt_dev->lun); } spin_lock_init(&tgt_dev->tgt_dev_lock); @@ -1125,6 +1124,7 @@ } out_free: + scst_free_all_UA(tgt_dev); __exit_io_context(tgt_dev->tgt_dev_io_ctx); kmem_cache_free(scst_tgtd_cachep, tgt_dev); Modified: trunk/scst/src/scst_main.c =================================================================== --- trunk/scst/src/scst_main.c 2009-03-26 19:01:28 UTC (rev 723) +++ trunk/scst/src/scst_main.c 2009-03-27 12:14:41 UTC (rev 724) @@ -1113,7 +1113,7 @@ if (!thr) { res = -ENOMEM; PRINT_ERROR("Failed to allocate thr %d", res); - goto out; + goto out_del; } strncpy(nm, dev->handler->name, ARRAY_SIZE(nm)-1); nm[ARRAY_SIZE(nm)-1] = '\0'; @@ -1123,7 +1123,7 @@ res = PTR_ERR(thr->cmd_thread); PRINT_ERROR("kthread_create() failed: %d", res); kfree(thr); - goto out; + goto out_del; } list_add(&thr->thread_list_entry, &dev->threads_list); @@ -1143,6 +1143,10 @@ out: TRACE_EXIT_RES(res); return res; + +out_del: + scst_del_dev_threads(dev, i); + goto out; } /* Called under scst_mutex and suspended activity */ @@ -1186,6 +1190,9 @@ TRACE_ENTRY(); + if (num == 0) + goto out; + list_for_each_entry_safe_reverse(ct, tmp, &dev->threads_list, thread_list_entry) { int rc; @@ -1212,6 +1219,7 @@ break; } +out: TRACE_EXIT(); return; } @@ -1360,15 +1368,11 @@ void __scst_del_global_threads(int num) { struct scst_cmd_thread_t *ct, *tmp; - int i; TRACE_ENTRY(); - i = scst_nr_global_threads; - if (num <= 0 || num > i) { - PRINT_ERROR("can not del %d cmd threads from %d", num, i); - return; - } + if (num == 0) + goto out; list_for_each_entry_safe(ct, tmp, &scst_global_threads_list, thread_list_entry) { @@ -1385,6 +1389,7 @@ break; } +out: TRACE_EXIT(); return; } @@ -1428,8 +1433,7 @@ return res; out_error: - if (i > 0) - __scst_del_global_threads(i - 1); + __scst_del_global_threads(i); goto out; } @@ -1466,7 +1470,7 @@ TRACE_ENTRY(); mutex_lock(&scst_global_threads_mutex); - __scst_del_global_threads(scst_nr_global_threads); + __scst_del_global_threads(-1); if (scst_mgmt_cmd_thread) kthread_stop(scst_mgmt_cmd_thread); if (scst_mgmt_thread) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |