All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miao Xie <miaox@cn.fujitsu.com>
To: Josef Bacik <jbacik@fusionio.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] Btrfs: fix dio write vs buffered read race V3
Date: Sun, 01 Jul 2012 18:34:44 +0800	[thread overview]
Message-ID: <4FF027C4.30203@cn.fujitsu.com> (raw)
In-Reply-To: <1340888944-9471-1-git-send-email-jbacik@fusionio.com>

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

  reply	other threads:[~2012-07-01 10:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-28 13:09 [PATCH] Btrfs: fix dio write vs buffered read race V3 Josef Bacik
2012-07-01 10:34 ` Miao Xie [this message]
2012-07-02 12:40   ` Josef Bacik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FF027C4.30203@cn.fujitsu.com \
    --to=miaox@cn.fujitsu.com \
    --cc=jbacik@fusionio.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.