From: Hugh Dickins <hughd@google.com>
To: Allison Henderson <achender@linux.vnet.ibm.com>
Cc: Dave Chinner <david@fromorbit.com>, Theodore Ts'o <tytso@mit.edu>,
linux-ext4@vger.kernel.org
Subject: Re: punch-hole should go beyond i_size
Date: Sun, 13 May 2012 14:13:31 -0700 (PDT) [thread overview]
Message-ID: <alpine.LSU.2.00.1205131404040.1547@eggly.anvils> (raw)
In-Reply-To: <4F0F08F6.2000205@linux.vnet.ibm.com>
On Thu, 12 Jan 2012, Allison Henderson wrote:
> On 01/11/2012 07:55 PM, Dave Chinner wrote:
> > On Wed, Jan 11, 2012 at 05:02:12PM -0800, Hugh Dickins wrote:
> > > 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.
> >
> > I'm pretty sure that's a bug as XFS allows punching holes in extents
> > beyond EOF.
> >
> > Cheers,
> >
> > Dave.
>
> Oh I see, I'll take a look at it, I think it will be ok to just take out the
> early return. Thx!
I see the -EOPNOTSUPPs have gone into 3.4's ext4_punch_hole() - thanks -
but the i_size issue remains unfixed. I wouldn't be surprised if it were
more complicated than you had hoped - I had no intention of trying a patch
myself! It's not an actual problem for me, but I thought I'd just send a
reminder, before I move out of the hole-punching business.
Hugh
next prev parent reply other threads:[~2012-05-13 21:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LSU.2.00.1205131404040.1547@eggly.anvils \
--to=hughd@google.com \
--cc=achender@linux.vnet.ibm.com \
--cc=david@fromorbit.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox