Re: [PATCH] fs: fix lost error code in dio_complete

From: Shah, Amit
Date: Thu Nov 01 2018 - 05:06:27 EST



On Do, 2018-11-01 at 09:03 +0100, Maximilian Heyne wrote:
> On 10/31/18 10:24 AM, Shah, Amit wrote:
> >
> > On Di, 2018-10-30 at 21:57 +0000, Maximilian Heyne wrote:
> > >
> > > [...]
> > >
> > > 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.
> In an above code line `ret` is set to `transferred`. So the change is
> a no op. However, in my opinion the construct then looks cleaner.

Yes, makes it also in line with the other callers, so this is good, thanks.



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