Re: [PATCH] loop sendfile retval

Hugh Dickins (hugh@veritas.com)
Mon, 11 Nov 2002 17:48:17 +0000 (GMT)


On Mon, 11 Nov 2002, Linus Torvalds wrote:
> On Mon, 11 Nov 2002, Hugh Dickins wrote:
> >
> > Buffer I/O error on device loop: its use of sendfile is (trivially)
> > broken - retval is usually count done, only an error when negative.
>
> Hmm.. Sendfile can return other values than "count" (ie a partial read).
> This return value change makes "do_lo_receive()" lose that information. As
> such, the new do_lo_receive() is weaker than the old one.

True, with that patch it's passing back less info than 2.5.47 tried to do;
but no less than 2.5.46 and earlier, which always returned desc.error and
ignored the desc.written, desc.count coming back from do_generic_file_read.
So it's not a regression, but of course you're right that it's weak.

> If fixing the loop code to handle partial IO is too nasty, then I would
> suggest doing maybe something like
>
> if (ret > 0 && ret != bvec->bv_len)
> ret = -EIO;
>
> which at least makes a partial IO an error instead of making it a success
> case (the code as-is seems to think that any non-negative return value
> means that the IO was fully successful).
>
> > Nearby spinlocking clearly bogus, delete instead of remarking on it.
>
> I'll apply the patch, it looks better than what is there now, but it might
> be worth fixing this _right_.

Thanks, that gets it going again. I'll step aside and leave the correct
partial handling to those who know loop much better than I - Adam?

Hugh

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/