]> git.baikalelectronics.ru Git - kernel.git/commit
fs: fix lost error code in dio_complete
authorMaximilian Heyne <mheyne@amazon.de>
Fri, 30 Nov 2018 15:35:14 +0000 (08:35 -0700)
committerJens Axboe <axboe@kernel.dk>
Fri, 30 Nov 2018 15:35:14 +0000 (08:35 -0700)
commit1fe04fb8410542f04b30e63fa510c0ab50f80828
tree0303bd32705cc3430a3b9f6d3e7673e7e649bcb3
parent71dca1bc05b4b7daa7b5ce27049082b27a5630fd
fs: fix lost error code in dio_complete

commit 041a569f309e0d4244ebc1429d65fd9b493bc8f0 ("fs: simplify the
generic_write_sync prototype") reworked callers of generic_write_sync(),
and ended up dropping the error return for the directio path. Prior to
that commit, in dio_complete(), an error would be bubbled up the stack,
but after that commit, errors passed on to dio_complete were eaten up.

This was reported on the list earlier, and a fix was proposed in
https://lore.kernel.org/lkml/20160921141539.GA17898@infradead.org/, but
never followed up with.  We recently hit this bug in our testing where
fencing io errors, which were previously erroring out with EIO, were
being returned as success operations after this commit.

The fix proposed on the list earlier was a little short -- it would have
still called generic_write_sync() in case `ret` already contained an
error. This fix ensures generic_write_sync() is only called when there's
no pending error in the write. Additionally, transferred is replaced
with ret to bring this code in line with other callers.

Fixes: 041a569f309e ("fs: simplify the generic_write_sync prototype")
Reported-by: Ravi Nankani <rnankani@amazon.com>
Signed-off-by: Maximilian Heyne <mheyne@amazon.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
CC: Torsten Mehlan <tomeh@amazon.de>
CC: Uwe Dannowski <uwed@amazon.de>
CC: Amit Shah <aams@amazon.de>
CC: David Woodhouse <dwmw@amazon.co.uk>
CC: stable@vger.kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/direct-io.c