Date: Tue, 31 Jan 2006 13:00:17 GMT From: Yar Tikhiy <yar@comp.chem.msu.su> To: freebsd-bugs@FreeBSD.org Subject: Re: kern/92243: sendfile(2) returns early on files > 4GB Message-ID: <200601311300.k0VD0Ha8052928@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/92243; it has been noted by GNATS. From: Yar Tikhiy <yar@comp.chem.msu.su> To: bug-followup@FreeBSD.org, dkelly@hiwaay.net Cc: "David G. Lawrence" <dg@dglawrence.com>, alc@FreeBSD.org Subject: Re: kern/92243: sendfile(2) returns early on files > 4GB Date: Tue, 31 Jan 2006 15:49:48 +0300 Just experimented with the issue. It appears easily reproducable on a local filesystem. The problem boils down to the fact that in the following code: sys/kern/uipc_syscalls.c:do_sendfile() 1864: /* 1865: * Calculate the amount to transfer. Not to exceed a page, 1866: * the EOF, or the passed in nbytes. 1867: */ 1868: xfsize = obj->un_pager.vnp.vnp_size - off; obj->un_pager.vnp.vnp_size is somehow truncated to 32 bits when the vnode comes from disk. I added a printf after line 1868 and I saw that for a recently created file, 2^32+10000 bytes in size, obj->un_pager.vnp.vnp_size was the full size of the file. The file's vnode was presumably still cached. However, after a reboot obj->un_pager.vnp.vnp_size for the same file was just 10000. # truncate -s 4294977296 ~ftp/4g # ftp ftp://127.1/4g obj->un_pager.vnp.vnp_size = 4294977296 # reboot ... # ftp ftp://127.1/4g obj->un_pager.vnp.vnp_size = 10000 # rm ~ftp/4g # truncate -s 4294977296 ~ftp/4g # ftp ftp://127.1/4g obj->un_pager.vnp.vnp_size = 4294977296 -- Yar
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200601311300.k0VD0Ha8052928>