The default timeo for mount is 600(60s). If the nfs outage time is less than 60s, qemu will not be paused as "io-error". Then the issue does not exist.
This won't be a full solution, but I think the following patch series that I just posted upstream will go a long way towards making this a rarer event.
[PATCH 0/3] qcow2: Fix cluster leaks on write error
Fix included in qemu-kvm-rhev-2.12.0-7.el7
*** Bug 1302929 has been marked as a duplicate of this bug. ***
Verify this issue like below.
1. Use soft mode to mount a nfs server to local directory
# mount -t nfs -o soft 10.73.224.153:/home/nfs /home/share/
2. Copy the installed base file to /home/share/, then boot a vm from base file
-name 'guest-rhel7.5' \
-machine pc \
-vga qxl \
-device virtio-scsi-pci,id=virtio_scsi_pci0,bus=pci.0,addr=0x8 \
-drive id=drive_image1,if=none,snapshot=off,aio=threads,cache=unsafe,format=qcow2,file=/home/share/base.qcow2 \
-device scsi-hd,id=image1,drive=drive_image1,bootindex=0 \
-vnc :0 \
-monitor stdio \
-m 8192 \
-smp 8 \
-device virtio-net-pci,mac=9a:b5:b6:b1:b5:b3,id=idMmq1jH,vectors=4,netdev=idxgXAlm,bus=pci.0,addr=0x9 \
-netdev tap,id=idxgXAlm \
3. Do write opration through dd command in the guest
#dd if=/dev/urandom of=/home/ftest bs=1M count=4096
4. Make nfs outage for a short period
#service nfs stop
#service nfs start
5. Shutdown the guest after dd process finished(if added "rerror=stop,werror=stop", resume the vm first)
6. Check the image
# qemu-img check /home/share/base.qcow2
No errors were found on the image.
93509/327680 = 28.54% allocated, 14.95% fragmented, 0.00% compressed clusters
Image end offset: 6129844224
The result is also correct when adding "rerror=stop,werror=stop" options for qemu-kvm command line to boot base file.
So set the bug as verified.
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.