public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Christoph Hellwig <hch@lst.de>
Cc: Jan Kara <jack@suse.cz>,
	linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-nvdimm@lists.01.org, Ted Tso <tytso@mit.edu>
Subject: Re: [PATCH 1/2] ext4: fix DAX write locking
Date: Wed, 11 Jan 2017 10:01:36 +0100	[thread overview]
Message-ID: <20170111090136.GE16116@quack2.suse.cz> (raw)
In-Reply-To: <1484063288-18255-2-git-send-email-hch@lst.de>

On Tue 10-01-17 16:48:07, Christoph Hellwig wrote:
> Unlike O_DIRECT DAX is not an optional opt-in feature selected by the
> application, so we'll have to provide the traditional synchronіzation
> of overlapping writes as we do for buffered writes.
> 
> This was broken historically for DAX, but got fixed for ext2 and XFS
> as part of the iomap conversion.  Fix up ext4 as well.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Makes sense. You can add:

Reviewed-by: Jan Kara <jack@suse.cz>

Ted, can you please pick it up? Thanks!

								Honza

> ---
>  fs/ext4/file.c | 10 +---------
>  1 file changed, 1 insertion(+), 9 deletions(-)
> 
> diff --git a/fs/ext4/file.c b/fs/ext4/file.c
> index d663d3d..a1e88aa 100644
> --- a/fs/ext4/file.c
> +++ b/fs/ext4/file.c
> @@ -175,7 +175,6 @@ ext4_dax_write_iter(struct kiocb *iocb, struct iov_iter *from)
>  {
>  	struct inode *inode = file_inode(iocb->ki_filp);
>  	ssize_t ret;
> -	bool overwrite = false;
>  
>  	inode_lock(inode);
>  	ret = ext4_write_checks(iocb, from);
> @@ -188,16 +187,9 @@ ext4_dax_write_iter(struct kiocb *iocb, struct iov_iter *from)
>  	if (ret)
>  		goto out;
>  
> -	if (ext4_overwrite_io(inode, iocb->ki_pos, iov_iter_count(from))) {
> -		overwrite = true;
> -		downgrade_write(&inode->i_rwsem);
> -	}
>  	ret = dax_iomap_rw(iocb, from, &ext4_iomap_ops);
>  out:
> -	if (!overwrite)
> -		inode_unlock(inode);
> -	else
> -		inode_unlock_shared(inode);
> +	inode_unlock(inode);
>  	if (ret > 0)
>  		ret = generic_write_sync(iocb, ret);
>  	return ret;
> -- 
> 2.1.4
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

  reply	other threads:[~2017-01-11  9:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-10 15:48 fix write synchronization for DAX Christoph Hellwig
2017-01-10 15:48 ` [PATCH 1/2] ext4: fix DAX write locking Christoph Hellwig
2017-01-11  9:01   ` Jan Kara [this message]
     [not found]     ` <20170111090136.GE16116-4I4JzKEfoa/jFM9bn6wA6Q@public.gmane.org>
2017-02-08 17:14       ` Christoph Hellwig
     [not found]         ` <20170208171410.GA27359-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2017-02-08 19:38           ` Theodore Ts'o
2017-02-08 19:41       ` Theodore Ts'o
2017-01-10 15:48 ` [PATCH 2/2] dax: assert that i_rwsem is held exclusive for writes Christoph Hellwig
2017-01-11  9:02   ` Jan Kara
     [not found]     ` <20170111090250.GF16116-4I4JzKEfoa/jFM9bn6wA6Q@public.gmane.org>
2017-02-08 19:43       ` Theodore Ts'o

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=20170111090136.GE16116@quack2.suse.cz \
    --to=jack@suse.cz \
    --cc=hch@lst.de \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-nvdimm@lists.01.org \
    --cc=tytso@mit.edu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox