]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit
xfs: reject all unaligned direct writes to reflinked files
authorChristoph Hellwig <hch@lst.de>
Mon, 6 Feb 2017 21:00:54 +0000 (13:00 -0800)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 21 Apr 2017 08:11:15 +0000 (10:11 +0200)
commit9cfc50eab68a522c7056569cdb212da669fe736a
treec319dba026a8ed30c5ad909becd140f7ecc4fbfd
parent8a56b4384070f9dbd6339ba951775d75a3e5d549
xfs: reject all unaligned direct writes to reflinked files

BugLink: http://bugs.launchpad.net/bugs/1681875
commit 54a4ef8af4e0dc5c983d17fcb9cf5fd25666d94e upstream.

We currently fall back from direct to buffered writes if we detect a
remaining shared extent in the iomap_begin callback.  But by the time
iomap_begin is called for the potentially unaligned end block we might
have already written most of the data to disk, which we'd now write
again using buffered I/O.  To avoid this reject all writes to reflinked
files before starting I/O so that we are guaranteed to only write the
data once.

The alternative would be to unshare the unaligned start and/or end block
before doing the I/O. I think that's doable, and will actually be
required to support reflinks on DAX file system.  But it will take a
little more time and I'd rather get rid of the double write ASAP.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
fs/xfs/xfs_file.c
fs/xfs/xfs_iomap.c
fs/xfs/xfs_trace.h