ext3 seems to ignore ECC errors

From: Samuel Thibault
Date: Mon Aug 04 2008 - 11:04:17 EST


Hello,

I am having qemu report to its guest that a device is read-only (because
the backend format, file or device is) by returning ECC errors instead
of letting the guest believe that the writes went fine, see patch below.

However, to my surprise Linux (2.6.26) continued to mount the ext3
filesystem read/write, spitting out a lot of IDE errors. Shouldn't
filesystems remount read-only and let the admin try to save data in such
case?

Samuel

Index: hw/ide.c
===================================================================
--- hw/ide.c (révision 4938)
+++ hw/ide.c (copie de travail)
@@ -891,7 +891,6 @@
return 1;
}

-/* XXX: handle errors */
static void ide_read_dma_cb(void *opaque, int ret)
{
BMDMAState *bm = opaque;
@@ -899,6 +898,14 @@
int n;
int64_t sector_num;

+ if (ret) {
+ s->status = READY_STAT | ERR_STAT;
+ s->error = ABRT_ERR | ECC_ERR;
+ s->nsector = 0;
+ ide_set_irq(s);
+ goto eot;
+ }
+
n = s->io_buffer_size >> 9;
sector_num = ide_get_sector(s);
if (n > 0) {
@@ -992,7 +999,6 @@
}
}

-/* XXX: handle errors */
static void ide_write_dma_cb(void *opaque, int ret)
{
BMDMAState *bm = opaque;
@@ -1000,6 +1006,14 @@
int n;
int64_t sector_num;

+ if (ret) {
+ s->status = READY_STAT | ERR_STAT;
+ s->error = ABRT_ERR | ECC_ERR;
+ s->nsector = 0;
+ ide_set_irq(s);
+ goto eot;
+ }
+
n = s->io_buffer_size >> 9;
sector_num = ide_get_sector(s);
if (n > 0) {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/