git: ca420b4ef2ce - main - mpr/mps: when sending reset on removal, include target in message

From: Warner Losh <imp_at_FreeBSD.org>
Date: Thu, 28 Apr 2022 22:30:13 UTC
The branch main has been updated by imp:

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

commit ca420b4ef2ceac00f6c6905252d553a86100ab6a
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2022-04-28 22:29:28 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2022-04-28 22:30:00 +0000

    mpr/mps: when sending reset on removal, include target in message
    
    It's possible for muliple drives to be departing at the same time (if
    the common power rail the share goes dark, for example). To understand
    what's going on better, include target and handle in the messages
    announcing the reset to allow matching with other corresponding events.
    
    MFC After:              3 days
    Sponsored by:           Netflix
    Reviewed by:            mav
    Differential Revision:  https://reviews.freebsd.org/D35092
---
 sys/dev/mpr/mpr_sas.c | 8 ++++++--
 sys/dev/mps/mps_sas.c | 8 ++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/sys/dev/mpr/mpr_sas.c b/sys/dev/mpr/mpr_sas.c
index d40900e03108..dd630d212b7f 100644
--- a/sys/dev/mpr/mpr_sas.c
+++ b/sys/dev/mpr/mpr_sas.c
@@ -618,7 +618,9 @@ mprsas_remove_device(struct mpr_softc *sc, struct mpr_command *tm)
 	 * if so.
 	 */
 	if (TAILQ_FIRST(&targ->commands) == NULL) {
-		mpr_dprint(sc, MPR_INFO, "No pending commands: starting remove_device\n");
+		mpr_dprint(sc, MPR_INFO,
+		    "No pending commands: starting remove_device for target %u handle 0x%04x\n",
+		    targ->tid, handle);
 		mpr_map_command(sc, tm);
 		targ->pending_remove_tm = NULL;
 	} else {
@@ -2842,7 +2844,9 @@ mprsas_scsiio_complete(struct mpr_softc *sc, struct mpr_command *cm)
 	if (cm->cm_targ->flags & MPRSAS_TARGET_INREMOVAL) {
 		if (TAILQ_FIRST(&cm->cm_targ->commands) == NULL &&
 		    cm->cm_targ->pending_remove_tm != NULL) {
-			mpr_dprint(sc, MPR_INFO, "Last pending command complete: starting remove_device\n");
+			mpr_dprint(sc, MPR_INFO,
+			    "Last pending command complete: starting remove_device target %u handle 0x%04x\n",
+			    cm->cm_targ->tid, cm->cm_targ->handle);
 			mpr_map_command(sc, cm->cm_targ->pending_remove_tm);
 			cm->cm_targ->pending_remove_tm = NULL;
 		}
diff --git a/sys/dev/mps/mps_sas.c b/sys/dev/mps/mps_sas.c
index 087988bedc6a..9ac2207bce1d 100644
--- a/sys/dev/mps/mps_sas.c
+++ b/sys/dev/mps/mps_sas.c
@@ -588,7 +588,9 @@ mpssas_remove_device(struct mps_softc *sc, struct mps_command *tm)
 	 * if so.
 	 */
 	if (TAILQ_FIRST(&targ->commands) == NULL) {
-		mps_dprint(sc, MPS_INFO, "No pending commands: starting remove_device\n");
+		mps_dprint(sc, MPS_INFO,
+		    "No pending commands: starting remove_device target %u handle 0x%04x\n",
+		    targ->tid, handle);
 		mps_map_command(sc, tm);
 		targ->pending_remove_tm = NULL;
 	} else {
@@ -2383,7 +2385,9 @@ mpssas_scsiio_complete(struct mps_softc *sc, struct mps_command *cm)
 	if (cm->cm_targ->flags & MPSSAS_TARGET_INREMOVAL) {
 		if (TAILQ_FIRST(&cm->cm_targ->commands) == NULL &&
 		    cm->cm_targ->pending_remove_tm != NULL) {
-			mps_dprint(sc, MPS_INFO, "Last pending command complete: starting remove_device\n");
+			mps_dprint(sc, MPS_INFO,
+			    "Last pending command complete: starting remove_device target %u handle 0x%04x\n",
+			    cm->cm_targ->tid, cm->cm_targ->handle);
 			mps_map_command(sc, cm->cm_targ->pending_remove_tm);
 			cm->cm_targ->pending_remove_tm = NULL;
 		}