Cleanup tracepoints in jmap.c
[ext4-patch-queue.git] / fix-dax-write-locking
blobd4f9d67d42856ef88b76c9d75cc7e83718d54a0f
1 ext4: fix DAX write locking
3 From: Christoph Hellwig <hch@lst.de>
5 Unlike O_DIRECT DAX is not an optional opt-in feature selected by the
6 application, so we'll have to provide the traditional synchronŃ–zation
7 of overlapping writes as we do for buffered writes.
9 This was broken historically for DAX, but got fixed for ext2 and XFS
10 as part of the iomap conversion.  Fix up ext4 as well.
12 Signed-off-by: Christoph Hellwig <hch@lst.de>
13 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
14 Reviewed-by: Jan Kara <jack@suse.cz>
15 ---
16  fs/ext4/file.c | 10 +---------
17  1 file changed, 1 insertion(+), 9 deletions(-)
19 diff --git a/fs/ext4/file.c b/fs/ext4/file.c
20 index d663d3d..a1e88aa 100644
21 --- a/fs/ext4/file.c
22 +++ b/fs/ext4/file.c
23 @@ -175,7 +175,6 @@ ext4_dax_write_iter(struct kiocb *iocb, struct iov_iter *from)
24  {
25         struct inode *inode = file_inode(iocb->ki_filp);
26         ssize_t ret;
27 -       bool overwrite = false;
29         inode_lock(inode);
30         ret = ext4_write_checks(iocb, from);
31 @@ -188,16 +187,9 @@ ext4_dax_write_iter(struct kiocb *iocb, struct iov_iter *from)
32         if (ret)
33                 goto out;
35 -       if (ext4_overwrite_io(inode, iocb->ki_pos, iov_iter_count(from))) {
36 -               overwrite = true;
37 -               downgrade_write(&inode->i_rwsem);
38 -       }
39         ret = dax_iomap_rw(iocb, from, &ext4_iomap_ops);
40  out:
41 -       if (!overwrite)
42 -               inode_unlock(inode);
43 -       else
44 -               inode_unlock_shared(inode);
45 +       inode_unlock(inode);
46         if (ret > 0)
47                 ret = generic_write_sync(iocb, ret);
48         return ret;
49 -- 
50 2.1.4
53 To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
54 the body of a message to majordomo@vger.kernel.org
55 More majordomo info at  http://vger.kernel.org/majordomo-info.html