[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFxq4TunFa8mqJk5MHfvvFSg7Dr54acW7Cnqc5amOPdqrg@mail.gmail.com>
Date: Fri, 27 Apr 2012 16:27:17 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Alan Cox <alan@...rguk.ukuu.org.uk>
Cc: David Miller <davem@...emloft.net>, mjt@....msk.ru,
linux-kernel@...r.kernel.org, autofs@...r.kernel.org,
raven@...maw.net, thomas@...3r.de, stable@...nel.org
Subject: Re: [PATCH v2] Introduce a version6 of autofs interface, to fix
design error.
On Fri, Apr 27, 2012 at 3:42 PM, Alan Cox <alan@...rguk.ukuu.org.uk> wrote:
>
> The obvious way to set the flag would seem to me to also btake O_DIRECT
> on the pipe as meaning this ?
Ok, that really does seem to be pretty natural.
The attached patch implements that, and makes autofs automatically set
the O_DIRECT flag. And now that it is exposed to user-space, here's a
test-program that uses it:
[torvalds@i5 ~]$ cat packet.c
#define _GNU_SOURCE
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#define REPORT(op,fd,size) do { \
int ret = op(fd, buffer, size); \
fprintf(stderr, #op "(%d)=%d\n", size, ret); \
} while (0)
#define WRITE(x) REPORT(write,fd[1],x)
#define READ(x) REPORT(read,fd[0],x)
int main(void)
{
int fd[2];
static char buffer[1024];
if (pipe2(fd, O_DIRECT)) {
perror("pipe2 O_DIRECT");
exit(1);
}
WRITE(8);
WRITE(12);
WRITE(300);
WRITE(5);
READ(64);
READ(64);
WRITE(7);
READ(64);
READ(64);
READ(64);
return 0;
}
which results in this output:
[torvalds@i5 ~]$ ./a.out
write(8)=8
write(12)=12
write(300)=300
write(5)=5
read(64)=8
read(64)=12
write(7)=7
read(64)=64
read(64)=5
read(64)=7
iow, notice how all the read() calls return individual packets (and
the 300-byte packet was truncated to 64 bytes).
HOWEVER. I haven't actually tested the autofs part. But I suspect it
"should just work".
Thomas, Michael, can you test whether this patch (again: note the "+8"
in autofs_v5_packet_size() purely for debug purposes, so this would be
interesting to test for other people too) makes your setups work?
Linus
Download attachment "patch.diff" of type "application/octet-stream" (5162 bytes)
Powered by blists - more mailing lists