zfsonlinux/zfs — pull request #1529 by behlendorf (2013-06-18 17:32:51+00:00)
Title: Register correct handlers in nvlist_alloc()

The non-blocking allocation handlers in nvlist_alloc() would be
mistakenly assigned if any flags other than KM_SLEEP were passed.
This meant that nvlists allocated with KM_PUSHPUSH or other KM_*
debug flags were effectively always using atomic allocations.

While these failures were unlikely it could lead to assertions
because KM_PUSHPAGE allocation in particular are guaranteed to
succeed or block. They must never fail.

Since this code is already wrapped in a _KERNEL define the
cleanest fix is to check the __GFP_HIGH bit. When set the
caller is signaling it is safe for the allocation to block,
when it's clear atomic allocations must be used.

Signed-off-by: Brian Behlendorf
Issue zfsonlinux/spl#249