qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v8 00/16] block: Rework bdrv_close_all()
@ 2016-01-27 17:59 Max Reitz
  2016-01-27 17:59 ` [Qemu-devel] [PATCH v8 01/16] block: Release dirty bitmaps in bdrv_close() Max Reitz
                   ` (16 more replies)
  0 siblings, 17 replies; 38+ messages in thread
From: Max Reitz @ 2016-01-27 17:59 UTC (permalink / raw)
  To: qemu-block
  Cc: Kevin Wolf, Fam Zheng, qemu-devel, Max Reitz, Paolo Bonzini,
	Alberto Garcia, John Snow

Currently, bdrv_close_all() force-closes all BDSs with a BlockBackend,
which can lead to data corruption (see the iotest added in the final
patch of this series) and is most certainly very ugly.

This series reworks bdrv_close_all() to instead eject the BDS trees from
all BlockBackends and then close the monitor-owned BDS trees, which are
the only BDSs without a BB. In effect, all BDSs are closed just by
getting closed automatically due to their reference count becoming 0.

Note that the approach taken here leaks all BlockBackends. This does not
really matter, however, since qemu is about to exit anyway.


*** Note: This series is based on Kevin's block branch ***


v8:
- Dropped seven patches which are in master or Kevin's block branch
  already; dropped another patch that became unnecessary
- Patch 2: qemu-io doesn't prepend "qemu-io: " to error messages anymore
- Patch 4: %s/BLOCK_OP_TYPE_MIRROR/BLOCK_OP_TYPE_MIRROR_SOURCE/
- Patch 5: Moved code according to what Kevin suggested
- Patch 6: Call nbd_export_put() at the end of qmp_nbd_server_add()
  [Kevin]
- Patch 7: notifier_list_notify() in bdrv_close() is now surrounded by
  empty lines, remove one of them
- Patch 12: Remove the BDS from monitor_bdrv_states on late error in
  qmp_blockdev_add()
- Patch 16:
  - Drop qcow1 [Kevin]
  - s/blockdev-remove-medium/x-blockdev-remove-medium/
  - Test non-active block-commit [Kevin]


git-backport-diff against v7:

Key:
[----] : patches are identical
[####] : number of functional differences between upstream/downstream patch
[down] : patch is downstream-only
The flags [FC] indicate (F)unctional and (C)ontextual differences, respectively

001/16:[----] [-C] 'block: Release dirty bitmaps in bdrv_close()'
002/16:[0002] [FC] 'iotests: Add test for eject under NBD server'
003/16:[----] [--] 'block: Add BB-BDS remove/insert notifiers'
004/16:[0004] [FC] 'virtio-blk: Functions for op blocker management'
005/16:[0016] [FC] 'virtio-scsi: Catch BDS-BB removal/insertion'
006/16:[0005] [FC] 'nbd: Switch from close to eject notifier'
007/16:[0001] [FC] 'block: Remove BDS close notifier'
008/16:[----] [--] 'block: Use blk_remove_bs() in blk_delete()'
009/16:[----] [--] 'blockdev: Use blk_remove_bs() in do_drive_del()'
010/16:[----] [--] 'block: Make bdrv_close() static'
011/16:[----] [--] 'block: Add list of all BlockDriverStates'
012/16:[0001] [FC] 'blockdev: Keep track of monitor-owned BDS'
013/16:[----] [--] 'block: Add blk_remove_all_bs()'
014/16:[----] [--] 'block: Rewrite bdrv_close_all()'
015/16:[----] [--] 'iotests: Add test for multiple BB on BDS tree'
016/16:[0052] [FC] 'iotests: Add test for block jobs and BDS ejection'


Max Reitz (16):
  block: Release dirty bitmaps in bdrv_close()
  iotests: Add test for eject under NBD server
  block: Add BB-BDS remove/insert notifiers
  virtio-blk: Functions for op blocker management
  virtio-scsi: Catch BDS-BB removal/insertion
  nbd: Switch from close to eject notifier
  block: Remove BDS close notifier
  block: Use blk_remove_bs() in blk_delete()
  blockdev: Use blk_remove_bs() in do_drive_del()
  block: Make bdrv_close() static
  block: Add list of all BlockDriverStates
  blockdev: Keep track of monitor-owned BDS
  block: Add blk_remove_all_bs()
  block: Rewrite bdrv_close_all()
  iotests: Add test for multiple BB on BDS tree
  iotests: Add test for block jobs and BDS ejection

 block.c                                |  99 +++++++++++++-----
 block/block-backend.c                  |  43 ++++++--
 blockdev-nbd.c                         |  40 +------
 blockdev.c                             |  28 ++++-
 hw/block/dataplane/virtio-blk.c        |  77 ++++++++++----
 hw/scsi/virtio-scsi.c                  |  55 ++++++++++
 include/block/block.h                  |   2 -
 include/block/block_int.h              |   8 +-
 include/hw/virtio/virtio-scsi.h        |  10 ++
 include/sysemu/block-backend.h         |   4 +-
 nbd/server.c                           |  13 +++
 stubs/Makefile.objs                    |   1 +
 stubs/blockdev-close-all-bdrv-states.c |   5 +
 tests/qemu-iotests/117                 |  86 +++++++++++++++
 tests/qemu-iotests/117.out             |  14 +++
 tests/qemu-iotests/140                 |  92 ++++++++++++++++
 tests/qemu-iotests/140.out             |  16 +++
 tests/qemu-iotests/141                 | 186 +++++++++++++++++++++++++++++++++
 tests/qemu-iotests/141.out             |  59 +++++++++++
 tests/qemu-iotests/group               |   3 +
 20 files changed, 750 insertions(+), 91 deletions(-)
 create mode 100644 stubs/blockdev-close-all-bdrv-states.c
 create mode 100755 tests/qemu-iotests/117
 create mode 100644 tests/qemu-iotests/117.out
 create mode 100755 tests/qemu-iotests/140
 create mode 100644 tests/qemu-iotests/140.out
 create mode 100755 tests/qemu-iotests/141
 create mode 100644 tests/qemu-iotests/141.out

-- 
2.7.0

^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2016-01-29 14:13 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-27 17:59 [Qemu-devel] [PATCH v8 00/16] block: Rework bdrv_close_all() Max Reitz
2016-01-27 17:59 ` [Qemu-devel] [PATCH v8 01/16] block: Release dirty bitmaps in bdrv_close() Max Reitz
2016-01-28  3:01   ` Fam Zheng
2016-01-29 13:27     ` Max Reitz
2016-01-27 17:59 ` [Qemu-devel] [PATCH v8 02/16] iotests: Add test for eject under NBD server Max Reitz
2016-01-27 20:56   ` Eric Blake
2016-01-29 13:07     ` Max Reitz
2016-01-28  3:05   ` Fam Zheng
2016-01-27 17:59 ` [Qemu-devel] [PATCH v8 03/16] block: Add BB-BDS remove/insert notifiers Max Reitz
2016-01-28  3:06   ` Fam Zheng
2016-01-27 17:59 ` [Qemu-devel] [PATCH v8 04/16] virtio-blk: Functions for op blocker management Max Reitz
2016-01-28  3:09   ` Fam Zheng
2016-01-27 17:59 ` [Qemu-devel] [PATCH v8 05/16] virtio-scsi: Catch BDS-BB removal/insertion Max Reitz
2016-01-28  3:14   ` Fam Zheng
2016-01-29 12:41   ` Kevin Wolf
2016-01-29 14:13     ` Max Reitz
2016-01-27 17:59 ` [Qemu-devel] [PATCH v8 06/16] nbd: Switch from close to eject notifier Max Reitz
2016-01-28  3:26   ` Fam Zheng
2016-01-29 13:39     ` Max Reitz
2016-01-27 17:59 ` [Qemu-devel] [PATCH v8 07/16] block: Remove BDS close notifier Max Reitz
2016-01-28  3:27   ` Fam Zheng
2016-01-27 17:59 ` [Qemu-devel] [PATCH v8 08/16] block: Use blk_remove_bs() in blk_delete() Max Reitz
2016-01-28  3:28   ` Fam Zheng
2016-01-27 17:59 ` [Qemu-devel] [PATCH v8 09/16] blockdev: Use blk_remove_bs() in do_drive_del() Max Reitz
2016-01-28  3:29   ` Fam Zheng
2016-01-27 17:59 ` [Qemu-devel] [PATCH v8 10/16] block: Make bdrv_close() static Max Reitz
2016-01-27 17:59 ` [Qemu-devel] [PATCH v8 11/16] block: Add list of all BlockDriverStates Max Reitz
2016-01-27 17:59 ` [Qemu-devel] [PATCH v8 12/16] blockdev: Keep track of monitor-owned BDS Max Reitz
2016-01-28  3:33   ` Fam Zheng
2016-01-29 13:44     ` Max Reitz
2016-01-29 13:49       ` Kevin Wolf
2016-01-27 17:59 ` [Qemu-devel] [PATCH v8 13/16] block: Add blk_remove_all_bs() Max Reitz
2016-01-27 17:59 ` [Qemu-devel] [PATCH v8 14/16] block: Rewrite bdrv_close_all() Max Reitz
2016-01-28  4:17   ` Fam Zheng
2016-01-29 13:54     ` Max Reitz
2016-01-27 17:59 ` [Qemu-devel] [PATCH v8 15/16] iotests: Add test for multiple BB on BDS tree Max Reitz
2016-01-27 18:00 ` [Qemu-devel] [PATCH v8 16/16] iotests: Add test for block jobs and BDS ejection Max Reitz
2016-01-29 13:45 ` [Qemu-devel] [PATCH v8 00/16] block: Rework bdrv_close_all() Kevin Wolf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).