linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* punch-hole should go beyond i_size
@ 2012-01-12  1:02 Hugh Dickins
  2012-01-12  2:55 ` Dave Chinner
  0 siblings, 1 reply; 10+ messages in thread
From: Hugh Dickins @ 2012-01-12  1:02 UTC (permalink / raw)
  To: Allison Henderson; +Cc: linux-ext4

Hi Allison,

In thinking about fallocate() on tmpfs, I cross-check with ext4
and find this bug in its implementation of FALLOC_FL_PUNCH_HOLE:

rm -f temp
fallocate    -l 4096 temp
du temp				# shows 4, right
fallocate -p -l 4096 temp
du temp				# shows 0, right
rm -f temp
fallocate -n -l 4096 temp
du temp				# shows 4, right
fallocate -p -l 4096 temp
du temp				# shows 4, wrong
rm temp

ext4_ext_punch_hole() contains /* No need to punch hole beyond i_size */
early return, and trimming to i_size below, but forgets that the other
variety of fallocate(), with FALLOC_FL_KEEP_SIZE set, may have allocated
blocks beyond i_size.  They can be removed with ftruncate(), but it is
unexpected for fallocate() not to undo its own work, and xfs does so.

Hugh

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-05-16 18:09 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-12  1:02 punch-hole should go beyond i_size Hugh Dickins
2012-01-12  2:55 ` Dave Chinner
2012-01-12 16:23   ` Allison Henderson
2012-01-13  0:21     ` Hugh Dickins
2012-01-13  3:18       ` Allison Henderson
2012-05-13 21:13     ` Hugh Dickins
2012-05-15 21:36       ` Allison Henderson
2012-05-15 22:38         ` Hugh Dickins
2012-05-16  6:14           ` Lukáš Czerner
2012-05-16 18:09             ` Hugh Dickins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).