mirror of
https://github.com/SCST-project/scst.git
synced 2026-08-20 14:16:31 +00:00
iscsi-scst: Make iscsi_thread_pool locking more fine-grained
Protect iscsi_thread_pool.threads_list via tp_mutex instead of scst_mutex. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5852 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -3966,11 +3966,13 @@ static void __iscsi_threads_pool_put(struct iscsi_thread_pool *p)
|
||||
|
||||
TRACE_DBG("Freeing iSCSI thread pool %p", p);
|
||||
|
||||
mutex_lock(&p->tp_mutex);
|
||||
list_for_each_entry_safe(t, tt, &p->threads_list, threads_list_entry) {
|
||||
kthread_stop(t->thr);
|
||||
list_del(&t->threads_list_entry);
|
||||
kfree(t);
|
||||
}
|
||||
mutex_unlock(&p->tp_mutex);
|
||||
|
||||
list_del(&p->thread_pools_list_entry);
|
||||
|
||||
@@ -4046,6 +4048,7 @@ int iscsi_threads_pool_get(const cpumask_t *cpu_mask,
|
||||
else
|
||||
cpumask_copy(&p->cpu_mask, cpu_mask);
|
||||
p->thread_pool_ref = 1;
|
||||
mutex_init(&p->tp_mutex);
|
||||
INIT_LIST_HEAD(&p->threads_list);
|
||||
|
||||
if (cpu_mask == NULL)
|
||||
@@ -4077,7 +4080,10 @@ int iscsi_threads_pool_get(const cpumask_t *cpu_mask,
|
||||
kfree(t);
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
mutex_lock(&p->tp_mutex);
|
||||
list_add_tail(&t->threads_list_entry, &p->threads_list);
|
||||
mutex_unlock(&p->tp_mutex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -85,9 +85,11 @@ struct iscsi_thread_pool {
|
||||
|
||||
int thread_pool_ref;
|
||||
|
||||
struct list_head threads_list;
|
||||
|
||||
/* Entry in iscsi_thread_pools_list */
|
||||
struct list_head thread_pools_list_entry;
|
||||
|
||||
struct mutex tp_mutex;
|
||||
struct list_head threads_list; /* protected by tp_mutex */
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user