[PATCH 2/4] fs: Prevent doing FALLOC_FL_ZERO_RANGE on append only file
Lukáš Czerner
lczerner at redhat.com
Tue Apr 15 08:09:42 CDT 2014
On Sat, 12 Apr 2014, Christoph Hellwig wrote:
> Date: Sat, 12 Apr 2014 08:19:35 -0700
> From: Christoph Hellwig <hch at infradead.org>
> To: Lukas Czerner <lczerner at redhat.com>
> Cc: linux-fsdevel at vger.kernel.org, ceph-devel at vger.kernel.org,
> linux-ext4 at vger.kernel.org, xfs at oss.sgi.com
> Subject: Re: [PATCH 2/4] fs: Prevent doing FALLOC_FL_ZERO_RANGE on append only
> file
>
> On Fri, Apr 11, 2014 at 08:57:43PM +0200, Lukas Czerner wrote:
> > /*
> > - * It's not possible to punch hole or perform collapse range
> > - * on append only file
> > + * It's not possible to punch hole, perform collapse range
> > + * or zero range on append only file
> > */
> > - if (mode & (FALLOC_FL_PUNCH_HOLE | FALLOC_FL_COLLAPSE_RANGE)
> > + if (mode & (FALLOC_FL_PUNCH_HOLE | FALLOC_FL_COLLAPSE_RANGE |
> > + FALLOC_FL_ZERO_RANGE)
>
> Might be better to make this a negative test fo the operation that is
> allowed on an appen only file. That's also much better future proof.
>
True, it might be better to do it this way:
if (mode & ~FALLOC_FL_KEEP_SIZE && IS_APPEND(inode))
this makes FALLOC_FL_NO_HIDE_STALE (reserved, not implemented)
potentially not work on the append only file since it could change
the content of the file.
Will resend.
Thanks!
-Lukas
More information about the xfs
mailing list