From owner-svn-src-all@freebsd.org Fri Jan 26 23:14:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 34046ECEEA2; Fri, 26 Jan 2018 23:14:47 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CE0866A664; Fri, 26 Jan 2018 23:14:46 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C5469220D5; Fri, 26 Jan 2018 23:14:46 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0QNEkGp066085; Fri, 26 Jan 2018 23:14:46 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0QNEkpP066084; Fri, 26 Jan 2018 23:14:46 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801262314.w0QNEkpP066084@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 26 Jan 2018 23:14:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328452 - head/sys/cam/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/nvme X-SVN-Commit-Revision: 328452 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jan 2018 23:14:47 -0000 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 =