Date: Tue, 24 Jan 2012 14:54:33 GMT From: Luis Garcés-Erice <lge@ieee.org> To: freebsd-gnats-submit@FreeBSD.org Subject: amd64/164445: lseek() always returns ENXIO with SEEK_DATA/SEEK_HOLE on 9.0 64bit ZFS Message-ID: <201201241454.q0OEsXcb032519@red.freebsd.org> Resent-Message-ID: <201201241500.q0OF0LUH070200@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 164445 >Category: amd64 >Synopsis: lseek() always returns ENXIO with SEEK_DATA/SEEK_HOLE on 9.0 64bit ZFS >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-amd64 >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Jan 24 15:00:21 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Luis Garcés-Erice >Release: 9.0 >Organization: >Environment: FreeBSD XXX 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan 3 07:46:30 UTC 2012 root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64 >Description: Trying to find holes on a sparse file on 9.0-RELEASE x86_64 ZFS, lseek() with whence=SEEK_DATA or SEEK_HOLE always returns ENXIO. In particular, this code: offset=lseek(fd,0,SEEK_DATA); if (offset==-1) { if (errno==ENXIO) { // No more data printf("no more data\n"); close(fd); exit(-1); } } always prints "no more data". Same thing if seeking with SEEK_HOLE. The expected behavior is for lseek in this case to return 0, because the first block of data starts at 0. This works fine on 8.2-RELEASE i386 ZFS. >How-To-Repeat: This code works as expected (offset equals 0 after the call to lseek()) on 8.2-RELEASE i386, but not on 9.0-RELEASE x86_64 offset=lseek(fd,0,SEEK_DATA); if (offset==-1) { if (errno==ENXIO) { // No more data printf("no more data\n"); close(fd); exit(-1); } } >Fix: >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201241454.q0OEsXcb032519>