Author: imp Date: Thu Apr 30 21:08:59 2020 New Revision: 360508 URL: https://svnweb.freebsd.org/changeset/base/360508
Log: Fix three bugs highlighted by review: - maxio should be dp->d_maxsize. This is often MAXPHYS, but not always (especially if MAXPHYS is > 1MB). - Unlock the periph before returning. We don't need to relock it to release the ccb. - Make sure we release the ccb in error paths. Reviewed by: cperciva Modified: head/sys/cam/nvme/nvme_da.c Modified: head/sys/cam/nvme/nvme_da.c ============================================================================== --- head/sys/cam/nvme/nvme_da.c Thu Apr 30 21:08:22 2020 (r360507) +++ head/sys/cam/nvme/nvme_da.c Thu Apr 30 21:08:59 2020 (r360508) @@ -402,7 +402,7 @@ ndaioctl(struct disk *dp, u_long cmd, void *data, int struct nvme_pt_command *pt; union ccb *ccb; struct cam_periph_map_info mapinfo; - u_int maxmap = MAXPHYS; /* XXX is this right */ + u_int maxmap = dp->d_maxsize; int error; /* @@ -426,8 +426,10 @@ ndaioctl(struct disk *dp, u_long cmd, void *data, int */ memset(&mapinfo, 0, sizeof(mapinfo)); error = cam_periph_mapmem(ccb, &mapinfo, maxmap); - if (error) + if (error) { + xpt_release_ccb(ccb); return (error); + } /* * Lock the periph and run the command. XXX do we need @@ -442,7 +444,6 @@ ndaioctl(struct disk *dp, u_long cmd, void *data, int * Tear down mapping and return status. */ cam_periph_unmapmem(ccb, &mapinfo); - cam_periph_lock(periph); error = (ccb->ccb_h.status == CAM_REQ_CMP) ? 0 : EIO; xpt_release_ccb(ccb); return (error); _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"