Re: + syscalls-x86-add-__nr_kcmp-syscall-v8.patch added to -mm tree

From: Oleg Nesterov
Date: Thu Feb 16 2012 - 14:11:43 EST


On 02/16, Vasiliy Kulikov wrote:
>
> On Thu, Feb 16, 2012 at 20:49 +0400, Cyrill Gorcunov wrote:
> > + err = mutex_lock_killable(m1);
> > + if (!err && likely(m1 != m2)) {
> > + err = mutex_lock_killable_nested(m2, SINGLE_DEPTH_NESTING);
>
> Doesn't it lead to a deadlock?
>
> mutex_lock_killable(task1)
> | mutex_lock_killable(task2)
> mutex_lock_killable_nested(task2) |
> (locked) |
> mutex_lock_killable_nested(task1)
> (locked)

Please note the

if (m1 >= m2)
swap(m1. m2)

at the start.

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/