[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20090119135851.GC4788@ff.dom.local>
Date: Mon, 19 Jan 2009 13:58:51 +0000
From: Jarek Poplawski <jarkao2@...il.com>
To: Vegard Nossum <vegard.nossum@...il.com>
Cc: Eric Dumazet <dada1@...mosbay.com>, Ingo Molnar <mingo@...e.hu>,
lkml <linux-kernel@...r.kernel.org>,
Linux Netdev List <netdev@...r.kernel.org>
Subject: Re: 2.6.27.9: splice_to_pipe() hung (blocked for more than 120
seconds)
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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists