amd64/164445: lseek() always returns ENXIO with SEEK_DATA/SEEK_HOLE on 9.0 64bit ZFS

Luis Garcés-Erice lge at ieee.org
Tue Jan 24 15:00:22 UTC 2012


>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 at 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:


More information about the freebsd-amd64 mailing list