Re: [PATCH] loop sendfile retval

From: Linus Torvalds (torvalds@transmeta.com)
Date: Mon Nov 11 2002 - 11:53:09 EST


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.

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_.

                Linus

-
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/



This archive was generated by hypermail 2b29 : Fri Nov 15 2002 - 22:00:22 EST