Improve error handling in do_snapshot_blkdev()

In case we cannot open the newly created snapshot image, try to fall
back to the original image file and continue running on that, which
should prevent the guest from aborting.

This is a corner case which can happen if the admin by mistake
specifies the snapshot file on a virtual file system which does not
support O_DIRECT. bdrv_create() does not use O_DIRECT, but the
following open in bdrv_open() does and will then fail.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
1 file changed
tree: 2ea0699ee2730492ec145bf681d8c75bcafe3ee4
  1. audio/
  2. block/
  3. bsd-user/
  4. darwin-user/
  5. default-configs/
  6. docs/
  7. fpu/
  8. fsdev/
  9. gdb-xml/
  10. hw/
  11. linux-user/
  12. net/
  13. pc-bios/
  14. QMP/
  15. roms/
  16. scripts/
  17. slirp/
  18. sysconfigs/
  19. target-alpha/
  20. target-arm/
  21. target-cris/
  22. target-i386/
  23. target-lm32/
  24. target-m68k/
  25. target-microblaze/
  26. target-mips/
  27. target-ppc/
  28. target-s390x/
  29. target-sh4/
  30. target-sparc/
  31. tcg/
  32. tests/
  33. ui/
  34. .gitignore
  35. .gitmodules
  36. a.out.h
  37. acl.c
  38. acl.h
  39. aes.c
  40. aes.h
  41. aio.c
  42. alpha-dis.c
  43. alpha.ld
  44. arch_init.c
  45. arch_init.h
  46. arm-dis.c
  47. arm-semi.c
  48. arm.ld
  49. async.c
  50. balloon.c
  51. balloon.h
  52. bitmap.c
  53. bitmap.h
  54. bitops.c
  55. bitops.h
  56. block-migration.c
  57. block-migration.h
  58. block.c
  59. block.h
  60. block_int.h
  61. blockdev.c
  62. blockdev.h
  63. bswap.h
  64. bt-host.c
  65. bt-host.h
  66. bt-vhci.c
  67. buffered_file.c
  68. buffered_file.h
  69. cache-utils.c
  70. cache-utils.h
  71. Changelog
  72. check-qdict.c
  73. check-qfloat.c
  74. check-qint.c
  75. check-qjson.c
  76. check-qlist.c
  77. check-qstring.c
  78. cmd.c
  79. cmd.h
  80. CODING_STYLE
  81. compatfd.c
  82. compatfd.h
  83. config.h
  84. configure
  85. console.c
  86. console.h
  87. COPYING
  88. COPYING.LIB
  89. cpu-all.h
  90. cpu-common.h
  91. cpu-defs.h
  92. cpu-exec.c
  93. cpus.c
  94. cpus.h
  95. cris-dis.c
  96. cursor.c
  97. cursor_hidden.xpm
  98. cursor_left_ptr.xpm
  99. cutils.c
  100. def-helper.h
  101. device_tree.c
  102. device_tree.h
  103. dis-asm.h
  104. disas.c
  105. disas.h
  106. dma-helpers.c
  107. dma.h
  108. dyngen-exec.h
  109. elf.h
  110. envlist.c
  111. envlist.h
  112. exec-all.h
  113. exec.c
  114. gdbstub.c
  115. gdbstub.h
  116. gen-icount.h
  117. HACKING
  118. hmp-commands.hx
  119. host-utils.c
  120. host-utils.h
  121. hpet.h
  122. hppa-dis.c
  123. hppa.ld
  124. i386-dis.c
  125. i386.ld
  126. ia64-dis.c
  127. ia64.ld
  128. input.c
  129. ioport-user.c
  130. ioport.c
  131. ioport.h
  132. iorange.h
  133. iov.c
  134. iov.h
  135. json-lexer.c
  136. json-lexer.h
  137. json-parser.c
  138. json-parser.h
  139. json-streamer.c
  140. json-streamer.h
  141. kvm-all.c
  142. kvm-stub.c
  143. kvm.h
  144. libfdt_env.h
  145. LICENSE
  146. linux-aio.c
  147. m68k-dis.c
  148. m68k-semi.c
  149. m68k.ld
  150. MAINTAINERS
  151. Makefile
  152. Makefile.dis
  153. Makefile.hw
  154. Makefile.objs
  155. Makefile.target
  156. Makefile.user
  157. microblaze-dis.c
  158. migration-exec.c
  159. migration-fd.c
  160. migration-tcp.c
  161. migration-unix.c
  162. migration.c
  163. migration.h
  164. mips-dis.c
  165. mips.ld
  166. module.c
  167. module.h
  168. monitor.c
  169. monitor.h
  170. nbd.c
  171. nbd.h
  172. net-checksum.c
  173. net.c
  174. net.h
  175. notify.c
  176. notify.h
  177. os-posix.c
  178. os-win32.c
  179. osdep.c
  180. osdep.h
  181. oslib-posix.c
  182. oslib-win32.c
  183. path.c
  184. pci-ids.txt
  185. pflib.c
  186. pflib.h
  187. poison.h
  188. posix-aio-compat.c
  189. ppc-dis.c
  190. ppc.ld
  191. ppc64.ld
  192. qbool.c
  193. qbool.h
  194. qdict-test-data.txt
  195. qdict.c
  196. qdict.h
  197. qemu-aio.h
  198. qemu-barrier.h
  199. qemu-char.c
  200. qemu-char.h
  201. qemu-common.h
  202. qemu-config.c
  203. qemu-config.h
  204. qemu-doc.texi
  205. qemu-error.c
  206. qemu-error.h
  207. qemu-img-cmds.hx
  208. qemu-img.c
  209. qemu-img.texi
  210. qemu-io.c
  211. qemu-lock.h
  212. qemu-log.h
  213. qemu-malloc.c
  214. qemu-nbd.c
  215. qemu-nbd.texi
  216. qemu-objects.h
  217. qemu-option.c
  218. qemu-option.h
  219. qemu-options.h
  220. qemu-options.hx
  221. qemu-os-posix.h
  222. qemu-os-win32.h
  223. qemu-queue.h
  224. qemu-sockets.c
  225. qemu-tech.texi
  226. qemu-thread-posix.c
  227. qemu-thread-posix.h
  228. qemu-thread-win32.c
  229. qemu-thread-win32.h
  230. qemu-thread.h
  231. qemu-timer-common.c
  232. qemu-timer.c
  233. qemu-timer.h
  234. qemu-tool.c
  235. qemu-x509.h
  236. qemu.sasl
  237. qemu_socket.h
  238. qerror.c
  239. qerror.h
  240. qfloat.c
  241. qfloat.h
  242. qint.c
  243. qint.h
  244. qjson.c
  245. qjson.h
  246. qlist.c
  247. qlist.h
  248. qmp-commands.hx
  249. qobject.h
  250. qstring.c
  251. qstring.h
  252. range.h
  253. readline.c
  254. readline.h
  255. README
  256. rules.mak
  257. rwhandler.c
  258. rwhandler.h
  259. s390-dis.c
  260. s390.ld
  261. savevm.c
  262. sh4-dis.c
  263. simpletrace.c
  264. simpletrace.h
  265. softmmu-semi.h
  266. softmmu_defs.h
  267. softmmu_exec.h
  268. softmmu_header.h
  269. softmmu_template.h
  270. sparc-dis.c
  271. sparc.ld
  272. sparc64.ld
  273. spice-qemu-char.c
  274. sysemu.h
  275. targphys.h
  276. tcg-runtime.c
  277. thunk.c
  278. thunk.h
  279. TODO
  280. trace-events
  281. translate-all.c
  282. uboot_image.h
  283. usb-bsd.c
  284. usb-linux.c
  285. usb-stub.c
  286. VERSION
  287. version.rc
  288. vgafont.h
  289. vl.c
  290. x86_64.ld