[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1540977883.6429.74.camel@amazon.com>
Date: Wed, 31 Oct 2018 09:24:43 +0000
From: "Shah, Amit" <aams@...zon.de>
To: "Heyne, Maximilian" <mheyne@...zon.de>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"Woodhouse, David" <dwmw@...zon.co.uk>, "hch@....de" <hch@....de>,
"stable@...r.kernel.org" <stable@...r.kernel.org>,
"viro@...iv.linux.org.uk" <viro@...iv.linux.org.uk>,
"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
"Dannowski, Uwe" <uwed@...zon.de>,
"Mehlan, Torsten" <tomeh@...zon.de>
Subject: Re: [PATCH] fs: fix lost error code in dio_complete
On Di, 2018-10-30 at 21:57 +0000, 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.
>
> 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.
>
> CC: stable@...r.kernel.org
> Reported-by: Ravi Nankani <rnankani@...zon.com>
> Signed-off-by: Maximilian Heyne <mheyne@...zon.de>
> Signed-off-by: Torsten Mehlan <tomeh@...zon.de>
> Signed-off-by: Uwe Dannowski <uwed@...zon.de>
> Signed-off-by: Amit Shah <aams@...zon.de>
> Signed-off-by: David Woodhouse <dwmw@...zon.co.uk>
> ---
> 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 093fb54cd316..199146036093 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);
Is the s/transferred/ret/ change necessary? Needs explaining, at least.
> dio->iocb->ki_complete(dio->iocb, ret, 0);
> }
>
Thanks,
Amit
Amazon Development Center Germany GmbH
Berlin - Dresden - Aachen
main office: Krausenstr. 38, 10117 Berlin
Geschaeftsfuehrer: Dr. Ralf Herbrich, Christian Schlaeger
Ust-ID: DE289237879
Eingetragen am Amtsgericht Charlottenburg HRB 149173 B
Powered by blists - more mailing lists