[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 13/15] AHCI: Fix port reset race
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 13/15] AHCI: Fix port reset race |
Date: |
Fri, 10 Feb 2012 13:47:42 +0100 |
From: Alexander Graf <address@hidden>
bdrv_aio_cancel() can trigger bdrv_aio_flush() which makes all aio
that is currently in flight finish. So what we do is:
port reset
detect ncq in flight
cancel ncq
delete ncq sg list
at which point we have double freed the sg list. Instead, with this
patch we do:
port reset
detect ncq in flight
cancel ncq
check if we are really still in flight
delete ncq sg list
which makes things work and gets rid of the race.
Signed-off-by: Alexander Graf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
hw/ide/ahci.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index c87a6ca..caff7bc 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -560,6 +560,11 @@ static void ahci_reset_port(AHCIState *s, int port)
ncq_tfs->aiocb = NULL;
}
+ /* Maybe we just finished the request thanks to bdrv_aio_cancel() */
+ if (!ncq_tfs->used) {
+ continue;
+ }
+
qemu_sglist_destroy(&ncq_tfs->sglist);
ncq_tfs->used = 0;
}
--
1.7.6.5
- [Qemu-devel] [PATCH 04/15] qed: replace is_write with flags field, (continued)
- [Qemu-devel] [PATCH 04/15] qed: replace is_write with flags field, Kevin Wolf, 2012/02/10
- [Qemu-devel] [PATCH 05/15] qed: add .bdrv_co_write_zeroes() support, Kevin Wolf, 2012/02/10
- [Qemu-devel] [PATCH 06/15] qemu-io: add write -z option for bdrv_co_write_zeroes, Kevin Wolf, 2012/02/10
- [Qemu-devel] [PATCH 14/15] sheepdog: fix co_recv coroutine context, Kevin Wolf, 2012/02/10
- [Qemu-devel] [PATCH 15/15] AHCI: Masking of IRQs actually masks them, Kevin Wolf, 2012/02/10
- [Qemu-devel] [PATCH 09/15] vpc: Round up image size during fixed image creation, Kevin Wolf, 2012/02/10
- [Qemu-devel] [PATCH 11/15] qcow2: Keep unknown header extension when rewriting header, Kevin Wolf, 2012/02/10
- [Qemu-devel] [PATCH 12/15] rewrite QEMU_BUILD_BUG_ON, Kevin Wolf, 2012/02/10
- [Qemu-devel] [PATCH 10/15] qcow2: Update whole header at once, Kevin Wolf, 2012/02/10
- [Qemu-devel] [PATCH 08/15] vpc: Add support for Fixed Disk type, Kevin Wolf, 2012/02/10
- [Qemu-devel] [PATCH 13/15] AHCI: Fix port reset race,
Kevin Wolf <=
- [Qemu-devel] [PATCH 07/15] iSCSI: add configuration variables for iSCSI, Kevin Wolf, 2012/02/10
- Re: [Qemu-devel] [PULL 00/15] Block patches, Kevin Wolf, 2012/02/15
- Re: [Qemu-devel] [PULL 00/15] Block patches, Anthony Liguori, 2012/02/15