xfs
[Top] [All Lists]

Re: [PATCH] xfs: fix sub-page blocksize data integrity writes

To: xfs@xxxxxxxxxxx
Subject: Re: [PATCH] xfs: fix sub-page blocksize data integrity writes
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Thu, 2 May 2013 17:58:36 +1000
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1367480709-23804-1-git-send-email-david@xxxxxxxxxxxxx>
References: <1367480709-23804-1-git-send-email-david@xxxxxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Thu, May 02, 2013 at 05:45:09PM +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner@xxxxxxxxxx>
> 
> FSX on 512 byte block size filesystems has been failing for some
> time with corrupted data. The fault dates back to the change in
> the writeback data integrity algorithm that uses a mark-and-sweep
> approach to avoid data writeback livelocks.
.....
> +      * time this will be the only page inteh file that needs writeback.
> +      * Hence for more optimal IO patterns, we should always avoid partial
> +      * page writeback due to multiple mappings on a page here.
> +      */
> +     if (!xfs_imap_valid(inode, imap, end_offset))
> +             goto fail_unlock_page;
> +
>       len = 1 << inode->i_blkbits;
>       p_offset = min_t(unsigned long, end_offset & (PAGE_CACHE_SIZE - 1),
>                                       PAGE_CACHE_SIZE);
>       p_offset = p_offset ? roundup(p_offset, len) : PAGE_CACHE_SIZE;
>       page_dirty = p_offset / len;
>  
> +

Oh, stray whitespace....

>       bh = head = page_buffers(page);
>       do {
>               if (offset >= end_offset)
> diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
> index 1501f4f..0176bb2 100644
> --- a/fs/xfs/xfs_vnodeops.c
> +++ b/fs/xfs/xfs_vnodeops.c
> @@ -1453,7 +1453,7 @@ xfs_free_file_space(
>       xfs_mount_t             *mp;
>       int                     nimap;
>       uint                    resblks;
> -     uint                    rounding;
> +     xfs_off_t               rounding;
>       int                     rt;
>       xfs_fileoff_t           startoffset_fsb;
>       xfs_trans_t             *tp;
> @@ -1482,7 +1482,7 @@ xfs_free_file_space(
>               inode_dio_wait(VFS_I(ip));
>       }
>  
> -     rounding = max_t(uint, 1 << mp->m_sb.sb_blocklog, PAGE_CACHE_SIZE);
> +     rounding = max_t(xfs_off_t, 1 << mp->m_sb.sb_blocklog, PAGE_CACHE_SIZE);
>       ioffset = offset & ~(rounding - 1);
>       error = -filemap_write_and_wait_range(VFS_I(ip)->i_mapping,
>                                             ioffset, -1);

And I forgot I had noticed a second problem while dealing with this
one (i.e. the rounding masks is wrong for offsets > 32 bits)....

I'll repost them both as separate patches.

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx

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