summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorFilipe Manana <fdmanana@suse.com>2020-06-15 18:48:58 +0100
committerSasha Levin <sashal@kernel.org>2020-06-30 15:37:08 -0400
commita79c3a99ac8187d79ce7cc6be8329454d2321ef5 (patch)
tree4417f0aa966fda9231a1d2b05a09f17f5d049ffc /mm
parent863a197f7f102bfbd42f79b40c50947e9019f011 (diff)
downloadlinux-rpi-a79c3a99ac8187d79ce7cc6be8329454d2321ef5.tar.gz
linux-rpi-a79c3a99ac8187d79ce7cc6be8329454d2321ef5.tar.bz2
linux-rpi-a79c3a99ac8187d79ce7cc6be8329454d2321ef5.zip
btrfs: fix failure of RWF_NOWAIT write into prealloc extent beyond eof
commit 4b1946284dd6641afdb9457101056d9e6ee6204c upstream. If we attempt to write to prealloc extent located after eof using a RWF_NOWAIT write, we always fail with -EAGAIN. We do actually check if we have an allocated extent for the write at the start of btrfs_file_write_iter() through a call to check_can_nocow(), but later when we go into the actual direct IO write path we simply return -EAGAIN if the write starts at or beyond EOF. Trivial to reproduce: $ mkfs.btrfs -f /dev/sdb $ mount /dev/sdb /mnt $ touch /mnt/foo $ chattr +C /mnt/foo $ xfs_io -d -c "pwrite -S 0xab 0 64K" /mnt/foo wrote 65536/65536 bytes at offset 0 64 KiB, 16 ops; 0.0004 sec (135.575 MiB/sec and 34707.1584 ops/sec) $ xfs_io -c "falloc -k 64K 1M" /mnt/foo $ xfs_io -d -c "pwrite -N -V 1 -S 0xfe -b 64K 64K 64K" /mnt/foo pwrite: Resource temporarily unavailable On xfs and ext4 the write succeeds, as expected. Fix this by removing the wrong check at btrfs_direct_IO(). Fixes: edf064e7c6fec3 ("btrfs: nowait aio support") CC: stable@vger.kernel.org # 4.14+ Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'mm')
0 files changed, 0 insertions, 0 deletions