[patch 2/6] zfcp: Fix opening of wka ports

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

 



From: Christof Schmitt <christof.schmitt@xxxxxxxxxx>

Running two wka_port_get calls in parallel could issue two open_port
requests, overwriting the port handle. Don't issue an open_port
for the state PORT_OPENING, and only read the data from GOOD
responses.

Signed-off-by: Christof Schmitt <christof.schmitt@xxxxxxxxxx>
Acked-by: Swen Schillig <swen@xxxxxxxxxxxx>
---
 drivers/s390/scsi/zfcp_fc.c  |    3 ++-
 drivers/s390/scsi/zfcp_fsf.c |    1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/s390/scsi/zfcp_fc.c	2008-11-26 16:42:12.000000000 +0100
+++ b/drivers/s390/scsi/zfcp_fc.c	2008-11-26 16:42:23.000000000 +0100
@@ -50,7 +50,8 @@ static int zfcp_wka_port_get(struct zfcp
 	if (mutex_lock_interruptible(&wka_port->mutex))
 		return -ERESTARTSYS;
 
-	if (wka_port->status != ZFCP_WKA_PORT_ONLINE) {
+	if (wka_port->status == ZFCP_WKA_PORT_OFFLINE ||
+	    wka_port->status == ZFCP_WKA_PORT_CLOSING) {
 		wka_port->status = ZFCP_WKA_PORT_OPENING;
 		if (zfcp_fsf_open_wka_port(wka_port))
 			wka_port->status = ZFCP_WKA_PORT_OFFLINE;
--- a/drivers/s390/scsi/zfcp_fsf.c	2008-11-26 16:17:53.000000000 +0100
+++ b/drivers/s390/scsi/zfcp_fsf.c	2008-11-26 16:42:23.000000000 +0100
@@ -1584,6 +1584,7 @@ static void zfcp_fsf_open_wka_port_handl
 		wka_port->status = ZFCP_WKA_PORT_OFFLINE;
 		break;
 	case FSF_PORT_ALREADY_OPEN:
+		break;
 	case FSF_GOOD:
 		wka_port->handle = header->port_handle;
 		wka_port->status = ZFCP_WKA_PORT_ONLINE;

-- 
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" 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]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux