QEMU/KVM: virtiofs causing major freeze problem

After some experimentation I may have found a solution. I read this post:

If virtiofsd is single threaded or does not have a thread pool just
to handle requests which can block for a long time, virtiofsd will
stop processing new requests and virtiofs will come to a halt.

This gave me an idea. I looked at the options for virtiofsd-rust and found this one:

--thread-pool-size <thread-pool-size>

Maximum thread pool size. A value of “0” disables the pool.

Default: 0.

I am using a script to launch virtiofsd when the guest OS is started.

Here is the XML configuration for the virtiofs share inside of virt-manager:

filesystem type=“mount” accessmode=“passthrough”
driver type=“virtiofs” queue=“1024”
source socket=“/tmp/virtiofsd-opensuse154-trafalgar”
target dir=“trafalgar”
alias name=“fs1”
address type=“pci” domain=“0x0000” bus=“0x0e” slot=“0x00” function=“0x0”
filesystem

I added --thread-pool-size=64 to the script:

virtiofsd --socket-path /tmp/virtiofsd-opensuse154-trafalgar --shared-dir /mnt/trafalgar --log-level trace --inode-file-handles=mandatory --posix-acl --thread-pool-size=64

That was about 3 days ago. The guest has been running stable and none of the shares are hung up.