[PATCH] aio_write should tell userspace about partial writes - Kernel

This is a discussion on [PATCH] aio_write should tell userspace about partial writes - Kernel ; [ Linus, please apply. This patch was discussed and acked before, but somehow got lost. ] When an AIO write gets a non-retry error after writing some data (eg. ENOSPC), it should return the amount written already, not the error. ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: [PATCH] aio_write should tell userspace about partial writes

  1. [PATCH] aio_write should tell userspace about partial writes

    [ Linus, please apply. This patch was discussed and acked before,
    but somehow got lost. ]

    When an AIO write gets a non-retry error after writing some data
    (eg. ENOSPC), it should return the amount written already, not the
    error. Just like write() is supposed to.

    This was found by the libaio test suite.

    Signed-off-by: Rusty Russell
    Acked-By: Zach Brown
    ---
    fs/aio.c | 7 +++++++
    1 file changed, 7 insertions(+)

    diff -r c36fc295bb75 fs/aio.c
    --- a/fs/aio.c Tue Mar 11 09:04:47 2008 +1100
    +++ b/fs/aio.c Tue Mar 11 09:05:54 2008 +1100
    @@ -1358,6 +1358,13 @@ static ssize_t aio_rw_vect_retry(struct
    && iocb->ki_nbytes - iocb->ki_left)
    ret = iocb->ki_nbytes - iocb->ki_left;

    + /* If we managed to write some out we return that, rather than
    + * the eventual error. */
    + if (opcode == IOCB_CMD_PWRITEV
    + && ret < 0 && ret != -EIOCBQUEUED && ret != -EIOCBRETRY
    + && iocb->ki_nbytes - iocb->ki_left)
    + ret = iocb->ki_nbytes - iocb->ki_left;
    +
    return ret;
    }

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

  2. Re: [PATCH] aio_write should tell userspace about partial writes



    On Wed, 12 Mar 2008, Rusty Russell wrote:
    >
    > [ Linus, please apply. This patch was discussed and acked before,
    > but somehow got lost. ]


    Rusty, please *look* at your patches.

    It's pretty obvious even from just the patch that the patch has already
    been applied, and that the only reason you think it hasn't is that you use
    some crap-for-brains SCM model where you apply patches with GNU patch and
    allow fuzz, so it applied cleanly *again*.

    I assume that it's quilt messing up again.

    In particular, this already went in as commit
    7adfa2ff3efa02a7a9f2632d2d2662d3e5eb5304, and I know for a *fact* that it
    is in your tree too, since the patch itself clearly has that code double:

    > && iocb->ki_nbytes - iocb->ki_left)
    > ret = iocb->ki_nbytes - iocb->ki_left;


    Lookie above: those two lines are part of the thing that already got
    applied! If it hadn't been applied, it would look like

    if ((ret == 0) || (iocb->ki_left == 0))
    ret = iocb->ki_nbytes - iocb->ki_left;

    instead.

    I *hate* people who "merge" using patches, and then to make it even worse
    use a non-zero fuzz factor.

    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/

  3. Re: [PATCH] aio_write should tell userspace about partial writes

    On Thursday 13 March 2008 06:59:36 Linus Torvalds wrote:
    > On Wed, 12 Mar 2008, Rusty Russell wrote:
    > > [ Linus, please apply. This patch was discussed and acked before,
    > > but somehow got lost. ]

    >
    > Rusty, please *look* at your patches.


    Damn, sorry. I should never send mail before coffee.

    (Actually, I'm sending this before coffee, but that's OK because I can't
    possibly scrwe this up.)

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

+ Reply to Thread