From: Jarek Poplawski <jarkao2@gmail.com>
To: Vegard Nossum <vegard.nossum@gmail.com>
Cc: Eric Dumazet <dada1@cosmosbay.com>, Ingo Molnar <mingo@elte.hu>,
lkml <linux-kernel@vger.kernel.org>,
Linux Netdev List <netdev@vger.kernel.org>
Subject: Re: 2.6.27.9: splice_to_pipe() hung (blocked for more than 120 seconds)
Date: Mon, 19 Jan 2009 13:58:51 +0000 [thread overview]
Message-ID: <20090119135851.GC4788@ff.dom.local> (raw)
In-Reply-To: <19f34abd0901180544g617b29c1nc41c760f8803de0e@mail.gmail.com>
On 18-01-2009 14:44, Vegard Nossum wrote:
...
>
> I have one theory. We have this skeleton:
>
> ssize_t splice_from_pipe(struct pipe_inode_info *pipe, struct file *out,
> loff_t *ppos, size_t len, unsigned int flags,
> splice_actor *actor)
> {
> ...
> inode_double_lock(inode, pipe->inode);
> ret = __splice_from_pipe(pipe, &sd, actor);
> inode_double_unlock(inode, pipe->inode);
> ...
> }
>
> ssize_t __splice_from_pipe(struct pipe_inode_info *pipe, struct splice_desc *sd,
> splice_actor *actor)
> {
> ...
> pipe_wait(pipe);
> ...
> }
>
> void pipe_wait(struct pipe_inode_info *pipe)
> {
> if (pipe->inode)
> mutex_unlock(&pipe->inode->i_mutex);
> ...
> if (pipe->inode)
> mutex_lock(&pipe->inode->i_mutex);
> }
>
> So in short: Is it possible that inode_double_lock() in
> splice_from_pipe() first locks the pipe mutex, THEN locks the
> file/socket mutex? In that case, there should be a lock imbalance,
> because pipe_wait() would unlock the pipe while the file/socket mutex
> is held.
I guess you mean a lock inversion.
>
> That would possibly explain the sporadicity of the lockup; it depends
> on the actual order of the double lock.
>
> Why doesn't lockdep report that? Hm. I guess it is because these are
> both inode mutexes and lockdep can't detect a locking imbalance within
> the same lock class?
Looks like you are right. Since there is used mutex_lock_nested() for
these locks in inode_double_lock(), lockdep could be mislead by this
"common" mutex_lock() later (but I didn't check this too much).
Jarek P.
prev parent reply other threads:[~2009-01-19 13:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-16 18:55 2.6.27.9: splice_to_pipe() hung (blocked for more than 120 seconds) Vegard Nossum
2009-01-16 20:48 ` Eric Dumazet
2009-01-18 12:12 ` Vegard Nossum
2009-01-18 13:44 ` Vegard Nossum
2009-01-18 14:10 ` Vegard Nossum
2009-01-19 13:58 ` Jarek Poplawski [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=20090119135851.GC4788@ff.dom.local \
--to=jarkao2@gmail.com \
--cc=dada1@cosmosbay.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=netdev@vger.kernel.org \
--cc=vegard.nossum@gmail.com \
/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.