From owner-freebsd-current Sun Aug 11 3:28:50 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1B2F237B400; Sun, 11 Aug 2002 03:28:43 -0700 (PDT) Received: from relay1.macomnet.ru (relay1.macomnet.ru [195.128.64.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id B7D0E43E4A; Sun, 11 Aug 2002 03:28:41 -0700 (PDT) (envelope-from maxim@FreeBSD.org) Received: from news1.macomnet.ru (news1.macomnet.ru [195.128.64.14]) by relay1.macomnet.ru (8.11.6/8.11.6) with ESMTP id g7BAScm3347669; Sun, 11 Aug 2002 14:28:38 +0400 (MSD) Date: Sun, 11 Aug 2002 14:28:38 +0400 (MSD) From: Maxim Konovalov X-X-Sender: maxim@news1.macomnet.ru To: Gavin Atkinson Cc: current@FreeBSD.org, Subject: sendfile(2) is broken (Was: ftpd problem: Input/output error) In-Reply-To: Message-ID: <20020811140826.J68457-100000@news1.macomnet.ru> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hello, On 14:43+0100, Aug 10, 2002, Gavin Atkinson wrote: > > Hi, > > For a few months now I have been seeing the following problems with the > ftpd in current. When transferring a large file, ftpd seems to > consistantly fail after almost all of the file hass been transferred. The > example transcript below shows all but 4096 bytes of a file being > transferred before stopping. This also happens across networks, with > 4-stable ftp clients - i am confident that it is the ftp server in > current. > > gavin@epsilon:/home/gavin> grep ^ftp /etc/inetd.conf > ftp stream tcp nowait root /usr/libexec/ftpd ftpd -ll > > gavin@epsilon:/home/gavin> ls -l foo > -rw------- 1 gavin users 31969280 Aug 4 18:19 foo > > gavin@epsilon:/home/gavin> ftp localhost > Trying ::1... > ftp: connect to address ::1: Connection refused > Trying 127.0.0.1... > Connected to localhost. > 220 epsilon.ury.york.ac.uk FTP server (Version 6.00LS) ready. > Name (localhost:gavin): > 331 Password required for gavin. > Password: > 230 User gavin logged in. > Remote system type is UNIX. > Using binary mode to transfer files. > ftp> lcd test > Local directory now /usr/home/gavin/test > ftp> get foo > local: foo remote: foo > 229 Entering Extended Passive Mode (|||49152|) > 150 Opening BINARY mode data connection for 'foo' (31969280 bytes). > 99% |************************************ | 31216 KB 3.25 MB/s 00:09 > 426 Data connection: Input/output error. > 31965184 bytes received in 00:09 (3.25 MB/s) > ftp> > > gavin@epsilon:/home/gavin> ls -l test/foo > -rw-r--r-- 1 gavin users 31965184 Aug 4 18:19 test/foo > > epsilon# tail -3 > /var/log/ftp.log > Aug 10 14:28:28 epsilon ftpd[345]: connection from localhost (127.0.0.1) > Aug 10 14:29:03 epsilon ftpd[345]: FTP LOGIN FROM localhost as gavin > Aug 10 14:29:36 epsilon ftpd[345]: get /usr/home/gavin/foo = 31965184 bytes > > As can be seen, the file is 31969280 bytes in size, but ftpd only sends > 31963184 bytes. The log file reads the smaller size. > > World and kernel are from source supped midnight GMT 10th August. I can > help debug this or provide an account for someone else to look at this > problem. This is sendfile(2) mis-behaviour arised after rev.1.109 sys/kern/uipc_syscalls.c but I think the real problem in vn_rdwr(), sys/kern/vfs_vnops.c. Here is my patch but I really need somebody with vfs clue. I CC'ed Robert Watson as an author of sendfile(2) modification and our vfs expert. Index: sys/kern/vfs_vnops.c =================================================================== RCS file: /home/ncvs/src/sys/kern/vfs_vnops.c,v retrieving revision 1.159 diff -u -r1.159 vfs_vnops.c --- sys/kern/vfs_vnops.c 8 Aug 2002 12:45:30 -0000 1.159 +++ sys/kern/vfs_vnops.c 11 Aug 2002 10:19:47 -0000 @@ -401,7 +401,7 @@ if (aresid) *aresid = auio.uio_resid; else - if (auio.uio_resid && error == 0) + if (auio.uio_resid && error != 0) error = EIO; if ((ioflg & IO_NODELOCKED) == 0) { if (rw == UIO_WRITE) %%% With this patch sendfile(2) and ftpd(8) work as expected but I cannot believe vn_rdwr() has been broken since 1994. As a temporal solution you can revert rev. 1.109 uipc_syscalls.c, recompile and reinstall your kernel. -- Maxim Konovalov, maxim@FreeBSD.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message