[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

a bug in ext3 code for 2.4.7



Hello ,

I use kernel 2.4.7 patched with corresponding ext3 patch. The problem I
have is that when I startup I get a panic in a kernel. I started
to debug util-linux and found that mount does a segmentation fault when
trying to open /etc/mtab file.


The segmentation fault ocurrs on open() call inside mtab_is_writable()
procedure:


printf("mtab_writable: pass 1\n");

if (ret == -1) {
int fd;
if (!MOUNTED) printf("mtab_writable: MOUNTED=null\n");
fd = open("/etc/passwd", O_RDWR | O_CREAT, 0644);
printf("mtab_writable: could open /etc/passwd with no probs\n");
printf("mtab_writable: opening file=%s\n",MOUNTED);
if (fd >= 0) close(fd);
fd = open(MOUNTED, O_RDWR | O_CREAT, 0644);
printf("mtab_writable: opened fd\n");
if (fd >= 0) {
printf("mtab_writable: closing fd\n");
close(fd);
ret = 1;
} else
ret = 0;
}
printf("mtab_writable: pass 2\n");



As the output I get:
mtab_writable: could open /etc/passwd with no probs
mtab_writable: opening file=/etc/mtab
invalid operand 0000
CPU: 0
EIP: 0010:[<c0127304>]
EFLAGS: 00010082
.........
Process mount (pid: 41, stackpage=ce355000)
........



This only happends with /etc/mtab file, as you can see the file
/etc/passwd (and many others) open fine. The problem
ocurrs after using ext3 for a few days and then turning off the machine. I
also noted that the panic ocurrs only during startup scripts. I am not
sure if it is called "panic", because kernel is not crashing completely,
it is just can't mount any more filesystems but is operating.


If I start up the machine and do not mount the damaged filesystem I do not
get a kernel panic at all when I mount it later, I just can not access
"mtab" file:



bash-2.04# ls -l mtab
ls: mtab: Input/output error
bash-2.04# cd /



Let me tell you how I get into tis situation because it is not very
common. I do not boot from a hard disk, I boot from a Flash wich
has it's own mini-filesystem. During the boot process I mount 5 ext3
partitions, and one of them is /etc. I found an error in my startup
script, when I do mount -t ext3 /dev/hda5 /etc I forget to pass -n option
to "mount" command, so the new /etc directory is replaced with a partition on a hard disk and /etc/mtab gets corrupted. I beleive this could happend because the file was accesed in some ocasion before "mount" by the ext3 code and placed in cache, so a mount without -n may write a corrupted data ... This only happends with /etc/mtab, other files maintain its integrity no mater of how much hard resets I do.


I don't know if mounting with -n option will correct this problem (i have
to test), but in the mean time I would like to report this bug.


If you want to see my damaged /etc partition, download from here:

http://www.quazartecnologia.com/bad-fs.img.gz
(675K compressed, 52 MB uncompressed)


uncompress and dd if=bad-fs.img of=/dev/hdaX


Now, I don't know, maybe this problem has been fixed already? I just can't
move to the lastest kernel right now. Is it possible to update 2.4.7 with
the lastest ext3 sources? How can I do this?


Nikolai





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]