public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* ext3 seems to ignore ECC errors
@ 2008-08-04 15:03 Samuel Thibault
  2008-08-04 15:20 ` Samuel Thibault
  2008-08-04 15:39 ` Andreas Schwab
  0 siblings, 2 replies; 7+ messages in thread
From: Samuel Thibault @ 2008-08-04 15:03 UTC (permalink / raw)
  To: linux-kernel

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) {

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-08-04 16:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-04 15:03 ext3 seems to ignore ECC errors Samuel Thibault
2008-08-04 15:20 ` Samuel Thibault
2008-08-04 15:39 ` Andreas Schwab
2008-08-04 15:47   ` Samuel Thibault
2008-08-04 16:12     ` Andreas Schwab
2008-08-04 16:16       ` Samuel Thibault
2008-08-04 16:51     ` Theodore Tso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox