Don't hold the periph locks during dump.

Obtained from:	Netflix
This commit is contained in:
Scott Long 2018-01-09 00:17:15 +00:00
parent 04e814aecd
commit bff0b56cdf

View File

@ -388,15 +388,12 @@ ndadump(void *arg, void *virtual, vm_offset_t physical, off_t offset, size_t len
dp = arg; dp = arg;
periph = dp->d_drv1; periph = dp->d_drv1;
softc = (struct nda_softc *)periph->softc; softc = (struct nda_softc *)periph->softc;
cam_periph_lock(periph);
secsize = softc->disk->d_sectorsize; secsize = softc->disk->d_sectorsize;
lba = offset / secsize; lba = offset / secsize;
count = length / secsize; count = length / secsize;
if ((periph->flags & CAM_PERIPH_INVALID) != 0) { if ((periph->flags & CAM_PERIPH_INVALID) != 0)
cam_periph_unlock(periph);
return (ENXIO); return (ENXIO);
}
/* xpt_get_ccb returns a zero'd allocation for the ccb, mimic that here */ /* xpt_get_ccb returns a zero'd allocation for the ccb, mimic that here */
memset(&nvmeio, 0, sizeof(nvmeio)); memset(&nvmeio, 0, sizeof(nvmeio));
@ -408,7 +405,6 @@ ndadump(void *arg, void *virtual, vm_offset_t physical, off_t offset, size_t len
0, SF_NO_RECOVERY | SF_NO_RETRY, NULL); 0, SF_NO_RECOVERY | SF_NO_RETRY, NULL);
if (error != 0) if (error != 0)
printf("Aborting dump due to I/O error %d.\n", error); printf("Aborting dump due to I/O error %d.\n", error);
cam_periph_unlock(periph);
return (error); return (error);
} }
@ -422,7 +418,6 @@ ndadump(void *arg, void *virtual, vm_offset_t physical, off_t offset, size_t len
0, SF_NO_RECOVERY | SF_NO_RETRY, NULL); 0, SF_NO_RECOVERY | SF_NO_RETRY, NULL);
if (error != 0) if (error != 0)
xpt_print(periph->path, "flush cmd failed\n"); xpt_print(periph->path, "flush cmd failed\n");
cam_periph_unlock(periph);
return (error); return (error);
} }