Re: [patch 2/2] lockdep: fix sk_dst_check() deadlock

2006-07-07 Thread Ingo Molnar

the correct Subject of the patch is:

  Subject: lockdep: annotate __icmpv6_socket

Ingo

* [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

> From: Ingo Molnar <[EMAIL PROTECTED]>
> 
> Split off __icmpv6_socket's sk->sk_dst_lock class, because it gets used
> from softirqs, which is safe for __icmpv6_sockets (because they never get
> directly used via userspace syscalls), but unsafe for normal sockets.
> 
> Has no effect on non-lockdep kernels.
> 
> Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>
> Cc: "David S. Miller" <[EMAIL PROTECTED]>
> Cc: Jeff Garzik <[EMAIL PROTECTED]>
> Cc: Arjan van de Ven <[EMAIL PROTECTED]>
> Acked-by: Herbert Xu <[EMAIL PROTECTED]>
> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
> ---
> 
>  net/ipv6/icmp.c |   13 +
>  1 files changed, 13 insertions(+)
> 
> diff -puN net/ipv6/icmp.c~lockdep-fix-sk_dst_check-deadlock net/ipv6/icmp.c
> --- a/net/ipv6/icmp.c~lockdep-fix-sk_dst_check-deadlock
> +++ a/net/ipv6/icmp.c
> @@ -712,6 +712,11 @@ discard_it:
>   return 0;
>  }
>  
> +/*
> + * Special lock-class for __icmpv6_socket:
> + */
> +static struct lock_class_key icmpv6_socket_sk_dst_lock_key;
> +
>  int __init icmpv6_init(struct net_proto_family *ops)
>  {
>   struct sock *sk;
> @@ -730,6 +735,14 @@ int __init icmpv6_init(struct net_proto_
>  
>   sk = per_cpu(__icmpv6_socket, i)->sk;
>   sk->sk_allocation = GFP_ATOMIC;
> + /*
> +  * Split off their lock-class, because sk->sk_dst_lock
> +  * gets used from softirqs, which is safe for
> +  * __icmpv6_socket (because those never get directly used
> +  * via userspace syscalls), but unsafe for normal sockets.
> +  */
> + lockdep_set_class(&sk->sk_dst_lock,
> +   &icmpv6_socket_sk_dst_lock_key);
>  
>   /* Enough space for 2 64K ICMP packets, including
>* sk_buff struct overhead.
> _
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 2/2] lockdep: fix sk_dst_check() deadlock

2006-07-07 Thread akpm
From: Ingo Molnar <[EMAIL PROTECTED]>

Split off __icmpv6_socket's sk->sk_dst_lock class, because it gets used
from softirqs, which is safe for __icmpv6_sockets (because they never get
directly used via userspace syscalls), but unsafe for normal sockets.

Has no effect on non-lockdep kernels.

Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>
Cc: "David S. Miller" <[EMAIL PROTECTED]>
Cc: Jeff Garzik <[EMAIL PROTECTED]>
Cc: Arjan van de Ven <[EMAIL PROTECTED]>
Acked-by: Herbert Xu <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
---

 net/ipv6/icmp.c |   13 +
 1 files changed, 13 insertions(+)

diff -puN net/ipv6/icmp.c~lockdep-fix-sk_dst_check-deadlock net/ipv6/icmp.c
--- a/net/ipv6/icmp.c~lockdep-fix-sk_dst_check-deadlock
+++ a/net/ipv6/icmp.c
@@ -712,6 +712,11 @@ discard_it:
return 0;
 }
 
+/*
+ * Special lock-class for __icmpv6_socket:
+ */
+static struct lock_class_key icmpv6_socket_sk_dst_lock_key;
+
 int __init icmpv6_init(struct net_proto_family *ops)
 {
struct sock *sk;
@@ -730,6 +735,14 @@ int __init icmpv6_init(struct net_proto_
 
sk = per_cpu(__icmpv6_socket, i)->sk;
sk->sk_allocation = GFP_ATOMIC;
+   /*
+* Split off their lock-class, because sk->sk_dst_lock
+* gets used from softirqs, which is safe for
+* __icmpv6_socket (because those never get directly used
+* via userspace syscalls), but unsafe for normal sockets.
+*/
+   lockdep_set_class(&sk->sk_dst_lock,
+ &icmpv6_socket_sk_dst_lock_key);
 
/* Enough space for 2 64K ICMP packets, including
 * sk_buff struct overhead.
_
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html