md option "async" risks kernel deadlock? Why.

From: Karl Denninger <karl_at_denninger.net>
Date: Wed, 16 Mar 2022 17:55:58 UTC
 From the man page for mdconfig(8)

     -o [no]option
              Set or reset options.

              [no]async
                      For vnode backed devices: avoid IO_SYNC for increased
                      performance but at the risk of deadlocking the entire
                      kernel.

Why and how severe is this risk?

The scenario where I care is the use of md to build and populate a 
"disk" image often used with Crochet and nanobsd so as to create an 
image file that can then be directly dd'd to a media device (e.g. SD 
card) and booted.

When the backing store for this is a ZFS file on spinning rust the 
performance is beyond horrid; about 50tps is all you get, presumably due 
to clashes between the backing store and md itself which winds up 
forcing a crazy amount of seeks.  I suspect its seek-related because if 
the zfs pool is on SSD its plenty fast -- but a backing on spinning 
rust, including all mirror vdev-comprised pools (which are quite fast 
for general file storage) is silly-slow.

Setting the zfs mountpoint to async has no impact on performance.  I 
assume that setting mdconfig's option very well might, but kernel 
deadlocks are bad news, so I'm trying to understand the risk profile 
since these builds are done on a production machine.

Thanks!

-- 
Karl Denninger
karl@denninger.net
/The Market Ticker/
/[S/MIME encrypted email preferred]/