OpenSolaris

Printable Version Enter a New Search
Bug ID 6432412
Synopsis posix_fallocate() moves holes instead of filling them
State 10-Fix Delivered (Fix available in build)
Category:Subcategory kernel:ufs
Keywords posix_fallocate | rtiq_regression
Responsible Engineer Saurabh Mishra
Reported Against
Duplicate Of
Introduced In solaris_nevada
Commit to Fix snv_68
Fixed In snv_68
Release Fixed solaris_nevada(snv_68)
Related Bugs 4517427 , 6411034 , 6432390 , 6677946
Submit Date 31-May-2006
Last Update Date 3-July-2007
Description
See attached test case "fallocate.c" and related program "dump_holes.c"

Build fallocate.c with:

$ cc -o fallocate fallocate.c -lposix4 

posix_fallocate() is passed an "offset" and a "length" parameter; the specification makes no reference to any effects on the file outside that range of the file.

The test case creates a sparse file of length 128MB by seeking to the 128M-1th byte and writing one byte; it then calls posix_fallocate(fd, 0, 128MB) to allocate blocks backing the file.

When pointed at a UFS file, this action has the side effect of extending the file by another 128MB; there is an extended hole at the end of the file.

$ rm -f /space/sommerfeld/boom
$ ./fallocate /space/sommerfeld/boom
$ ls -ls /space/sommerfeld/boom 
262288 -rw-rw-r--   1 sommerfeld staff    268427264 May 31 15:23 /space/sommerfeld/boom
$ ./dump_holes /space/sommerfeld/boom
EOF at 268427264
Last hole starts at 134217728
Work Around
N/A
Comments
N/A