[PATCH] zfcp: Fix spinlock imbalance in zfcp_qdio_sbal_get

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

When reviewing kernel for some crash, I found a very strange function 
zfcp_qdio_sbal_get - it drops a spinlock, sometimes returns without the 
spinlock, sometimes retakes the spinlock and returns.

The callers of zfcp_qdio_sbal_get assume that the spinlock is still held, 
but on successful return from zfcp_qdio_sbal_get it is not held.

How is this supposed to work? It seems that no one ever ran this code with 
lock debugging enabled.

I am sending a patch, but I can't test it.

Mikulas

---

zfcp: Fix spinlock imbalance in zfcp_qdio_sbal_get

Signed-off-by: Mikulas Patocka <mpatocka@xxxxxxxxxx>

---
 drivers/s390/scsi/zfcp_qdio.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Index: linux-2.6/drivers/s390/scsi/zfcp_qdio.c
===================================================================
--- linux-2.6.orig/drivers/s390/scsi/zfcp_qdio.c	2013-05-14 22:15:28.000000000 +0200
+++ linux-2.6/drivers/s390/scsi/zfcp_qdio.c	2013-05-14 22:15:49.000000000 +0200
@@ -250,11 +250,15 @@ int zfcp_qdio_sbal_get(struct zfcp_qdio
 	ret = wait_event_interruptible_timeout(qdio->req_q_wq,
 			       zfcp_qdio_sbal_check(qdio), 5 * HZ);
 
-	if (!(atomic_read(&qdio->adapter->status) & ZFCP_STATUS_ADAPTER_QDIOUP))
+	if (!(atomic_read(&qdio->adapter->status) & ZFCP_STATUS_ADAPTER_QDIOUP)) {
+		spin_lock_irq(&qdio->req_q_lock);
 		return -EIO;
+	}
 
-	if (ret > 0)
+	if (ret > 0) {
+		spin_lock_irq(&qdio->req_q_lock);
 		return 0;
+	}
 
 	if (!ret) {
 		atomic_inc(&qdio->req_q_full);
--
To unsubscribe from this list: send the line "unsubscribe linux-s390" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux