Hi. I just reproduced a problem I was chasing on FreeBSD also on OpenSolaris from around 2008.01.
Simply doing something like this: write 9k of random data into 'foo' file truncate 'foo' file to 7k truncate 'foo' file to 11k read data between 7k-9k There should be all zeros between 7k-9k, but there is previous data. It worked fine on an older ZFS versions (I'm sure it works on version 6). Simple test program: #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <string.h> #include <err.h> static char buf0[9 * 1024], buf1[2 * 1024]; int main(int argc, char *argv[]) { int fd, i; if (argc != 2) errx(1, "usage: trunctest <filename>"); fd = open(argv[1], O_RDWR | O_CREAT | O_TRUNC, 0600); if (fd == -1) err(1, "open(%s)", argv[1]); memset(buf0, 'x', sizeof(buf0)); if (write(fd, buf0, sizeof(buf0)) != sizeof(buf0)) err(1, "write()"); if (ftruncate(fd, 7 * 1024) == -1) err(1, "ftruncate(%d)", 7 * 1024); if (ftruncate(fd, 11 * 1024) == -1) err(1, "ftruncate(%d)", 11 * 1024); if (pread(fd, buf1, sizeof(buf1), 7 * 1024) != sizeof(buf1)) err(1, "pread()"); for (i = 0; i < sizeof(buf1); i++) { if (buf1[i] != '\0') errx(2, "unexpected data at %jd!", (intmax_t)(7 * 1024 + i)); } exit(0); } -- Pawel Jakub Dawidek http://www.wheel.pl pjd at FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 187 bytes Desc: not available URL: <http://mail.opensolaris.org/pipermail/zfs-code/attachments/20080722/002a0bdc/attachment.bin>