[SCSI] zfcp: Fix port reference counting
authorMartin Petermann <martin.petermann@de.ibm.com>
Fri, 17 Apr 2009 13:08:13 +0000 (15:08 +0200)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Mon, 27 Apr 2009 15:07:35 +0000 (10:07 -0500)
If this problem appears zfcp ports cannot be de-queued since it is
checked for a zero refcount. The port reference counting is wrong for
existing zfcp ports when e.g. an adapter gets on-line again. During
port scanning the reference counting for existing ports should not be
changed.

Signed-off-by: Martin Petermann <martin.petermann@de.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
drivers/s390/scsi/zfcp_fc.c

index db40968..19ae084 100644 (file)
@@ -539,6 +539,9 @@ static void zfcp_validate_port(struct zfcp_port *port)
 {
        struct zfcp_adapter *adapter = port->adapter;
 
+       if (!(atomic_read(&port->status) & ZFCP_STATUS_COMMON_NOESC))
+               return;
+
        atomic_clear_mask(ZFCP_STATUS_COMMON_NOESC, &port->status);
 
        if ((port->supported_classes != 0) ||
@@ -599,10 +602,8 @@ static int zfcp_scan_eval_gpn_ft(struct zfcp_gpn_ft *gpn_ft, int max_entries)
                if (acc->wwpn == fc_host_port_name(adapter->scsi_host))
                        continue;
                port = zfcp_get_port_by_wwpn(adapter, acc->wwpn);
-               if (port) {
-                       zfcp_port_get(port);
+               if (port)
                        continue;
-               }
 
                port = zfcp_port_enqueue(adapter, acc->wwpn,
                                         ZFCP_STATUS_COMMON_NOESC, d_id);