xfs
[Top] [All Lists]

Re: [PATCH 7/8] xfs: direct IO EOF zeroing needs to drain AIO

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Re: [PATCH 7/8] xfs: direct IO EOF zeroing needs to drain AIO
From: Brian Foster <bfoster@xxxxxxxxxx>
Date: Tue, 14 Apr 2015 10:35:28 -0400
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1428996411-1507-8-git-send-email-david@xxxxxxxxxxxxx>
References: <1428996411-1507-1-git-send-email-david@xxxxxxxxxxxxx> <1428996411-1507-8-git-send-email-david@xxxxxxxxxxxxx>
User-agent: Mutt/1.5.23 (2014-03-12)
On Tue, Apr 14, 2015 at 05:26:50PM +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner@xxxxxxxxxx>
> 
> When we are doing AIO DIO writes, the IOLOCK only provides an IO
> submission barrier. When we need to do EOF zeroing, we need to ensure
> that no other IO is in progress and all pending in-core EOF updates
> have been completed. This requires us to wait for all outstanding
> AIO DIO writes to the inode to complete and, if necessary, run their
> EOF updates.
> 
> Once all the EOF updates are complete, we can then restart
> xfs_file_aio_write_checks() while holding the IOLOCK_EXCL, knowing
> that EOF is up to date and we have exclusive IO access to the file
> so we can run EOF block zeroing if we need to without interference.
> This gives EOF zeroing the same exclusivity against other IO as we
> provide truncate operations.
> 
> Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx>
> ---

Reviewed-by: Brian Foster <bfoster@xxxxxxxxxx>

>  fs/xfs/xfs_file.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
> index 5d5b4ba..c398ec7 100644
> --- a/fs/xfs/xfs_file.c
> +++ b/fs/xfs/xfs_file.c
> @@ -587,6 +587,16 @@ restart:
>                       xfs_rw_iunlock(ip, *iolock);
>                       *iolock = XFS_IOLOCK_EXCL;
>                       xfs_rw_ilock(ip, *iolock);
> +
> +                     /*
> +                      * We now have an IO submission barrier in place, but
> +                      * AIO can do EOF updates during IO completion and hence
> +                      * we now need to wait for all of them to drain. Non-AIO
> +                      * DIO will have drained before we are given the
> +                      * XFS_IOLOCK_EXCL, and so for most cases this wait is a
> +                      * no-op.
> +                      */
> +                     inode_dio_wait(inode);
>                       goto restart;
>               }
>               error = xfs_zero_eof(ip, *pos, i_size_read(inode), &zero);
> -- 
> 2.0.0
> 
> _______________________________________________
> xfs mailing list
> xfs@xxxxxxxxxxx
> http://oss.sgi.com/mailman/listinfo/xfs

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