Import Illumos changeset illumos/illumos-gate@e722410c49fe67cbf0f639cbcc288bd6cbcf7dd1

4347 ZPL can use dmu_tx_assign(TXG_WAIT)
Replace the TDP_NOSLEEPING flag with a counter so that the
THREAD_NO_SLEEPING() and THREAD_SLEEPING_OK() macros can nest.

Reviewed by:	attilio

(cherry picked from commit 8857575b13cf118cc89efb1b462dd314df09c180)

Ticket: #3509