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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs




[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux