]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit - fs/direct-io.c
direct-io: allow direct writes to empty inodes
authorErnesto A. Fernández <ernesto.mnd.fernandez@gmail.com>
Mon, 8 Oct 2018 23:58:23 +0000 (20:58 -0300)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
commit282187e6b98e983b2ec8512795d6c702f34adb13
tree9250fb6e7617f4efbd5e13e943c968c69c63312c
parent8acd3a45bb723151bcd6f50c5d7b508588e2dbad
direct-io: allow direct writes to empty inodes

BugLink: https://bugs.launchpad.net/bugs/1837813
[ Upstream commit 8b9433eb4de3c26a9226c981c283f9f4896ae030 ]

On a DIO_SKIP_HOLES filesystem, the ->get_block() method is currently
not allowed to create blocks for an empty inode.  This confusion comes
from trying to bit shift a negative number, so check the size of the
inode first.

The problem is most visible for hfsplus, because the fallback to
buffered I/O doesn't happen and the write fails with EIO.  This is in
part the fault of the module, because it gives a wrong return value on
->get_block(); that will be fixed in a separate patch.

Reviewed-by: Jeff Moyer <jmoyer@redhat.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Ernesto A. Fernández <ernesto.mnd.fernandez@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
fs/direct-io.c