1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-04 12:52:15 +00:00

Fix panic on shutdown of ramdisk LU with zero capacity.

MFC after:	1 week
This commit is contained in:
Alexander Motin 2017-02-14 18:03:17 +00:00
parent 90f90687b3
commit 2fb3637007
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=313736

View File

@ -1120,8 +1120,10 @@ ctl_backend_ramdisk_create(struct ctl_be_ramdisk_softc *softc,
STAILQ_INIT(&be_lun->cont_queue);
sx_init(&be_lun->page_lock, "cram page lock");
if (be_lun->cap_bytes == 0)
if (be_lun->cap_bytes == 0) {
be_lun->indir = 0;
be_lun->pages = malloc(be_lun->pblocksize, M_RAMDISK, M_WAITOK);
}
be_lun->zero_page = malloc(be_lun->pblocksize, M_RAMDISK,
M_WAITOK|M_ZERO);
mtx_init(&be_lun->queue_lock, "cram queue lock", NULL, MTX_DEF);