git: ddf502de60be - stable/12 - ocs_fc: Fix device lost timer where device is not getting deleted.

From: Ram Kishore Vegesna <ram_at_FreeBSD.org>
Date: Fri, 17 Dec 2021 10:03:54 UTC
The branch stable/12 has been updated by ram:

URL: https://cgit.FreeBSD.org/src/commit/?id=ddf502de60be13ae55b54555234d00c3b3712aa8

commit ddf502de60be13ae55b54555234d00c3b3712aa8
Author:     Ram Kishore Vegesna <ram@FreeBSD.org>
AuthorDate: 2021-09-24 09:35:30 +0000
Commit:     Ram Kishore Vegesna <ram@FreeBSD.org>
CommitDate: 2021-12-17 09:57:50 +0000

    ocs_fc: Fix device lost timer where device is not getting deleted.
    
    Issue: Devices wont go away after the link down.
    
    Device lost timer functionality in ocs_fc is broken,
    `is_target` flag is not set in the target database and target delete is skipped.
    
    Fix: Remove unused flags and delete the device when timer expires.
    
    Reported by: ken@kdm.org
    Reviewed by: mav, ken
    
    (cherry picked from commit 41e946694333bcc6f64242f294312553f2ef2dcd)
---
 sys/dev/ocs_fc/ocs.h     | 4 ----
 sys/dev/ocs_fc/ocs_cam.c | 5 +----
 2 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/sys/dev/ocs_fc/ocs.h b/sys/dev/ocs_fc/ocs.h
index 36d3bf35e27c..3a5fdd71f6b6 100644
--- a/sys/dev/ocs_fc/ocs.h
+++ b/sys/dev/ocs_fc/ocs.h
@@ -65,14 +65,10 @@ typedef struct ocs_intr_ctx_s {
 typedef struct ocs_fc_rport_db_s {
 	uint32_t	node_id;
 	uint32_t	state;
-	uint8_t		is_target;
-	uint8_t		is_initiator;
-
 	uint32_t	port_id;
 	uint64_t	wwnn;
 	uint64_t	wwpn;
 	uint32_t	gone_timer;
-
 } ocs_fc_target_t;
 
 #define OCS_TGT_STATE_NONE		0	/* Empty DB slot */
diff --git a/sys/dev/ocs_fc/ocs_cam.c b/sys/dev/ocs_fc/ocs_cam.c
index c773eab105f0..1b5c73f163ef 100644
--- a/sys/dev/ocs_fc/ocs_cam.c
+++ b/sys/dev/ocs_fc/ocs_cam.c
@@ -1123,10 +1123,7 @@ ocs_ldt_task(void *arg, int pending)
 			continue;
 		}
 
-		if (tgt->is_target) {
-			tgt->is_target = 0;
-			ocs_delete_target(ocs, fcp, i);
-		}
+		ocs_delete_target(ocs, fcp, i);
 
 		tgt->state = OCS_TGT_STATE_NONE;
 	}