Re: splice(SPLICE_F_MOVE) problems

From: Oleg Nesterov
Date: Wed May 03 2006 - 06:35:13 EST


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

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

Oleg.

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