git: 4068f3b5f899 - main - nda: Don't sleep with non-sleepable lock held

From: Colin Percival <cperciva_at_FreeBSD.org>
Date: Tue, 28 Jul 2026 23:28:50 UTC
The branch main has been updated by cperciva:

URL: https://cgit.FreeBSD.org/src/commit/?id=4068f3b5f899dd348fd063a5f3c30090eebf9a46

commit 4068f3b5f899dd348fd063a5f3c30090eebf9a46
Author:     Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2026-07-14 17:17:25 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2026-07-28 23:28:36 +0000

    nda: Don't sleep with non-sleepable lock held
    
    We reach ndaasync with the CAM device lock held, so we must pass
    M_NOWAIT to disk_* rather than M_WAITOK.
    
    Reviewed by:    imp
    Fixes:  628d7a3270b6 ("nda: AC_GETDEV_CHANGED calls media chanaged for sectorsize change")
    MFC after:      1 week
    Sponsored by:   Amazon
    Differential Revision:  https://reviews.freebsd.org/D58230
---
 sys/cam/nvme/nvme_da.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/cam/nvme/nvme_da.c b/sys/cam/nvme/nvme_da.c
index be578bae5da5..ebebe5bbc0a9 100644
--- a/sys/cam/nvme/nvme_da.c
+++ b/sys/cam/nvme/nvme_da.c
@@ -773,9 +773,9 @@ ndaasync(void *callback_arg, uint32_t code, struct cam_path *path, void *arg)
 		 * do nothing.
 		 */
 		if (sectorsize != softc->disk->d_sectorsize)
-			disk_media_changed(softc->disk, M_WAITOK);
+			disk_media_changed(softc->disk, M_NOWAIT);
 		else if (mediasize != softc->disk->d_mediasize)
-			disk_resize(softc->disk, M_WAITOK);
+			disk_resize(softc->disk, M_NOWAIT);
 		break;
 	}
 	case AC_ADVINFO_CHANGED: