linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] fs: fix lost error code in dio_complete
@ 2018-11-08 18:58 Maximilian Heyne
  2018-11-30  9:02 ` Maximilian Heyne
  0 siblings, 1 reply; 4+ messages in thread
From: Maximilian Heyne @ 2018-11-08 18:58 UTC (permalink / raw)
  Cc: Christoph Hellwig, Maximilian Heyne, Torsten Mehlan,
	Uwe Dannowski, Amit Shah, David Woodhouse, stable,
	Alexander Viro, linux-fsdevel, linux-kernel

commit e259221763a40403d5bb232209998e8c45804ab8 ("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.

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
---
v2: add description for s/transferred/ret/ change

 fs/direct-io.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/direct-io.c b/fs/direct-io.c
index 722d17c88edb..41a0e97252ae 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -325,8 +325,8 @@ static ssize_t dio_complete(struct dio *dio, ssize_t ret, unsigned int flags)
 		 */
 		dio->iocb->ki_pos += transferred;
 
-		if (dio->op == REQ_OP_WRITE)
-			ret = generic_write_sync(dio->iocb,  transferred);
+		if (ret > 0 && dio->op == REQ_OP_WRITE)
+			ret = generic_write_sync(dio->iocb, ret);
 		dio->iocb->ki_complete(dio->iocb, ret, 0);
 	}
 
-- 
2.16.5




Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrer: Christian Schlaeger, Ralf Herbrich
Ust-ID: DE 289 237 879
Eingetragen am Amtsgericht Charlottenburg HRB 149173 B



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] fs: fix lost error code in dio_complete
  2018-11-08 18:58 [PATCH v2] fs: fix lost error code in dio_complete Maximilian Heyne
@ 2018-11-30  9:02 ` Maximilian Heyne
  2018-11-30 10:46   ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: Maximilian Heyne @ 2018-11-30  9:02 UTC (permalink / raw)
  Cc: Christoph Hellwig, Torsten Mehlan, Uwe Dannowski, Amit Shah,
	David Woodhouse, stable, Alexander Viro, linux-fsdevel,
	linux-kernel

On 11/8/18 7:58 PM, Maximilian Heyne wrote:
> commit e259221763a40403d5bb232209998e8c45804ab8 ("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.
I just wanted to follow up on this. Has anyone picked up this patch?



Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrer: Christian Schlaeger, Ralf Herbrich
Ust-ID: DE 289 237 879
Eingetragen am Amtsgericht Charlottenburg HRB 149173 B


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] fs: fix lost error code in dio_complete
  2018-11-30  9:02 ` Maximilian Heyne
@ 2018-11-30 10:46   ` Christoph Hellwig
  2018-11-30 15:15     ` Jens Axboe
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2018-11-30 10:46 UTC (permalink / raw)
  To: Maximilian Heyne
  Cc: Christoph Hellwig, Torsten Mehlan, Uwe Dannowski, Amit Shah,
	David Woodhouse, stable, Alexander Viro, linux-fsdevel,
	linux-kernel, axboe

Al, Jens,

can someone pick this up, please?

On Fri, Nov 30, 2018 at 10:02:22AM +0100, Maximilian Heyne wrote:
> On 11/8/18 7:58 PM, Maximilian Heyne wrote:
>> commit e259221763a40403d5bb232209998e8c45804ab8 ("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.
> I just wanted to follow up on this. Has anyone picked up this patch?
>
>
>
> Amazon Development Center Germany GmbH
> Krausenstr. 38
> 10117 Berlin
> Geschaeftsfuehrer: Christian Schlaeger, Ralf Herbrich
> Ust-ID: DE 289 237 879
> Eingetragen am Amtsgericht Charlottenburg HRB 149173 B
>
---end quoted text---

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] fs: fix lost error code in dio_complete
  2018-11-30 10:46   ` Christoph Hellwig
@ 2018-11-30 15:15     ` Jens Axboe
  0 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2018-11-30 15:15 UTC (permalink / raw)
  To: Christoph Hellwig, Maximilian Heyne
  Cc: Torsten Mehlan, Uwe Dannowski, Amit Shah, David Woodhouse,
	stable, Alexander Viro, linux-fsdevel, linux-kernel

On 11/30/18 3:46 AM, Christoph Hellwig wrote:
> Al, Jens,
> 
> can someone pick this up, please?
> 
> On Fri, Nov 30, 2018 at 10:02:22AM +0100, Maximilian Heyne wrote:
>> On 11/8/18 7:58 PM, Maximilian Heyne wrote:
>>> commit e259221763a40403d5bb232209998e8c45804ab8 ("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.
>> I just wanted to follow up on this. Has anyone picked up this patch?

I'll pick it up.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-11-30 15:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-08 18:58 [PATCH v2] fs: fix lost error code in dio_complete Maximilian Heyne
2018-11-30  9:02 ` Maximilian Heyne
2018-11-30 10:46   ` Christoph Hellwig
2018-11-30 15:15     ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).