[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <E1MTDyo-0002rz-FR@pomaz-ex.szeredi.hu>
Date: Tue, 21 Jul 2009 13:57:58 +0200
From: Miklos Szeredi <miklos@...redi.hu>
To: peterz@...radead.org
CC: eric.sesterhenn@...xperts.de, linux-kernel@...r.kernel.org,
mingo@...hat.com, miklos@...redi.hu
Subject: Re: Lockdep warning for sys_tee system call
On Tue, 21 Jul 2009, Peter Zijlstra wrote:
> void pipe_double_lock(struct pipe_inode_info *pipe1,
> struct pipe_inode_info *pipe2)
> {
> BUG_ON(pipe1 == pipe2);
>
> if (pipe1 < pipe2) {
> pipe_lock_nested(pipe1, I_MUTEX_PARENT);
> pipe_lock_nested(pipe2, I_MUTEX_CHILD);
> } else {
> pipe_lock_nested(pipe2, I_MUTEX_CHILD);
> pipe_lock_nested(pipe1, I_MUTEX_PARENT);
> }
> }
>
> That's an obvious FAIL right there.
>
> Miklos?
Right, copy-paste bug. At least I got the locking right ;)
Acked-by: Miklos Szeredi <mszeredi@...e.cz>
Thanks,
Miklos
>
> ---
> Subject: fs/pipe: rectify a lockdep annotation
>
> The presumed use of the pipe_double_lock() routine is to lock 2 locks in
> a deadlock free way by ordering the locks by their address. However it
> fails to keep the specified lock classes in order and explicitly
> annotates a deadlock.
>
> Rectify this.
>
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@...llo.nl>
> ---
> fs/pipe.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/pipe.c b/fs/pipe.c
> index f7dd21a..52c4151 100644
> --- a/fs/pipe.c
> +++ b/fs/pipe.c
> @@ -68,8 +68,8 @@ void pipe_double_lock(struct pipe_inode_info *pipe1,
> pipe_lock_nested(pipe1, I_MUTEX_PARENT);
> pipe_lock_nested(pipe2, I_MUTEX_CHILD);
> } else {
> - pipe_lock_nested(pipe2, I_MUTEX_CHILD);
> - pipe_lock_nested(pipe1, I_MUTEX_PARENT);
> + pipe_lock_nested(pipe2, I_MUTEX_PARENT);
> + pipe_lock_nested(pipe1, I_MUTEX_CHILD);
> }
> }
>
>
>
--
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