[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] IDE driver error handling
From: |
andrzej zaborowski |
Subject: |
[Qemu-devel] IDE driver error handling |
Date: |
Fri, 23 Dec 2005 14:16:39 +0100 |
Hi there,
Today when I was running qemu with -snapshot and I noticed strange
things happening in the guest system after some amount of disk IO.
After some time of figuring out I found that the reason was my /tmp
partition (on the host, it is 400 MB big) being full. The guest didn't
receive any error or warning when the temporary QCOW image in /tmp
grew to 400 MB. After some investigation, it turned out that write
errors are generally ignored by the QEMU IDE driver. I came up with
the following changes to make the guest receive an IO error when that
happens. Please note that this works for me but I have little idea
about how IDE works. So I am posting this as a pointer to where the
errors really get ignored for someone who feels like fixing this in
QEMU.
Regards,
wish you a Merry Christmas
Andrew
--- qemu/hw/ide.c 2005-08-06 09:14:32.000000000 +0000
+++ qemu-warnings/hw/ide.c 2005-12-23 12:34:24.000000000 +0000
@@ -676,7 +676,9 @@
n = s->req_nb_sectors;
ret = bdrv_write(s->bs, sector_num, s->io_buffer, n);
s->nsector -= n;
- if (s->nsector == 0) {
+ if (ret) {
+ ide_abort_command(s);
+ } else if (s->nsector == 0) {
/* no more sector to write */
ide_transfer_stop(s);
} else {
@@ -708,7 +710,7 @@
target_phys_addr_t phys_addr,
int transfer_size1)
{
- int len, transfer_size, n;
+ int len, transfer_size, n, ret;
int64_t sector_num;
transfer_size = transfer_size1;
@@ -717,8 +719,8 @@
if (len == 0) {
n = s->io_buffer_size >> 9;
sector_num = ide_get_sector(s);
- bdrv_write(s->bs, sector_num, s->io_buffer,
- s->io_buffer_size >> 9);
+ ret = bdrv_write(s->bs, sector_num, s->io_buffer,
+ s->io_buffer_size >> 9);
sector_num += n;
ide_set_sector(s, sector_num);
s->nsector -= n;
@@ -729,6 +731,11 @@
ide_set_irq(s);
return 0;
}
+ if (ret) {
+ ide_abort_command(s);
+ ide_set_irq(s);
+ return 0;
+ }
if (n > MAX_MULT_SECTORS)
n = MAX_MULT_SECTORS;
s->io_buffer_index = 0;
--
balrog 2oo5
Dear Outlook users: Please remove me from your address books
http://www.newsforge.com/article.pl?sid=03/08/21/143258
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-devel] IDE driver error handling,
andrzej zaborowski <=