Date: Mon, 10 Mar 2025 10:41:46 -0700 From: Ravi Pokala <rpokala@freebsd.org> To: John Baldwin <jhb@FreeBSD.org>, <src-committers@FreeBSD.org>, <dev-commits-src-all@FreeBSD.org>, <dev-commits-src-main@FreeBSD.org> Subject: Re: 78cd83e4017b - main - devclass_alloc_unit: Go back to using M_WAITOK Message-ID: <14C8991D-C686-48DC-9E5D-5F40CE1C75BB@panasas.com> In-Reply-To: <202503101735.52AHZiu6027210@gitrepo.freebsd.org> References: <202503101735.52AHZiu6027210@gitrepo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi John, > This reverts commit 234683726708cf5212d672d676d30056d4133859. The commit message for that change says that this allocation might be done = while holding a lock, and so M_WAITOK is not valid. So then why is this chan= ge okay? Thanks, Ravi (rpokala@0 =EF=BB=BF-----Original Message----- From: <owner-src-committers@freebsd.org <mailto:owner-src-committers@freebs= d.org>> on behalf of John Baldwin <jhb@FreeBSD.org <mailto:jhb@FreeBSD.org>> Date: Monday, March 10, 2025 at 10:35 To: <src-committers@FreeBSD.org <mailto:src-committers@FreeBSD.org>>, <dev-= commits-src-all@FreeBSD.org <mailto:dev-commits-src-all@FreeBSD.org>>, <dev-= commits-src-main@FreeBSD.org <mailto:dev-commits-src-main@FreeBSD.org>> Subject: git: 78cd83e4017b - main - devclass_alloc_unit: Go back to using M= _WAITOK The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=3D78cd83e4017bccf62a291e57f0ccec= cf80e50423 <https://cgit.FreeBSD.org/src/commit/?id=3D78cd83e4017bccf62a291e57= f0cceccf80e50423> commit 78cd83e4017bccf62a291e57f0cceccf80e50423 Author: John Baldwin <jhb@FreeBSD.org <mailto:jhb@FreeBSD.org>> AuthorDate: 2025-03-10 17:34:44 +0000 Commit: John Baldwin <jhb@FreeBSD.org <mailto:jhb@FreeBSD.org>> CommitDate: 2025-03-10 17:34:44 +0000 devclass_alloc_unit: Go back to using M_WAITOK This restores a change made earlier in f3d3c63442fff. This reverts commit 234683726708cf5212d672d676d30056d4133859. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D49273 <https://reviews.= freebsd.org/D49273> --- sys/kern/subr_bus.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index 38a8cab639e4..63de61262554 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -1211,7 +1211,6 @@ devclass_get_sysctl_tree(devclass_t dc) static int devclass_alloc_unit(devclass_t dc, device_t dev, int *unitp) { - device_t *devices; const char *s; int unit =3D *unitp; @@ -1268,11 +1267,8 @@ devclass_alloc_unit(devclass_t dc, device_t dev, int= *unitp) int newsize; newsize =3D unit + 1; - devices =3D reallocf(dc->devices, - newsize * sizeof(*dc->devices), M_BUS, M_NOWAIT); - if (devices =3D=3D NULL) - return (ENOMEM); - dc->devices =3D devices; + dc->devices =3D reallocf(dc->devices, + newsize * sizeof(*dc->devices), M_BUS, M_WAITOK); memset(dc->devices + dc->maxunit, 0, sizeof(device_t) * (newsize - dc->maxunit)); dc->maxunit =3D newsize;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?14C8991D-C686-48DC-9E5D-5F40CE1C75BB>