qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v9 00/16] block: Rework bdrv_close_all()
@ 2016-01-29 15:36 Max Reitz
  2016-01-29 15:36 ` [Qemu-devel] [PATCH v9 01/16] block: Release named dirty bitmaps in bdrv_close() Max Reitz
                   ` (15 more replies)
  0 siblings, 16 replies; 20+ messages in thread
From: Max Reitz @ 2016-01-29 15:36 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 ***


v9:
- Patch 1: Only release named dirty bitmaps, and assert that there are
  no unnamed left [Fam]
- Patches 2, 15, 16: Bumped year from 2015 to 2016; I kept the R-bs
  because this seemed like a very straightforward change to me
  [Eric]
- Patch 5: Set up the notifiers only after the last (and only) error
  path in virtio_scsi_hotplug() in order not to leak them [Kevin]
- Patch 12:
  - Added a note to the commit message about the change to
    qmp_x_blockdev_del() [Fam]
  - Dropped the !QLIST_EMPTY() check in qmp_x_blockdev_del(); the newly
    introduced check fulfills the same task while being more explicit
    about it [Kevin]
- Patch 14:
  - Changed the order of blk_remove_all_bs() and
    blockdev_close_all_bdrv_states() [Fam]
  - Dropped the aio_poll() loop; it is unneccessary now that
    block_job_cancel_sync() effectively calls block_job_unref() by
    itself


git-backport-diff against v8:

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:[down] 'block: Release named 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:[----] [--] 'virtio-blk: Functions for op blocker management'
005/16:[0002] [FC] 'virtio-scsi: Catch BDS-BB removal/insertion'
006/16:[----] [--] 'nbd: Switch from close to eject notifier'
007/16:[----] [-C] '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:[----] [-C] 'block: Make bdrv_close() static'
011/16:[----] [--] 'block: Add list of all BlockDriverStates'
012/16:[0004] [FC] 'blockdev: Keep track of monitor-owned BDS'
013/16:[----] [--] 'block: Add blk_remove_all_bs()'
014/16:[0013] [FC] 'block: Rewrite bdrv_close_all()'
015/16:[0002] [FC] 'iotests: Add test for multiple BB on BDS tree'
016/16:[0002] [FC] 'iotests: Add test for block jobs and BDS ejection'


Max Reitz (16):
  block: Release named 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                                |  90 +++++++++++-----
 block/block-backend.c                  |  43 ++++++--
 blockdev-nbd.c                         |  40 +------
 blockdev.c                             |  30 +++++-
 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, 742 insertions(+), 92 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] 20+ messages in thread

end of thread, other threads:[~2016-02-08 11:54 UTC | newest]

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

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).