Skip to content

Commit

Permalink
block: for HMP commit() operations on 'all', skip non-COW drives
Browse files Browse the repository at this point in the history
During a commit of 'all' using the HMP non-live commit, the operation
is aborted and returns error on the first error enountered.  When
non-COW drives are in use (e.g. ejected floppy, cdrom, or drives without
a backing parent), that means a commit all will return an error of either
-ENOMEDIUM or -ENOTSUP.  This is not desirable, so for the 'all' commit
case, only attempt the commit if both bs->drv and bs->backing_hd are
present.

More succinctly: 'commit all' now means a commit on all COW drives.

This means an individual commit to a specific non-COW drive will still
return the appropriate error (-ENOMEDIUM if eject / not present, -ENOTSUP
if no backing file).

Reported-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
  • Loading branch information
codyprime authored and stefanhaRH committed Mar 4, 2013
1 parent 1b8bbb4 commit 272d2d8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions block.c
Original file line number Diff line number Diff line change
Expand Up @@ -1640,9 +1640,11 @@ int bdrv_commit_all(void)
BlockDriverState *bs;

QTAILQ_FOREACH(bs, &bdrv_states, list) {
int ret = bdrv_commit(bs);
if (ret < 0) {
return ret;
if (bs->drv && bs->backing_hd) {
int ret = bdrv_commit(bs);
if (ret < 0) {
return ret;
}
}
}
return 0;
Expand Down

0 comments on commit 272d2d8

Please sign in to comment.