Skip to contentSkip to conversation

2.5.70 lockup while write()ing to /dev/hda1

DISCUSSION lode leroy 4 participants 4 messages Aug 6, 2003

lore
Share & tools
lore

lode leroy

author
#0 lore raw

I just want to report a problem I saw on linux 2.5.70:
(since I have a workaround, I do not intend to debug this further)

the following program locks up the computer.
sometimes this has happened after about 16MB,
sometimes after about 64MB...

main()
{
int f = open("/dev/hda1", O_RDWR);
char buffer[8192];

   for(i=0;1;i++) {
      printf("%d\r", i);
      write(f, buffer, sizeof(buffer);
      /* fsync(f); */

}
close(f)
}

when using adding the fsync(), all goes fine!

_________________________________________________________________
Receive your Hotmail & Messenger messages on your mobile phone with MSN Mobile http://www.msn.be/gsm/smsservices

#1 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 7 lines · lode leroy

main()

{
    int f = open("/dev/hda1", O_RDWR);
    char buffer[8192];
    for(i=0;1;i++) {
       printf("%d\r", i);
       write(f, buffer, sizeof(buffer);

Shouldn't this be:

	write(f, buffer, sizeof(buffer) / sizeof(buffer[0]));

And what are you thying to do with the code?

Quoted 4 lines
       /* fsync(f); */
    }
    close(f)
}

- --
Regards Michael Buesch [ http://www.8ung.at/tuxsoft ] Penguin on this machine: Linux 2.6.0-test2 - i386

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE/MPjvoxoigfggmSgRAkhNAJ40TUOftJfk/wa+g6B6gFiRSEdsNwCeJ/Tc YH8xVddWCQZzozFNlIxT14o=
=x0ge
-----END PGP SIGNATURE-----

#3 lore raw
In reply to lode leroy
Quoted 6 lines · lode leroy

I just want to report a problem I saw on linux 2.5.70:
(since I have a workaround, I do not intend to debug this further)

the following program locks up the computer.
sometimes this has happened after about 16MB,
sometimes after about 64MB...

Don't you think 2.5.70 is a little bit obsolete now? ;-)
I recoomend you testing this on 2.6.0-test2-latest. Using the latest available kernel will probably help mantainers to nail down any problem.

#2 lore raw
In reply to Michael Buesch

Michael Buesch <[email protected]> writes:

|> On Wednesday 06 August 2003 14:32, lode leroy wrote:
|> > main()
|> > {
|> >     int f = open("/dev/hda1", O_RDWR);
|> >     char buffer[8192];
|> >     for(i=0;1;i++) {
|> >        printf("%d\r", i);
|> >        write(f, buffer, sizeof(buffer);
|> 
|> Shouldn't this be:
|> 	write(f, buffer, sizeof(buffer) / sizeof(buffer[0]));

sizeof(char) == 1, always and everywhere.

Andreas.

Signature · 4 lines
Andreas Schwab, SuSE Labs, [email protected]
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."