]>
Commit | Line | Data |
---|---|---|
3dcc8d3b | 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
ddbcf45e WB |
2 | From: Stefan Hajnoczi <stefanha@redhat.com> |
3 | Date: Wed, 9 Aug 2017 17:02:11 +0100 | |
3dcc8d3b | 4 | Subject: [PATCH] IDE: Do not flush empty CDROM drives |
ddbcf45e WB |
5 | |
6 | The block backend changed in a way that flushing empty CDROM drives now | |
7 | crashes. Amend IDE to avoid doing so until the root problem can be | |
8 | addressed for 2.11. | |
9 | ||
10 | Original patch by John Snow <jsnow@redhat.com>. | |
11 | ||
12 | Reported-by: Kieron Shorrock <kshorrock@paloaltonetworks.com> | |
13 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | |
14 | Reviewed-by: Eric Blake <eblake@redhat.com> | |
15 | Message-id: 20170809160212.29976-2-stefanha@redhat.com | |
16 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | |
17 | --- | |
18 | hw/ide/core.c | 10 +++++++++- | |
19 | 1 file changed, 9 insertions(+), 1 deletion(-) | |
20 | ||
21 | diff --git a/hw/ide/core.c b/hw/ide/core.c | |
22 | index 0b48b64d3a..bea39536b0 100644 | |
23 | --- a/hw/ide/core.c | |
24 | +++ b/hw/ide/core.c | |
25 | @@ -1063,7 +1063,15 @@ static void ide_flush_cache(IDEState *s) | |
26 | s->status |= BUSY_STAT; | |
27 | ide_set_retry(s); | |
28 | block_acct_start(blk_get_stats(s->blk), &s->acct, 0, BLOCK_ACCT_FLUSH); | |
29 | - s->pio_aiocb = blk_aio_flush(s->blk, ide_flush_cb, s); | |
30 | + | |
31 | + if (blk_bs(s->blk)) { | |
32 | + s->pio_aiocb = blk_aio_flush(s->blk, ide_flush_cb, s); | |
33 | + } else { | |
34 | + /* XXX blk_aio_flush() crashes when blk_bs(blk) is NULL, remove this | |
35 | + * temporary workaround when blk_aio_*() functions handle NULL blk_bs. | |
36 | + */ | |
37 | + ide_flush_cb(s, 0); | |
38 | + } | |
39 | } | |
40 | ||
41 | static void ide_cfata_metadata_inquiry(IDEState *s) | |
42 | -- | |
43 | 2.11.0 | |
44 |