All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v3 0/7] qemu-img: Add salvaging mode to convert
@ 2019-04-13 16:53 ` Max Reitz
  0 siblings, 0 replies; 36+ messages in thread
From: Max Reitz @ 2019-04-13 16:53 UTC (permalink / raw)
  To: qemu-block
  Cc: qemu-devel, Max Reitz, Vladimir Sementsov-Ogievskiy,
	Andrey Shinkevich, Eric Blake, Kevin Wolf, Denis V . Lunev

Hi,

This series adds a --salvage option to qemu-img convert.  With this,
qemu-img will not abort when it encounters an I/O error.  Instead, it
tries to narrow it down and will treat the affected sectors as being
completely 0 (and print a warning).

Testing this is not so easy, because while real I/O errors during read
operations should be treated as described above, errors encountered
during bdrv_block_status() should just be ignored and the affected
sectors should be considered allocated.  But blkdebug does not yet have
a way to intercept this, and:

(1) Just adding a new block-status event would be silly, because I don't
    want an event, I want it to fail on a certain kind of operation, on
    a certain sector range, independently of any events, so why can't we
    just do that?  See patch 4.

(2) If we just make blkdebug intercept .bdrv_co_block_status() like all
    other kinds of operations, at least iotest 041 fails, which does
    exactly that silly thing: It uses the read_aio event to wait for any
    read.  But it turns out that there may be a bdrv_*block_status()
    call in between, so suddenly the wrong operation yields an error.
    As I said, the real fault here is that it does not really make sense
    to pray that the operation you want to fail is the one that is
    immediately executed after some event that you hope will trigger
    that operation.
    See patch 3.

So patch 3 allows blkdebug users to select which kind of I/O operation
they actually want to make fail, and patch 4 allows them to not use any
event, but to have a rule active all the time.

Together, we can then enable error injection for block-status in patch 5
and make use of event=none iotype=block-status in patch 6.


v3:
- Patch 2: Forbid combination of -C and --salvage instead of noting that
           it does nothing [Vladimir]
  (Also, a rebase conflict)
- Patch 7 (new): Test that


git-backport-diff against v3:

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/7:[----] [--] 'qemu-img: Move quiet into ImgConvertState'
002/7:[0012] [FC] 'qemu-img: Add salvaging mode to convert'
003/7:[----] [--] 'blkdebug: Add @iotype error option'
004/7:[----] [--] 'blkdebug: Add "none" event'
005/7:[----] [--] 'blkdebug: Inject errors on .bdrv_co_block_status()'
006/7:[----] [--] 'iotests: Test qemu-img convert --salvage'
007/7:[down] 'iotests: Test qemu-img convert -C --salvage'


Max Reitz (7):
  qemu-img: Move quiet into ImgConvertState
  qemu-img: Add salvaging mode to convert
  blkdebug: Add @iotype error option
  blkdebug: Add "none" event
  blkdebug: Inject errors on .bdrv_co_block_status()
  iotests: Test qemu-img convert --salvage
  iotests: Test qemu-img convert -C --salvage

 qapi/block-core.json       |  33 +++++++-
 block/blkdebug.c           |  60 ++++++++++++--
 qemu-img.c                 | 103 +++++++++++++++++------
 qemu-img-cmds.hx           |   4 +-
 qemu-img.texi              |   4 +
 tests/qemu-iotests/082     |   1 +
 tests/qemu-iotests/082.out |   3 +
 tests/qemu-iotests/249     | 163 +++++++++++++++++++++++++++++++++++++
 tests/qemu-iotests/249.out |  43 ++++++++++
 tests/qemu-iotests/group   |   1 +
 10 files changed, 376 insertions(+), 39 deletions(-)
 create mode 100755 tests/qemu-iotests/249
 create mode 100644 tests/qemu-iotests/249.out

-- 
2.20.1

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

end of thread, other threads:[~2019-04-24 15:23 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-13 16:53 [Qemu-devel] [PATCH v3 0/7] qemu-img: Add salvaging mode to convert Max Reitz
2019-04-13 16:53 ` Max Reitz
2019-04-13 16:53 ` [Qemu-devel] [PATCH v3 1/7] qemu-img: Move quiet into ImgConvertState Max Reitz
2019-04-13 16:53   ` Max Reitz
2019-04-13 16:53 ` [Qemu-devel] [PATCH v3 2/7] qemu-img: Add salvaging mode to convert Max Reitz
2019-04-13 16:53   ` Max Reitz
2019-04-16  6:40   ` Vladimir Sementsov-Ogievskiy
2019-04-16  6:40     ` Vladimir Sementsov-Ogievskiy
2019-04-13 16:53 ` [Qemu-devel] [PATCH v3 3/7] blkdebug: Add @iotype error option Max Reitz
2019-04-13 16:53   ` Max Reitz
2019-04-16  7:18   ` Vladimir Sementsov-Ogievskiy
2019-04-16  7:18     ` Vladimir Sementsov-Ogievskiy
2019-04-17 16:36     ` Max Reitz
2019-04-17 16:36       ` Max Reitz
2019-04-13 16:53 ` [Qemu-devel] [PATCH v3 4/7] blkdebug: Add "none" event Max Reitz
2019-04-13 16:53   ` Max Reitz
2019-04-16  7:21   ` Vladimir Sementsov-Ogievskiy
2019-04-16  7:21     ` Vladimir Sementsov-Ogievskiy
2019-04-13 16:53 ` [Qemu-devel] [PATCH v3 5/7] blkdebug: Inject errors on .bdrv_co_block_status() Max Reitz
2019-04-13 16:53   ` Max Reitz
2019-04-16  7:23   ` Vladimir Sementsov-Ogievskiy
2019-04-16  7:23     ` Vladimir Sementsov-Ogievskiy
2019-04-13 16:53 ` [Qemu-devel] [PATCH v3 6/7] iotests: Test qemu-img convert --salvage Max Reitz
2019-04-13 16:53   ` Max Reitz
2019-04-16  8:02   ` Vladimir Sementsov-Ogievskiy
2019-04-16  8:02     ` Vladimir Sementsov-Ogievskiy
2019-04-17 16:42     ` Max Reitz
2019-04-17 16:42       ` Max Reitz
2019-04-24 15:21   ` Thomas Huth
2019-04-24 15:21     ` Thomas Huth
2019-04-13 16:53 ` [Qemu-devel] [PATCH v3 7/7] iotests: Test qemu-img convert -C --salvage Max Reitz
2019-04-13 16:53   ` Max Reitz
2019-04-16  8:13   ` Vladimir Sementsov-Ogievskiy
2019-04-16  8:13     ` Vladimir Sementsov-Ogievskiy
2019-04-17 16:43     ` Max Reitz
2019-04-17 16:43       ` Max Reitz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.