xfs
[Top] [All Lists]

Re: [PATCH 1/7] xfs: don't dirty buffers beyond EOF

To: Brian Foster <bfoster@xxxxxxxxxx>
Subject: Re: [PATCH 1/7] xfs: don't dirty buffers beyond EOF
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Fri, 29 Aug 2014 08:37:06 +1000
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <20140828133457.GA35386@xxxxxxxxxxxxxxx>
References: <1409226551-16570-1-git-send-email-david@xxxxxxxxxxxxx> <1409226551-16570-2-git-send-email-david@xxxxxxxxxxxxx> <20140828133457.GA35386@xxxxxxxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Thu, Aug 28, 2014 at 09:34:57AM -0400, Brian Foster wrote:
> On Thu, Aug 28, 2014 at 09:49:05PM +1000, Dave Chinner wrote:
> > +/*
> > + * This is basically a copy of __set_page_dirty_buffers() with one
> > + * small tweak: buffers beyond EOF do not get marked dirty. If we mark them
> > + * dirty, we'll never be able to clean them because we don't write buffers
> > + * beyond EOF, and that means we can't invalidate pages that span EOF
> > + * that have been marked dirty. Further, the dirty state can leak into
> > + * the file interior if the file is extended, resulting in all sorts of
> > + * bad things happening as the state does not match the unerlying data.
> > + */
> > +STATIC int
> > +xfs_vm_set_page_dirty(
> > +   struct page             *page)
> > +{
> > +   struct address_space    *mapping = page->mapping;
> > +   struct inode            *inode = mapping->host;
> > +   loff_t                  end_offset;
> > +   loff_t                  offset;
> > +   int                     newly_dirty;
> > +
> > +   if (unlikely(!mapping))
> > +           return !TestSetPageDirty(page);
> > +
> > +   end_offset = i_size_read(inode);
> > +   offset = end_offset & PAGE_CACHE_MASK;
> 
> Is this what you intended to do here?
> 
>       offset = page_offset(page);

Yup, that's a bug. Which points out just how important the buffer
dirty flag is (not) to XFS, doesn't it?

I'll post a fixed patch in a few minutes after it's run a few
tens of millions fsx ops...

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>