xfs
[Top] [All Lists]

Re: to compare journalised file systems

To: "Stephen C. Tweedie" <sct@xxxxxxxxxx>
Subject: Re: to compare journalised file systems
From: Andi Kleen <ak@xxxxxxx>
Date: Thu, 17 Oct 2002 00:15:49 +0200
Cc: Andi Kleen <ak@xxxxxxx>, linux-xfs@xxxxxxxxxxx
In-reply-to: <20021016230948.B524@redhat.com>
References: <20021016203853.GH27982@plato.local.lan> <Pine.LNX.4.44.0210161738120.5976-100000@packetstorm.skreak.org> <20021016214759.GI27982@plato.local.lan> <20021017000107.A21179@wotan.suse.de> <20021016230948.B524@redhat.com>
Sender: linux-xfs-bounce@xxxxxxxxxxx
User-agent: Mutt/1.3.22.1i
On Wed, Oct 16, 2002 at 11:09:48PM +0100, Stephen C. Tweedie wrote:
> Hi,
> 
> On Thu, Oct 17, 2002 at 12:01:07AM +0200, Andi Kleen wrote:
> 
> > No that's not true. The VFS doesn't know about these flags as far as 
> > I know. You have to handle them in fs specific code.
> > 
> > Even more interesting looking at the source and testing it at least append 
> > only
> > is broken for ext2/ext3 - generic_file_llseek doesn't check for it
> > so while you're required to open such a file O_APPEND lseek still works 
> > fine.
> 
> lseek is ignored on O_APPEND files --- the write always re-seeks to
> EOF.  pwrite goes down that same code path too so it also gets the
> append enforced.  In your testing were you testing real writes, or
> just the lseeks?

I was testing a real write.  Another hole is pwrite().

% cat tseek.c
#include <sys/fcntl.h>
#include <unistd.h>

main(int ac, char **av)
{
        int fd = open(av[1], O_APPEND|O_WRONLY); 

        if (lseek(fd, 100, SEEK_SET) < 0) perror("expected lseek error"); 
        if (write(fd, "1", 1) < 0) perror("expected write error"); 
        else printf("write succeeded\n"); 

} 
% gcc -o tseek tseek.c
% dd if=/dev/zero of=/tmp/TEST bs=1k count=10
% su
# chattr +a /tmp/TEST
% ./tseek /tmp/TEST
write succeeded

-Andi


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