Date: Thu, 30 Apr 2020 21:08:59 +0000 (UTC) From: Warner Losh <imp@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360508 - head/sys/cam/nvme Message-ID: <202004302108.03UL8xks087664@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202004302108.03UL8xks087664>