xfs
[Top] [All Lists]

Re: O_DIRECT wierd behavior..

To: Suresh Gopalakrishnan <gsuresh@xxxxxxxxxxxxxx>
Subject: Re: O_DIRECT wierd behavior..
From: Keith Owens <kaos@xxxxxxxxxxxxxxxxx>
Date: Sun, 16 Dec 2001 14:08:20 +1100
Cc: Stephen Lord <lord@xxxxxxx>, Eric Sandeen <sandeen@xxxxxxx>, linux-xfs@xxxxxxxxxxx
In-reply-to: Your message of "Sat, 15 Dec 2001 21:24:52 CDT." <Pine.GSO.4.02A.10112152112140.18455-100000@xxxxxxxxxxxxxxxxxx>
Sender: owner-linux-xfs@xxxxxxxxxxx
On Sat, 15 Dec 2001 21:24:52 -0500 (EST), 
Suresh Gopalakrishnan <gsuresh@xxxxxxxxxxxxxx> wrote:
>open("/tmp/blah", O_RDWR|O_CREAT|O_DIRECT, 0) = 3
>write(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"...,
>8192) = -1
> EINVAL (Invalid argument)
>fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 7), ...}) = 0
>mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
>= 0x40
>018000
>ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0
>write(1, "write returns -1\n", 17write returns -1
>)      = 17
>write(3, "\0", 1)                       = -1 EFBIG (File too large)
>--- SIGXFSZ (File size limit exceeded) ---
>+++ killed by SIGXFSZ +++ 

This is a side effect of omitting the create mode on open.  It picks up
garbage from stack instead of the mode, in this run it picked up mode
0, no access at all.  Something in the kernel is trapping write to a
file opened with no access and returning EFBIG, which glibc converts to
SIGXFSZ.

Use a valid mode on open with O_CREAT.  Otherwise you pick up stack
garbage which can vary from one compile to another.


<Prev in Thread] Current Thread [Next in Thread>