git: 161148e61f5d - stable/13 - 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:37:14 UTC
The branch stable/13 has been updated by ram:

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

commit 161148e61f5dd98aba6b17ca90f396902a00d2b5
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 10:31:06 +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 cd212b628bd1..4d7671aa8fb6 100644
--- a/sys/dev/ocs_fc/ocs.h
+++ b/sys/dev/ocs_fc/ocs.h
@@ -64,14 +64,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 6a9ef6160cee..b734880cefb8 100644
--- a/sys/dev/ocs_fc/ocs_cam.c
+++ b/sys/dev/ocs_fc/ocs_cam.c
@@ -1118,10 +1118,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;
 	}