On Tue, Aug 08, 2017 at 01:57:08PM -0400, John Snow wrote: > The block backend changed in a way that flushing empty CDROM drives > is now an error. Amend IDE to avoid doing so until the root problem > can be addressed for 2.11. > > Reported-by: Kieron Shorrock <kshorr...@paloaltonetworks.com> > Signed-off-by: John Snow <js...@redhat.com> > --- > hw/ide/core.c | 11 +++++++---- > 1 file changed, 7 insertions(+), 4 deletions(-) > > diff --git a/hw/ide/core.c b/hw/ide/core.c > index 0b48b64..6cbca43 100644 > --- a/hw/ide/core.c > +++ b/hw/ide/core.c > @@ -1053,17 +1053,21 @@ static void ide_flush_cb(void *opaque, int ret) > ide_set_irq(s->bus); > } > > -static void ide_flush_cache(IDEState *s) > +static bool ide_flush_cache(IDEState *s)
Previously this function invoked ide_flush_cb() to complete the request and raise an IRQ. Now it may return true instead of invoking ide_flush_cb(). It's no longer a helper function, it's more like an IDE command handler. cmd_set_features() must be updated: case 0x82: /* write cache disable */ blk_set_enable_write_cache(s->blk, false); identify_data = (uint16_t *)s->identify_data; put_le16(identify_data + 85, (1 << 14) | 1); ide_flush_cache(s); return false; <--- should be "return ide_flush_cache(s)" To make the code clearer I suggest deleting ide_flush_cache() and calling cmd_flush_cache() directly instead. That way it's obvious that this is an IDE command handler and it may return true to indicate the the command completed immediately. > { > if (s->blk == NULL) { > ide_flush_cb(s, 0); > - return; > + return false; > + } else if (!blk_bs(s->blk)) { > + /* Nothing to flush */ Please move information from the commit description into this comment if you respin. Someone looking at the code might think this is a nop that is safe to remove. Once blk_*() is fixed this code path can be removed again.
signature.asc
Description: PGP signature