Fix z_wr_iss_h zio_execute() import hang
authorBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 14 Aug 2013 23:18:58 +0000 (16:18 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 15 Aug 2013 22:20:36 +0000 (15:20 -0700)
commit34e143323e359b42bc9d06dd19cc4b1f13091283
treed38649ddbcacd0c45d4f4c26242e180c1d742113
parent0bc7a7a75429f3f5dc68e57dfad4c5fb84a48558
Fix z_wr_iss_h zio_execute() import hang

Because we need to be more frugal about our stack usage under
Linux.  The __zio_execute() function was modified to re-dispatch
zios to a ZIO_TASKQ_ISSUE thread when we're in a context which
is known to be stack heavy.  Those two contexts are the sync
thread and what ever thread is performing spa initialization.

Unfortunately, this change introduced an unlikely bug which can
result in a zio being re-dispatched indefinitely and never being
executed.  If during spa initialization we handle a zio with
ZIO_PRIORITY_NOW it will be moved to the high priority queue.
When __zio_execute() is called again for the zio it will mis-
interpret the context and re-dispatch it again.  The system
will get stuck spinning re-dispatching the zio and making no
forward progress.

To fix this rare issue __zio_execute() has been updated not
to re-dispatch zios on either the ZIO_TASKQ_ISSUE or
ZIO_TASKQ_ISSUE_HIGH task queues.

In practice this issue was rarely reported and can usually
be fixed by rebooting the system and importing the pool again.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1455
module/zfs/zio.c