svn commit: r328452 - head/sys/cam/nvme
Warner Losh
imp at FreeBSD.org
Fri Jan 26 23:14:47 UTC 2018
Author: imp
Date: Fri Jan 26 23:14:46 2018
New Revision: 328452
URL: https://svnweb.freebsd.org/changeset/base/328452
Log:
Fix a sleepable malloc in ndastart. We shouldn't be sleeping
here. Return ENOMEM when we can't malloc a buffer for the DSM
TRIM. This should fix the WITNESS warnings similar to the following:
uma_zalloc_arg: zone "16" with the following non-sleepable locks held:
exclusive sleep mutex CAM device lock (CAM device lock) r = 0 (0xfffff800080c34d0) locked @ /usr/src/sys/cam/nvme/nvme_da.c:351
Reviewed by: scottl@
Sponsored by: Netflix
Modified:
head/sys/cam/nvme/nvme_da.c
Modified: head/sys/cam/nvme/nvme_da.c
==============================================================================
--- head/sys/cam/nvme/nvme_da.c Fri Jan 26 22:23:24 2018 (r328451)
+++ head/sys/cam/nvme/nvme_da.c Fri Jan 26 23:14:46 2018 (r328452)
@@ -897,7 +897,13 @@ ndastart(struct cam_periph *periph, union ccb *start_c
struct nvme_dsm_range *dsm_range;
dsm_range =
- malloc(sizeof(*dsm_range), M_NVMEDA, M_ZERO | M_WAITOK);
+ malloc(sizeof(*dsm_range), M_NVMEDA, M_ZERO | M_NOWAIT);
+ if (dsm_range == NULL) {
+ biofinish(bp, NULL, ENOMEM);
+ xpt_release_ccb(start_ccb);
+ ndaschedule(periph);
+ return;
+ }
dsm_range->length =
bp->bio_bcount / softc->disk->d_sectorsize;
dsm_range->starting_lba =
More information about the svn-src-all
mailing list