changeset 11108:cb7581cd0244

6896419 FC: panic when destroying LUN (assertion failed: lun_map_ent && lun_map_ent->ent_lu == lu, ...)
author tim szeto <Tim.Szeto@Sun.COM>
date Thu, 19 Nov 2009 11:03:38 -0700
parents 580f46f0734f
children 0cdfd26cd0fc
files usr/src/cmd/stmfadm/stmfadm.c usr/src/uts/common/io/comstar/stmf/lun_map.c
diffstat 2 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/stmfadm/stmfadm.c	Thu Nov 19 10:48:34 2009 -0700
+++ b/usr/src/cmd/stmfadm/stmfadm.c	Thu Nov 19 11:03:38 2009 -0700
@@ -411,6 +411,11 @@
 				    gettext("STMF service version incorrect"));
 				ret++;
 				break;
+			case STMF_ERROR_TG_ONLINE:
+				(void) fprintf(stderr, "%s: %s\n", cmdName,
+				    gettext("STMF target must be offline"));
+				ret++;
+				break;
 			default:
 				(void) fprintf(stderr, "%s: %s: %s\n", cmdName,
 				    operands[i], gettext("unknown error"));
--- a/usr/src/uts/common/io/comstar/stmf/lun_map.c	Thu Nov 19 10:48:34 2009 -0700
+++ b/usr/src/uts/common/io/comstar/stmf/lun_map.c	Thu Nov 19 11:03:38 2009 -0700
@@ -1458,6 +1458,16 @@
 		else
 			return (0);
 	}
+
+	/* verify target is offline */
+	if (entry_type == STMF_ID_TYPE_TARGET) {
+		ilport = stmf_targetident_to_ilport(entry_ident, entry_size);
+		if (ilport && ilport->ilport_state != STMF_STATE_OFFLINE) {
+			*err_detail = STMF_IOCERR_TG_NEED_TG_OFFLINE;
+			return (EBUSY);
+		}
+	}
+
 	id_member = stmf_alloc_id(entry_size, entry_type,
 	    entry_ident, 0);
 	stmf_append_id((stmf_id_list_t *)id_grp->id_impl_specific, id_member);