lkml.org 
[lkml]   [2006]   [May]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: splice(SPLICE_F_MOVE) problems
    On Wed, May 03 2006, Oleg Nesterov wrote:
    > On 05/03, Jens Axboe wrote:
    > >
    > > On Wed, May 03 2006, Oleg Nesterov wrote:
    > >
    > > > However, user_page_pipe_buf_steal() returns unlocked page in
    > > > PIPE_BUF_FLAG_GIFT case. So, if add_to_page_cache() fails,
    > > > unlock_page() will trigger BUG().
    > >
    > > It does, it calls generic_pipe_buf_steal() which locks it.
    >
    > What I have in splice.c:
    >
    > static int user_page_pipe_buf_steal(struct pipe_inode_info *pipe,
    > struct pipe_buffer *buf)
    > {
    > if (!(buf->flags & PIPE_BUF_FLAG_GIFT))
    > return 1;
    >
    > return 0;
    > }
    >
    > (I don't use git, reading Linus's tree via http).

    Ah ok, it got fixed yesterday:

    static int user_page_pipe_buf_steal(struct pipe_inode_info *pipe,
    struct pipe_buffer *buf)
    {
    if (!(buf->flags & PIPE_BUF_FLAG_GIFT))
    return 1;

    return generic_pipe_buf_steal(pipe, buf);
    }

    > > > ret = mapping->a_ops->prepare_write(file, page, offset, offset+this_len);
    > > > if (ret == AOP_TRUNCATED_PAGE) {
    > > > page_cache_release(page);
    > > > goto find_page;
    > > >
    > > > We also need to unlock(page) if it was stealed.
    > >
    > > Are you sure that's the right test? Don't you mean if ret !=
    > > AOP_TRUNCATED_PAGE && ret?
    > >
    > > How about the attached?
    >
    > Ah, yes, you are right. Sorry for confusion.

    Good, I already committed that variant of the fix :)

    --
    Jens Axboe

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

    \
     
     \ /
      Last update: 2006-05-03 12:51    [W:0.021 / U:187.292 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site