From 03b5cfbf65ca72fca1be2a906ac1d398cf3a593c Mon Sep 17 00:00:00 2001 From: ken Date: Tue, 3 Feb 2015 21:54:59 +0000 Subject: [PATCH] MFC 276831: r276831 | ken | 2015-01-08 09:27:56 -0700 (Thu, 08 Jan 2015) | 30 lines Fix a bug in the CAM SCSI probe code that caused changes in inquiry data to go undetected. The probe code does an MD5 checksum of the inquiry data (and page 0x80 serial number if available) before doing a reprobe of an existing device, and then compares a checksum after the probe to see whether the device has changed. This check was broken in January, 2000 by change 56146 when the extended inquiry probe code was added. In the extended inquiry probe case, it was calculating the checksum a second time. The second time it included the updated inquiry data from the short inquiry probe (first 36 bytes). So it wouldn't catch cases where the vendor, product, revision, etc. changed. This change will have the effect that when a device's inquiry data is updated and a rescan is issued, it will disappear and then reappear. This is the appropriate action, because if the inquiry data or serial number changes, it is either a different device or the device configuration may have changed significantly. (e.g. with updated firmware.) scsi_xpt.c: Don't calculate the initial MD5 checksum on standard inquiry data and the page 0x80 serial number if we have already calculated it. Sponsored by: Spectra Logic git-svn-id: svn://svn.freebsd.org/base/stable/10@278169 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/cam/scsi/scsi_xpt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/cam/scsi/scsi_xpt.c b/sys/cam/scsi/scsi_xpt.c index 526aa4167..df82871df 100644 --- a/sys/cam/scsi/scsi_xpt.c +++ b/sys/cam/scsi/scsi_xpt.c @@ -758,7 +758,8 @@ probestart(struct cam_periph *periph, union ccb *start_ccb) * serial number check finish, we attempt to figure out * whether we still have the same device. */ - if ((periph->path->device->flags & CAM_DEV_UNCONFIGURED) == 0) { + if (((periph->path->device->flags & CAM_DEV_UNCONFIGURED) == 0) + && ((softc->flags & PROBE_INQUIRY_CKSUM) == 0)) { MD5Init(&softc->context); MD5Update(&softc->context, (unsigned char *)inq_buf, -- 2.45.0