Re: [PATCH] Btrfs: fix dio write vs buffered read race V3

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

 



On Thu, 28 Jun 2012 09:09:04 -0400, Josef Bacik wrote:
>  fs/btrfs/file.c  |   13 ------------
>  fs/btrfs/inode.c |   55 +++++++++++++++++++++++++++++++++++++++++++++++++----
>  2 files changed, 50 insertions(+), 18 deletions(-)
> 
> diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
> index 70dc8ca..9aa01ec 100644
> --- a/fs/btrfs/file.c
> +++ b/fs/btrfs/file.c
> @@ -1334,7 +1334,6 @@ static ssize_t __btrfs_direct_write(struct kiocb *iocb,
>  				    loff_t *ppos, size_t count, size_t ocount)
>  {
>  	struct file *file = iocb->ki_filp;
> -	struct inode *inode = fdentry(file)->d_inode;
>  	struct iov_iter i;
>  	ssize_t written;
>  	ssize_t written_buffered;
> @@ -1344,18 +1343,6 @@ static ssize_t __btrfs_direct_write(struct kiocb *iocb,
>  	written = generic_file_direct_write(iocb, iov, &nr_segs, pos, ppos,
>  					    count, ocount);
>  
> -	/*
> -	 * the generic O_DIRECT will update in-memory i_size after the
> -	 * DIOs are done.  But our endio handlers that update the on
> -	 * disk i_size never update past the in memory i_size.  So we
> -	 * need one more update here to catch any additions to the
> -	 * file
> -	 */
> -	if (inode->i_size != BTRFS_I(inode)->disk_i_size) {
> -		btrfs_ordered_update_i_size(inode, inode->i_size, NULL);
> -		mark_inode_dirty(inode);
> -	}
> -
>  	if (written < 0 || written == count)
>  		return written;

We should fall back the i_size in btrfs_direct_IO if we fails to do direct IO, right?

Thanks
Miao
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

  Powered by Linux