Re: splice(SPLICE_F_MOVE) problems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux