All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@suse.de>
To: Oleg Nesterov <oleg@tv-sign.ru>
Cc: linux-kernel@vger.kernel.org, Linus Torvalds <torvalds@osdl.org>,
	Ingo Molnar <mingo@elte.hu>
Subject: Re: splice(SPLICE_F_MOVE) problems
Date: Wed, 3 May 2006 12:48:50 +0200	[thread overview]
Message-ID: <20060503104850.GR9712@suse.de> (raw)
In-Reply-To: <20060503143515.GA94@oleg>

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


      reply	other threads:[~2006-05-03 10:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-01  6:59 splice(SPLICE_F_MOVE) problems Oleg Nesterov
2006-05-01  6:54 ` Jens Axboe
2006-05-01 19:06   ` Oleg Nesterov
2006-05-01 17:41     ` Jens Axboe
2006-05-02  0:11       ` Oleg Nesterov
2006-05-02  5:28         ` Jens Axboe
2006-05-03  4:14           ` Oleg Nesterov
2006-05-03  6:56             ` Jens Axboe
2006-05-03 14:35               ` Oleg Nesterov
2006-05-03 10:48                 ` Jens Axboe [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060503104850.GR9712@suse.de \
    --to=axboe@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@tv-sign.ru \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.