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 change okay? Thanks, Ravi (rpokala@0 -----Original Message----- From: <owner-src-committ...@freebsd.org <mailto:owner-src-committ...@freebsd.org>> on behalf of John Baldwin <j...@freebsd.org <mailto:j...@freebsd.org>> Date: Monday, March 10, 2025 at 10:35 To: <src-committ...@freebsd.org <mailto:src-committ...@freebsd.org>>, <dev-commits-src-...@freebsd.org <mailto:dev-commits-src-...@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=78cd83e4017bccf62a291e57f0cceccf80e50423 <https://cgit.FreeBSD.org/src/commit/?id=78cd83e4017bccf62a291e57f0cceccf80e50423> commit 78cd83e4017bccf62a291e57f0cceccf80e50423 Author: John Baldwin <j...@freebsd.org <mailto:j...@freebsd.org>> AuthorDate: 2025-03-10 17:34:44 +0000 Commit: John Baldwin <j...@freebsd.org <mailto:j...@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 = *unitp; @@ -1268,11 +1267,8 @@ devclass_alloc_unit(devclass_t dc, device_t dev, int *unitp) int newsize; newsize = unit + 1; - devices = reallocf(dc->devices, - newsize * sizeof(*dc->devices), M_BUS, M_NOWAIT); - if (devices == NULL) - return (ENOMEM); - dc->devices = devices; + dc->devices = 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 = newsize;