From mboxrd@z Thu Jan 1 00:00:00 1970 From: "H. Peter Anvin" Subject: Re: autofs: make the autofsv5 packet file descriptor use a packetized pipe Date: Sun, 29 Apr 2012 17:28:38 -0700 Message-ID: <4F9DDCB6.1070908@zytor.com> References: <20120429205429.63CCD7C0064@ra.kernel.org> <4F9DD994.70202@zytor.com> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-ID: Content-Type: text/plain; charset="us-ascii" To: Linus Torvalds Cc: Linux Kernel Mailing List , Michael Tokarev , Alan Cox , Ian Kent , Thomas Meyer , autofs@vger.kernel.org On 04/29/2012 05:25 PM, Linus Torvalds wrote: > On Sun, Apr 29, 2012 at 5:15 PM, H. Peter Anvin wrote: >> >> I just looked at am-utils; am-utils *does* use autofs v5, and *will* >> loop back and read more data on a short read. > > Can you point to the sources? > > If it's "short read" as in "I didn't get as much as I expected", that's fine. > > If it is "short read" as in "I don't even try to read 300 bytes, I > read it in 8-byte chunks", we're screwed. > git://git.fsl.cs.sunysb.edu/am-utils-6.2.git conf/autofs/autofs_linux.c static ssize_t autofs_get_pkt(int fd, void *buf, size_t bytes) { ssize_t i; do { i = read(fd, buf, bytes); if (i <= 0) break; buf = (char *)buf + i; bytes -= i; } while (bytes); return bytes; } ... #if AUTOFS_MAX_PROTO_VERSION >= 5 if (fh->version < 5) { len = sizeof(p.pkt); } else { len = sizeof(p.pkt5); } #else len = sizeof(p.pkt); #endif /* AUTOFS_MAX_PROTO_VERSION >= 5 */ if (autofs_get_pkt(fh->fd, &p, len)) continue;