qcow2: Bring synchronous read/write back to life

When the synchronous read and write functions were dropped, they were replaced
by generic emulation functions. Unfortunately, these emulation functions don't
provide the same semantics as the original functions did.

The original bdrv_read would mean that we read some data synchronously and that
we won't be interrupted during this read. The latter assumption is no longer
true with the emulation function which needs to use qemu_aio_poll and therefore
allows the callback of any other concurrent AIO request to be run during the
read. Which in turn means that (meta)data read earlier could have changed and
be invalid now. qcow2 is not prepared to work in this way and it's just scary
how many places there are where other requests could run.

I'm not sure yet where exactly it breaks, but you'll see breakage with virtio
on qcow2 with a backing file. Providing synchronous functions again fixes the
problem for me.

Patchworks-ID: 35437
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit ef845c3bf421290153154635dc18eaa677cecb43)

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
3 files changed
tree: eb72c9f023390352184a981fb23df34234e2a6e5
  1. .gitignore
  2. CODING_STYLE
  3. COPYING
  4. COPYING.LIB
  5. Changelog
  6. LICENSE
  7. MAINTAINERS
  8. Makefile
  9. Makefile.hw
  10. Makefile.target
  11. README
  12. TODO
  13. VERSION
  14. a.out.h
  15. acl.c
  16. acl.h
  17. aes.c
  18. aes.h
  19. aio.c
  20. alpha-dis.c
  21. alpha.ld
  22. arm-dis.c
  23. arm-semi.c
  24. arm.ld
  25. audio/
  26. balloon.h
  27. block.c
  28. block.h
  29. block/
  30. block_int.h
  31. bsd-user/
  32. bswap.h
  33. bt-host.c
  34. bt-host.h
  35. bt-vhci.c
  36. buffered_file.c
  37. buffered_file.h
  38. cache-utils.c
  39. cache-utils.h
  40. cmd.c
  41. cmd.h
  42. cocoa.m
  43. configure
  44. console.c
  45. console.h
  46. cpu-all.h
  47. cpu-common.h
  48. cpu-defs.h
  49. cpu-exec.c
  50. create_config
  51. cris-dis.c
  52. curses.c
  53. curses_keys.h
  54. cutils.c
  55. d3des.c
  56. d3des.h
  57. darwin-user/
  58. def-helper.h
  59. device_tree.c
  60. device_tree.h
  61. dis-asm.h
  62. disas.c
  63. disas.h
  64. dma-helpers.c
  65. dma.h
  66. dyngen-exec.h
  67. elf.h
  68. elf_ops.h
  69. exec-all.h
  70. exec.c
  71. feature_to_c.sh
  72. fpu/
  73. gdb-xml/
  74. gdbstub.c
  75. gdbstub.h
  76. gen-icount.h
  77. host-utils.c
  78. host-utils.h
  79. hostregs_helper.h
  80. hpet.h
  81. hppa-dis.c
  82. hppa.ld
  83. hw/
  84. hxtool
  85. i386-dis.c
  86. i386.ld
  87. ia64.ld
  88. ioport-user.c
  89. ioport.c
  90. ioport.h
  91. keymaps.c
  92. keymaps.h
  93. kqemu.c
  94. kqemu.h
  95. kvm-all.c
  96. kvm.h
  97. libfdt_env.h
  98. linux-user/
  99. loader.c
  100. m68k-dis.c
  101. m68k-semi.c
  102. m68k.ld
  103. microblaze-dis.c
  104. migration-exec.c
  105. migration-tcp.c
  106. migration.c
  107. migration.h
  108. mips-dis.c
  109. mips.ld
  110. mipsel.ld
  111. module.c
  112. module.h
  113. monitor.c
  114. monitor.h
  115. nbd.c
  116. nbd.h
  117. net-checksum.c
  118. net.c
  119. net.h
  120. osdep.c
  121. osdep.h
  122. pc-bios/
  123. pci-ids.txt
  124. posix-aio-compat.c
  125. posix-aio-compat.h
  126. ppc-dis.c
  127. ppc.ld
  128. ppc64.ld
  129. qemu-aio.h
  130. qemu-binfmt-conf.sh
  131. qemu-char.c
  132. qemu-char.h
  133. qemu-common.h
  134. qemu-doc.texi
  135. qemu-img-cmds.hx
  136. qemu-img.c
  137. qemu-img.texi
  138. qemu-io.c
  139. qemu-lock.h
  140. qemu-log.h
  141. qemu-malloc.c
  142. qemu-monitor.hx
  143. qemu-nbd.c
  144. qemu-nbd.texi
  145. qemu-option.c
  146. qemu-option.h
  147. qemu-options.hx
  148. qemu-sockets.c
  149. qemu-tech.texi
  150. qemu-thread.c
  151. qemu-thread.h
  152. qemu-timer.h
  153. qemu-tool.c
  154. qemu.sasl
  155. qemu_socket.h
  156. readline.c
  157. readline.h
  158. rules.mak
  159. s390-dis.c
  160. s390.ld
  161. savevm.c
  162. sdl.c
  163. sdl_keysym.h
  164. sdl_zoom.c
  165. sdl_zoom.h
  166. sdl_zoom_template.h
  167. sh4-dis.c
  168. slirp/
  169. softmmu-semi.h
  170. softmmu_defs.h
  171. softmmu_exec.h
  172. softmmu_header.h
  173. softmmu_template.h
  174. sparc-dis.c
  175. sparc.ld
  176. sparc64.ld
  177. sys-queue.h
  178. sysemu.h
  179. tap-win32.c
  180. target-alpha/
  181. target-arm/
  182. target-cris/
  183. target-i386/
  184. target-m68k/
  185. target-microblaze/
  186. target-mips/
  187. target-ppc/
  188. target-sh4/
  189. target-sparc/
  190. targphys.h
  191. tcg/
  192. tests/
  193. texi2pod.pl
  194. thunk.c
  195. thunk.h
  196. tool-osdep.c
  197. translate-all.c
  198. uboot_image.h
  199. usb-bsd.c
  200. usb-linux.c
  201. usb-stub.c
  202. vgafont.h
  203. vl.c
  204. vnc-auth-sasl.c
  205. vnc-auth-sasl.h
  206. vnc-auth-vencrypt.c
  207. vnc-auth-vencrypt.h
  208. vnc-tls.c
  209. vnc-tls.h
  210. vnc.c
  211. vnc.h
  212. vnc_keysym.h
  213. vnchextile.h
  214. x86_64.ld
  215. x_keymap.c
  216. x_keymap.h