View | Details | Raw Unified | Return to bug 259152 | Differences between
and this patch

Collapse All | Expand All

(-)b/sys/dev/iscsi/iscsi.c (-8 / +32 lines)
Lines 892-906 iscsi_pdu_handle_scsi_response(struct icl_pdu *response) Link Here
892
	}
892
	}
893
893
894
	ccb = io->io_ccb;
894
	ccb = io->io_ccb;
895
	if (ntohl(bhssr->bhssr_expdatasn) != io->io_datasn) {
895
	if (bhssr->response == BHSSR_RESPONSE_COMMAND_COMPLETED) {
896
		ISCSI_SESSION_WARN(is,
896
		if (ntohl(bhssr->bhssr_expdatasn) != io->io_datasn) {
897
		    "ExpDataSN mismatch in SCSI Response (%u vs %u)",
897
			ISCSI_SESSION_WARN(is,
898
		    ntohl(bhssr->bhssr_expdatasn), io->io_datasn);
898
			    "ExpDataSN mismatch in SCSI Response (%u vs %u)",
899
		icl_pdu_free(response);
899
			    ntohl(bhssr->bhssr_expdatasn), io->io_datasn);
900
		iscsi_session_reconnect(is);
900
901
		ISCSI_SESSION_UNLOCK(is);
901
			/*
902
		return;
902
			 * XXX: Permit an ExpDataSN of zero for errors.
903
			 *
904
			 * This doesn't conform to RFC 7143, but some
905
			 * targets seem to do this.
906
			 */
907
			if (bhssr->bhssr_status != 0 &&
908
			    bhssr->bhssr_expdatasn == htonl(0))
909
				goto skip_expdatasn;
910
911
			icl_pdu_free(response);
912
			iscsi_session_reconnect(is);
913
			ISCSI_SESSION_UNLOCK(is);
914
			return;
915
		}
916
	} else {
917
		if (bhssr->bhssr_expdatasn != htonl(0)) {
918
			ISCSI_SESSION_WARN(is,
919
			    "ExpDataSN mismatch in SCSI Response (%u vs 0)",
920
			    ntohl(bhssr->bhssr_expdatasn));
921
			icl_pdu_free(response);
922
			iscsi_session_reconnect(is);
923
			ISCSI_SESSION_UNLOCK(is);
924
			return;
925
		}
903
	}
926
	}
927
skip_expdatasn:
904
928
905
	/*
929
	/*
906
	 * With iSER, after getting good response we can be sure
930
	 * With iSER, after getting good response we can be sure

Return to bug 259152