From b454740246d14b0a9c00220696f9020eaa15ca12 Mon Sep 17 00:00:00 2001 From: Jan Glauber Date: Thu, 26 Mar 2009 15:24:24 +0100 Subject: [PATCH] [S390] qdio: add missing tiq_list locking Add a mutex to protect the tiq_list. Although reading the list is done using RCU adding and removing elements from the list must still happen locked since multiple qdio devices may change the list in parallel otherwise. Signed-off-by: Jan Glauber Signed-off-by: Martin Schwidefsky --- drivers/s390/cio/qdio_main.c | 1 + drivers/s390/cio/qdio_thinint.c | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c index 10cb0f8..5100996 100644 --- a/drivers/s390/cio/qdio_main.c +++ b/drivers/s390/cio/qdio_main.c @@ -1112,6 +1112,7 @@ int qdio_shutdown(struct ccw_device *cdev, int how) if (!irq_ptr) return -ENODEV; + BUG_ON(irqs_disabled()); DBF_EVENT("qshutdown:%4x", cdev->private->schid.sch_no); mutex_lock(&irq_ptr->setup_mutex); diff --git a/drivers/s390/cio/qdio_thinint.c b/drivers/s390/cio/qdio_thinint.c index 8e90e14..981044c 100644 --- a/drivers/s390/cio/qdio_thinint.c +++ b/drivers/s390/cio/qdio_thinint.c @@ -31,6 +31,7 @@ /* list of thin interrupt input queues */ static LIST_HEAD(tiq_list); +DEFINE_MUTEX(tiq_list_lock); /* adapter local summary indicator */ static unsigned char *tiqdio_alsi; @@ -95,10 +96,10 @@ void tiqdio_add_input_queues(struct qdio_irq *irq_ptr) if (!css_qdio_omit_svs && irq_ptr->siga_flag.sync) css_qdio_omit_svs = 1; - for_each_input_queue(irq_ptr, q, i) { + mutex_lock(&tiq_list_lock); + for_each_input_queue(irq_ptr, q, i) list_add_rcu(&q->entry, &tiq_list); - synchronize_rcu(); - } + mutex_unlock(&tiq_list_lock); xchg(irq_ptr->dsci, 1); tasklet_schedule(&tiqdio_tasklet); } @@ -118,7 +119,10 @@ void tiqdio_remove_input_queues(struct qdio_irq *irq_ptr) /* if establish triggered an error */ if (!q || !q->entry.prev || !q->entry.next) continue; + + mutex_lock(&tiq_list_lock); list_del_rcu(&q->entry); + mutex_unlock(&tiq_list_lock); synchronize_rcu(); } } -- 2.7.4