Re: EXT2fs panic! =(

Matthias Urlichs (smurf@smurf.noris.de)
Sun, 29 Sep 1996 13:04:51 +0100


[ Cc: is set to the people who are mentioned in strace's CREDITS file. ]

In linux.dev.kernel, article <324c8259.0.4c73@FeedBack.com.ar>,
nick@feedback.com.ar (Nicolas Lichtmaier) writes:
>
> I got back to 1.05, but when trying to check te partition (4 Gb) it said it
> got a Read only filesuystem error (?) when reading (?). I strace'd it and
> this is the result:
>
ARRGH, I'd say. DON't DO THAT. (I refer to the ext2fsck code...)

> open("/etc/mtab", O_RDWR) = -1 EROFS (Read-only file system)
> [....]
> _llseek(0x3, 0, 0xb4425400, 0xbffff770, 0) = 0
> write(1, "Error reading block 2953365 (Rea"..., 98) = 98

While the error message returned is spurious, the problem itself isn't.
However, the strace log is singularly unhelpful, which is partly because
above _llseek system call analysis is incomplete because it just prints the
address of its "normal" return value.

This is the fault of strace. Patch (I just wrote this, so NO WARRANTY of any
kind, though I checked it with a small test program) follows:

Index: file.c
diff -u -u -r1.2 file.c
--- file.c 1996/07/30 07:36:05 1.2
+++ file.c 1996/09/29 11:00:06
@@ -204,6 +204,39 @@
};

int
+sys_llseek(tcp)
+struct tcb *tcp;
+{
+ long long offset;
+ static char aux[50];
+ if (entering(tcp)) {
+ tprintf("%ld, ", tcp->u_arg[0]);
+ offset = ((long long)tcp->u_arg[1]) << 32;
+ offset |= tcp->u_arg[2];
+ if (tcp->u_arg[4] == SEEK_SET)
+ tprintf("%Lu", offset);
+ else
+ tprintf("%Ld", offset);
+ if (umove(tcp, tcp->u_arg[3], &offset) >= 0)
+ return RVAL_DECIMAL|RVAL_STR; /* Is that right? */
+ } else {
+ if (syserror(tcp))
+ tprintf(", %#lx, ", tcp->u_arg[3]);
+ else if (umove(tcp, tcp->u_arg[3], &offset) < 0)
+ tprintf(", %#lx, ", tcp->u_arg[3]);
+ else {
+ tprintf(", ");
+ sprintf(aux,"at %Lu", offset);
+ tcp->auxstr = aux;
+ printxval(whence, tcp->u_arg[4], "L_???");
+ return RVAL_DECIMAL|RVAL_STR;
+ }
+ printxval(whence, tcp->u_arg[2], "L_???");
+ }
+ return 0;
+}
+
+int
sys_lseek(tcp)
struct tcb *tcp;
{
Index: linux/dummy.h
diff -u -u -r1.2 dummy.h
--- dummy.h 1996/07/30 07:36:07 1.2
+++ dummy.h 1996/09/29 11:00:06
@@ -41,7 +41,6 @@
#define sys_bdflush printargs
#define sys_sysfs printargs
#define sys_afs_syscall printargs
-#define sys_llseek printargs

#define sys_fdatasync printargs
#define sys_sysctl printargs

-- 
The DREA Law:
    Under the most rigorously controlled conditions, the experimental
    apparatus will do exactly as it pleases.
-- 
Matthias Urlichs         \  noris network GmbH  /  Xlink-POP Nürnberg 
Schleiermacherstraße 12   \   Linux+Internet   /   EMail: urlichs@noris.de
90491 Nürnberg (Germany)   \    Consulting+Programming+Networking+etc'ing
   PGP: 1024/4F578875   1B 89 E2 1C 43 EA 80 44  15 D2 29 CF C6 C7 E0 DE
       Click <A HREF="http://info.noris.de/~smurf/finger">here</A>.    42