Re: FAT crashes when writing beyond file end

Mikulas Patocka (mikulas@artax.karlin.mff.cuni.cz)
Tue, 19 Oct 1999 23:00:04 +0200 (CEST)


> > Hi.
> >
> > >> (fat currently crashes when writing beyond file
> > >> end, other filesystems aren't ported yet)
> > > FAT should be OK now.
> >
> > Fat doesn't work again. Sometimes it locks up, sometimes it crashes on
> > BUG. It seems to be bug in block_write_cont_page.
>
> Oh, crap... How long ago had it started? Details on BUG() output? There
> still are several races vetween write() and truncate(), can it be one of
> them?

No, it's not race. A simple program that does creat();lseek();write();
crashes it. Sometimes it crashes in fat_get_blocks, sometimes it stucks in
infinite loop in fat_write_partial_page (depending on value of lseek
modulo page size) - just try this:

#include <unistd.h>
#include <fcntl.h>

main(int argc, char *argv[])
{
int h = creat(argv[1], 0755);
lseek(h, atoi(argv[2]), SEEK_SET);
write(h, "x", 1);
close(h);
}

Mikulas Patocka

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/