Skip to contentSkip to conversation

ext3 seems to ignore ECC errors

PATCH Samuel Thibault 3 participants 7 messages Aug 4, 2008

lore
Share & tools
lore
#0 lore raw

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

ide.c +16 -2
Index: hw/ide.c
===================================================================
@@ -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) {
#1 lore raw
Quoted 2 lines · Samuel Thibault, le Mon 04 Aug 2008 16:03:53 +0100, a écrit :

However, to my surprise Linux (2.6.26) continued to mount the ext3 filesystem read/write, spitting out a lot of IDE errors.

Note: these look like

hdb: dma_intr: status=0x41 { DriveReady Error }
hdb: dma_intr: error=0x44 { DriveStatusError UncorrectableError }, LBAsect=1189689234687, sector=70911
ide: failed opcode was: unknown
end_request: I/O/error, dev hdb sector 70911
Buffer I/O error on device hdb1, logical block 8856
lost page write due to I/O error on hdb1
etc.

So it seems the error is properly reported up to the filesystem ((70911-63) * 512 / 4096 == 8856)

Samuel

#2 lore raw
In reply to Samuel Thibault
Quoted 4 lines · Samuel Thibault

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?

That's a tunable parameter of the filesystem, see tune2fs(8).

Andreas.

Signature · 4 lines
Andreas Schwab, SuSE Labs, [email protected]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
#3 lore raw
Quoted 7 lines · Andreas Schwab, le Mon 04 Aug 2008 17:39:06 +0200, a écrit :
Quoted 4 lines · Samuel Thibault

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?

That's a tunable parameter of the filesystem, see tune2fs(8).

Oh, I had assumed it was on by default, hum. But now it reads

Errors behavior: Remount read-only

and I am still getting the same behavior. Indeed after some VFS modifications time it gets remounted read-only, but shouldn't that happen as soon as possible?

Samuel

#4 lore raw
Quoted 9 lines · Samuel Thibault
Quoted 7 lines · Andreas Schwab, le Mon 04 Aug 2008 17:39:06 +0200, a écrit :
Quoted 4 lines · Samuel Thibault

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?

That's a tunable parameter of the filesystem, see tune2fs(8).

Quoted 7 lines

Oh, I had assumed it was on by default, hum. But now it reads

Errors behavior: Remount read-only

and I am still getting the same behavior. Indeed after some VFS modifications time it gets remounted read-only, but shouldn't that happen as soon as possible?

The block device may do some retries before passing the error on.

Andreas.

Signature · 4 lines
Andreas Schwab, SuSE Labs, [email protected]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
#5 lore raw
Quoted 13 lines · Andreas Schwab, le Mon 04 Aug 2008 18:12:54 +0200, a écrit :
Quoted 11 lines · Samuel Thibault
Quoted 7 lines · Andreas Schwab, le Mon 04 Aug 2008 17:39:06 +0200, a écrit :
Quoted 4 lines · Samuel Thibault

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?

That's a tunable parameter of the filesystem, see tune2fs(8).

Oh, I had assumed it was on by default, hum. But now it reads

Quoted 7 lines
Quoted 5 lines

Errors behavior: Remount read-only

and I am still getting the same behavior. Indeed after some VFS modifications time it gets remounted read-only, but shouldn't that happen as soon as possible?

The block device may do some retries before passing the error on.

Sure. But I forgot to mention that after spitting all these write errors, the filesystem remains mounted read-write.

Samuel

#6 lore raw
In reply to Samuel Thibault
Quoted 9 lines · Samuel Thibault
Quoted 7 lines · Andreas Schwab, le Mon 04 Aug 2008 17:39:06 +0200, a écrit :
Quoted 4 lines · Samuel Thibault

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?

That's a tunable parameter of the filesystem, see tune2fs(8).

Quoted 7 lines

Oh, I had assumed it was on by default, hum. But now it reads

Errors behavior: Remount read-only

and I am still getting the same behavior. Indeed after some VFS modifications time it gets remounted read-only, but shouldn't that happen as soon as possible?

Errors writing to data blocks should get reflected up the application (i.e., as EIO errors), but it won't force the filesystem read/only or force a kernel panic (in the "tune2fs -e panic" case). The rationale being if it's a single isloated error writing to a single file, why ruin everybody's day by taking more drastic action?

But if we can't write to core filesystem data structures, that's a much more serious situation....

- Ted