Change M_NOWAIT to M_INTWAIT or M_WAITOK. CAM does a mediocre job checking
for NULL returns from malloc() and even when it does it generally causes
the device operation to fail instead of retrying, resulting in unacceptable
behavior. M_NOWAIT semantics allow NULL to be returned during normal system
operation. This is especially true in DragonFly.
Also remove much of the code that previously checked for NULL. By using
M_INTWAIT or M_WAITOK, malloc() will panic rather then return NULL. Only
the addition of M_NULLOK allows a blocking malloc() to return NULL, and we
do not use that flag in CAM.
Add M_ZERO to a number of malloc()'s and remove subsequent bzero()'s, and
add M_ZERO to a few mallocs (primarily for the read capacity data structure)
that did not bother zeroing out the structure before. While the data is
supposed to be overwritten read-capacity is often quite fragile due to the
SCSI simulation layer, so we do not take any chances.
17 files changed: