Skip to contentSkip to conversation

NFS does not work on linux-next 20140331

PATCH In review Fabio Estevam 4 participants 11 messages Mar 31, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi,

When running linux-next 20140331 I am no longer able to mount NFS on a mx6qsabresd board:

=================================
[ INFO: inconsistent lock state ]
3.14.0-rc8-next-20140331 #964 Not tainted
---------------------------------
inconsistent {IN-SOFTIRQ-W} -> {SOFTIRQ-ON-W} usage.
kworker/0:2/50 [HC0[0]:SC0[0]:HE1:SE1] takes:
(&addrconf_stats->syncp.seq){+.?...}, at: [<8057ca88>] mld_send_initial_cr.par0
{IN-SOFTIRQ-W} state was registered at:

  [<8006366c>] mark_lock+0x140/0x6ac
  [<80063ebc>] __lock_acquire+0x2e4/0x1c00
  [<80065cbc>] lock_acquire+0x68/0x7c
  [<8057bf28>] mld_sendpack+0xec/0x73c
  [<8057cc80>] mld_ifc_timer_expire+0x1e4/0x2e4
  [<8003310c>] call_timer_fn+0x74/0xec
  [<80033a5c>] run_timer_softirq+0x1c4/0x264
  [<8002d3d4>] __do_softirq+0x130/0x278
  [<8002d814>] irq_exit+0xb0/0x104
  [<8000f47c>] handle_IRQ+0x58/0xb8
  [<80008680>] gic_handle_irq+0x30/0x64
  [<800129a4>] __irq_svc+0x44/0x5c
  [<8005f9dc>] cpu_startup_entry+0xfc/0x160
  [<80617a3c>] rest_init+0xb0/0xd8
  [<8083db58>] start_kernel+0x324/0x388
  [<10008074>] 0x10008074
irq event stamp: 62347
hardirqs last  enabled at (62347): [<8002d67c>] __local_bh_enable_ip+0x80/0xe8
hardirqs last disabled at (62345): [<8002d63c>] __local_bh_enable_ip+0x40/0xe8
softirqs last  enabled at (62346): [<80558740>] ip6_finish_output2+0x16c/0x9d8
softirqs last disabled at (62334): [<80558624>] ip6_finish_output2+0x50/0x9d8

other info that might help us debug this:

 Possible unsafe locking scenario:
       CPU0
       ----
  lock(&addrconf_stats->syncp.seq);
  <Interrupt>
    lock(&addrconf_stats->syncp.seq);

*** DEADLOCK ***

4 locks held by kworker/0:2/50:

 #0:  ("%s"("ipv6_addrconf")){.+.+..}, at: [<8003f2d0>] process_one_work+0x134/4
 #1:  ((&(&ifa->dad_work)->work)){+.+...}, at: [<8003f2d0>] process_one_work+0x4
 #2:  (rtnl_mutex){+.+.+.}, at: [<804e0acc>] rtnl_lock+0x18/0x20
 #3:  (rcu_read_lock){......}, at: [<8057be3c>] mld_sendpack+0x0/0x73c
stack backtrace:
CPU: 0 PID: 50 Comm: kworker/0:2 Not tainted 3.14.0-rc8-next-20140331 #964
Workqueue: ipv6_addrconf addrconf_dad_work
Backtrace:
[<80011cd4>] (dump_backtrace) from [<80011e70>] (show_stack+0x18/0x1c)
 r6:be81c440 r5:00000000 r4:00000000 r3:be81c440
[<80011e58>] (show_stack) from [<8061e054>] (dump_stack+0x88/0xa4)
[<8061dfcc>] (dump_stack) from [<8061bcf8>] (print_usage_bug+0x260/0x2d0)
 r5:80784b0c r4:809aee20
[<8061ba98>] (print_usage_bug) from [<800637c8>] (mark_lock+0x29c/0x6ac)
 r10:80062cc0 r8:00000004 r7:be81c440 r6:00001054 r5:be81c8e8 r4:00000006
[<8006352c>] (mark_lock) from [<80064200>] (__lock_acquire+0x628/0x1c00)
 r10:bf7b755c r9:be82e000 r8:000001ef r7:8098e030 r6:808b3afc r5:be81c440
 r4:80dde8cc r3:00000004
[<80063bd8>] (__lock_acquire) from [<80065cbc>] (lock_acquire+0x68/0x7c)
 r10:808e4e00 r9:00000001 r8:80896d2c r7:00000001 r6:60000013 r5:be82e000
 r4:00000000
[<80065c54>] (lock_acquire) from [<8057c248>] (mld_sendpack+0x40c/0x73c)
 r7:00000000 r6:8057ca88 r5:0000004c r4:bf7b7438
[<8057be3c>] (mld_sendpack) from [<8057ca88>] (mld_send_initial_cr.part.18+0x9c)
 r10:be9d48d0 r9:00000001 r8:00000000 r7:00000001 r6:beb880c0 r5:bebe4668
 r4:00000000

[<8057c9ec>] (mld_send_initial_cr.part.18) from [<8057ffb0>] (ipv6_mc_dad_compl)
r10:00000000 r8:be9d48d0 r7:be9d2a00 r6:be9d2a20 r5:be8c8000 r4:be9d4800
[<8057ff7c>] (ipv6_mc_dad_complete) from [<805641b8>] (addrconf_dad_completed+0)
r4:be9d2a00 r3:be81c440
[<805640bc>] (addrconf_dad_completed) from [<8056445c>] (addrconf_dad_work+0x1f)
r5:be9d2a40 r4:be9d2a74
[<80564260>] (addrconf_dad_work) from [<8003f344>] (process_one_work+0x1a8/0x44)
r10:bf7b7200 r8:00000000 r7:be82e000 r6:bf7b15c0 r5:be9d2a74 r4:be801c80
[<8003f19c>] (process_one_work) from [<8003f9e4>] (worker_thread+0x124/0x398)
r10:808eddf6 r9:bf7b15c0 r8:be82e000 r7:be801c98 r6:be82e000 r5:bf7b15f0 r4:be801c80
[<8003f8c0>] (worker_thread) from [<8004669c>] (kthread+0xd0/0xec)
r10:00000000 r9:00000000 r8:00000000 r7:8003f8c0 r6:be801c80 r5:be808a40 r4:00000000
[<800465cc>] (kthread) from [<8000ebe8>] (ret_from_fork+0x14/0x2c)
r7:00000000 r6:00000000 r5:800465cc r4:be808a40

INFO: rcu_sched detected stalls on CPUs/tasks: {} (detected by 1, t=2102 jiffie)
INFO: Stall ended before state dump start
random: nonblocking pool is initialized
INFO: rcu_sched detected stalls on CPUs/tasks: {} (detected by 0, t=8407 jiffie)
INFO: Stall ended before state dump start
INFO: rcu_sched detected stalls on CPUs/tasks: {} (detected by 3, t=14712 jiffi)

INFO: Stall ended before state dump start

#1 lore raw
Quoted 35 lines · Fabio Estevam

Hi,

When running linux-next 20140331 I am no longer able to mount NFS on a mx6qsabresd board:

=================================
[ INFO: inconsistent lock state ]
3.14.0-rc8-next-20140331 #964 Not tainted
---------------------------------
inconsistent {IN-SOFTIRQ-W} -> {SOFTIRQ-ON-W} usage.
kworker/0:2/50 [HC0[0]:SC0[0]:HE1:SE1] takes:
(&addrconf_stats->syncp.seq){+.?...}, at: [<8057ca88>] mld_send_initial_cr.par0
{IN-SOFTIRQ-W} state was registered at:

  [<8006366c>] mark_lock+0x140/0x6ac
  [<80063ebc>] __lock_acquire+0x2e4/0x1c00
  [<80065cbc>] lock_acquire+0x68/0x7c
  [<8057bf28>] mld_sendpack+0xec/0x73c
  [<8057cc80>] mld_ifc_timer_expire+0x1e4/0x2e4
  [<8003310c>] call_timer_fn+0x74/0xec
  [<80033a5c>] run_timer_softirq+0x1c4/0x264
  [<8002d3d4>] __do_softirq+0x130/0x278
  [<8002d814>] irq_exit+0xb0/0x104
  [<8000f47c>] handle_IRQ+0x58/0xb8
  [<80008680>] gic_handle_irq+0x30/0x64
  [<800129a4>] __irq_svc+0x44/0x5c
  [<8005f9dc>] cpu_startup_entry+0xfc/0x160
  [<80617a3c>] rest_init+0xb0/0xd8
  [<8083db58>] start_kernel+0x324/0x388
  [<10008074>] 0x10008074
irq event stamp: 62347
hardirqs last  enabled at (62347): [<8002d67c>] __local_bh_enable_ip+0x80/0xe8
hardirqs last disabled at (62345): [<8002d63c>] __local_bh_enable_ip+0x40/0xe8
softirqs last  enabled at (62346): [<80558740>] ip6_finish_output2+0x16c/0x9d8
softirqs last disabled at (62334): [<80558624>] ip6_finish_output2+0x50/0x9d8
Quoted 8 lines

other info that might help us debug this:

 Possible unsafe locking scenario:
       CPU0
       ----
  lock(&addrconf_stats->syncp.seq);
  <Interrupt>
    lock(&addrconf_stats->syncp.seq);

Shit, my fault, statistic counters again. Hasn't turned up in my testing. I cook a patch today.

Thanks,

Hannes

#2 lore raw
In reply to Fabio Estevam
Quoted 90 lines · Fabio Estevam

Hi,

When running linux-next 20140331 I am no longer able to mount NFS on a mx6qsabresd board:

=================================
[ INFO: inconsistent lock state ]
3.14.0-rc8-next-20140331 #964 Not tainted
---------------------------------
inconsistent {IN-SOFTIRQ-W} -> {SOFTIRQ-ON-W} usage.
kworker/0:2/50 [HC0[0]:SC0[0]:HE1:SE1] takes:
(&addrconf_stats->syncp.seq){+.?...}, at: [<8057ca88>] mld_send_initial_cr.par0
{IN-SOFTIRQ-W} state was registered at:

  [<8006366c>] mark_lock+0x140/0x6ac
  [<80063ebc>] __lock_acquire+0x2e4/0x1c00
  [<80065cbc>] lock_acquire+0x68/0x7c
  [<8057bf28>] mld_sendpack+0xec/0x73c
  [<8057cc80>] mld_ifc_timer_expire+0x1e4/0x2e4
  [<8003310c>] call_timer_fn+0x74/0xec
  [<80033a5c>] run_timer_softirq+0x1c4/0x264
  [<8002d3d4>] __do_softirq+0x130/0x278
  [<8002d814>] irq_exit+0xb0/0x104
  [<8000f47c>] handle_IRQ+0x58/0xb8
  [<80008680>] gic_handle_irq+0x30/0x64
  [<800129a4>] __irq_svc+0x44/0x5c
  [<8005f9dc>] cpu_startup_entry+0xfc/0x160
  [<80617a3c>] rest_init+0xb0/0xd8
  [<8083db58>] start_kernel+0x324/0x388
  [<10008074>] 0x10008074
irq event stamp: 62347
hardirqs last  enabled at (62347): [<8002d67c>] __local_bh_enable_ip+0x80/0xe8
hardirqs last disabled at (62345): [<8002d63c>] __local_bh_enable_ip+0x40/0xe8
softirqs last  enabled at (62346): [<80558740>] ip6_finish_output2+0x16c/0x9d8
softirqs last disabled at (62334): [<80558624>] ip6_finish_output2+0x50/0x9d8

other info that might help us debug this:

 Possible unsafe locking scenario:
       CPU0
       ----
  lock(&addrconf_stats->syncp.seq);
  <Interrupt>
    lock(&addrconf_stats->syncp.seq);

*** DEADLOCK ***

4 locks held by kworker/0:2/50:

 #0:  ("%s"("ipv6_addrconf")){.+.+..}, at: [<8003f2d0>] process_one_work+0x134/4
 #1:  ((&(&ifa->dad_work)->work)){+.+...}, at: [<8003f2d0>] process_one_work+0x4
 #2:  (rtnl_mutex){+.+.+.}, at: [<804e0acc>] rtnl_lock+0x18/0x20
 #3:  (rcu_read_lock){......}, at: [<8057be3c>] mld_sendpack+0x0/0x73c
stack backtrace:
CPU: 0 PID: 50 Comm: kworker/0:2 Not tainted 3.14.0-rc8-next-20140331 #964
Workqueue: ipv6_addrconf addrconf_dad_work
Backtrace:
[<80011cd4>] (dump_backtrace) from [<80011e70>] (show_stack+0x18/0x1c)
 r6:be81c440 r5:00000000 r4:00000000 r3:be81c440
[<80011e58>] (show_stack) from [<8061e054>] (dump_stack+0x88/0xa4)
[<8061dfcc>] (dump_stack) from [<8061bcf8>] (print_usage_bug+0x260/0x2d0)
 r5:80784b0c r4:809aee20
[<8061ba98>] (print_usage_bug) from [<800637c8>] (mark_lock+0x29c/0x6ac)
 r10:80062cc0 r8:00000004 r7:be81c440 r6:00001054 r5:be81c8e8 r4:00000006
[<8006352c>] (mark_lock) from [<80064200>] (__lock_acquire+0x628/0x1c00)
 r10:bf7b755c r9:be82e000 r8:000001ef r7:8098e030 r6:808b3afc r5:be81c440
 r4:80dde8cc r3:00000004
[<80063bd8>] (__lock_acquire) from [<80065cbc>] (lock_acquire+0x68/0x7c)
 r10:808e4e00 r9:00000001 r8:80896d2c r7:00000001 r6:60000013 r5:be82e000
 r4:00000000
[<80065c54>] (lock_acquire) from [<8057c248>] (mld_sendpack+0x40c/0x73c)
 r7:00000000 r6:8057ca88 r5:0000004c r4:bf7b7438
[<8057be3c>] (mld_sendpack) from [<8057ca88>] (mld_send_initial_cr.part.18+0x9c)
 r10:be9d48d0 r9:00000001 r8:00000000 r7:00000001 r6:beb880c0 r5:bebe4668
 r4:00000000

[<8057c9ec>] (mld_send_initial_cr.part.18) from [<8057ffb0>] (ipv6_mc_dad_compl)
r10:00000000 r8:be9d48d0 r7:be9d2a00 r6:be9d2a20 r5:be8c8000 r4:be9d4800
[<8057ff7c>] (ipv6_mc_dad_complete) from [<805641b8>] (addrconf_dad_completed+0)
r4:be9d2a00 r3:be81c440
[<805640bc>] (addrconf_dad_completed) from [<8056445c>] (addrconf_dad_work+0x1f)
r5:be9d2a40 r4:be9d2a74
[<80564260>] (addrconf_dad_work) from [<8003f344>] (process_one_work+0x1a8/0x44)
r10:bf7b7200 r8:00000000 r7:be82e000 r6:bf7b15c0 r5:be9d2a74 r4:be801c80
[<8003f19c>] (process_one_work) from [<8003f9e4>] (worker_thread+0x124/0x398)
r10:808eddf6 r9:bf7b15c0 r8:be82e000 r7:be801c98 r6:be82e000 r5:bf7b15f0 r4:be801c80
[<8003f8c0>] (worker_thread) from [<8004669c>] (kthread+0xd0/0xec)
r10:00000000 r9:00000000 r8:00000000 r7:8003f8c0 r6:be801c80 r5:be808a40 r4:00000000
[<800465cc>] (kthread) from [<8000ebe8>] (ret_from_fork+0x14/0x2c)
r7:00000000 r6:00000000 r5:800465cc r4:be808a40

Quoted 8 lines
INFO: rcu_sched detected stalls on CPUs/tasks: {} (detected by 1, t=2102 jiffie)
INFO: Stall ended before state dump start
random: nonblocking pool is initialized
INFO: rcu_sched detected stalls on CPUs/tasks: {} (detected by 0, t=8407 jiffie)
INFO: Stall ended before state dump start
INFO: rcu_sched detected stalls on CPUs/tasks: {} (detected by 3, t=14712 jiffi)

INFO: Stall ended before state dump start
--

Hi Fabio

Could you try the following patch ?

net/ipv6/mcast.c +1 -1
index e1e47350784b..74a774af8265 100644
@@ -1588,7 +1588,7 @@ static void mld_sendpack(struct sk_buff *skb)
 
 	rcu_read_lock();
 	idev = __in6_dev_get(skb->dev);
-	IP6_UPD_PO_STATS(net, idev, IPSTATS_MIB_OUT, skb->len);
+	IP6_UPD_PO_STATS_BH(net, idev, IPSTATS_MIB_OUT, skb->len);
 
 	payload_len = (skb_tail_pointer(skb) - skb_network_header(skb)) -
 		sizeof(*pip6);
#3 lore raw

Hi Eric,

Quoted 9 lines · Eric Dumazet

Hi Fabio

Could you try the following patch ?

net/ipv6/mcast.c +0 -0
index e1e47350784b..74a774af8265 100644

net/ipv6/mcast.c static void mld_sendpack(struct sk_buff *skb) · line 1591

Quoted 5 lines
net/ipv6/mcast.c +1 -1
@@ -1588,7 +1588,7 @@ static void mld_sendpack(struct sk_buff *skb)
 
        rcu_read_lock();
        idev = __in6_dev_get(skb->dev);
-       IP6_UPD_PO_STATS(net, idev, IPSTATS_MIB_OUT, skb->len);
+       IP6_UPD_PO_STATS_BH(net, idev, IPSTATS_MIB_OUT, skb->len);

Thanks for the suggestion, but still get the same problem.

#4 lore raw
Quoted 14 lines · Fabio Estevam

Hi Eric,

Quoted 10 lines · Eric Dumazet

Hi Fabio

Could you try the following patch ?

net/ipv6/mcast.c +0 -0
index e1e47350784b..74a774af8265 100644
@@ -1588,7 +1588,7 @@ static void mld_sendpack(struct sk_buff *skb)
 
Quoted 6 lines

net/ipv6/mcast.c static void mld_sendpack(struct sk_buff *skb) · line 1591

Quoted 4 lines
net/ipv6/mcast.c +1 -1
        rcu_read_lock();
        idev = __in6_dev_get(skb->dev);
-       IP6_UPD_PO_STATS(net, idev, IPSTATS_MIB_OUT, skb->len);
+       IP6_UPD_PO_STATS_BH(net, idev, IPSTATS_MIB_OUT, skb->len);

Thanks for the suggestion, but still get the same problem.

Would you be able to quickly test this one?

net/ipv6/mcast.c +6 -5
index e1e4735..08b367c 100644
@@ -1620,11 +1620,12 @@ static void mld_sendpack(struct sk_buff *skb)
 		      dst_output);
 out:
 	if (!err) {
-		ICMP6MSGOUT_INC_STATS_BH(net, idev, ICMPV6_MLD2_REPORT);
-		ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_OUTMSGS);
-		IP6_UPD_PO_STATS_BH(net, idev, IPSTATS_MIB_OUTMCAST, payload_len);
-	} else
-		IP6_INC_STATS_BH(net, idev, IPSTATS_MIB_OUTDISCARDS);
+		ICMP6MSGOUT_INC_STATS(net, idev, ICMPV6_MLD2_REPORT);
+		ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTMSGS);
+		IP6_UPD_PO_STATS(net, idev, IPSTATS_MIB_OUTMCAST, payload_len);
+	} else {
+		IP6_INC_STATS(net, idev, IPSTATS_MIB_OUTDISCARDS);
+	}
 
 	rcu_read_unlock();
 	return;
author Tested-by
#5 lore raw
Quoted 11 lines · Hannes Frederic Sowa

Would you be able to quickly test this one?

net/ipv6/mcast.c +0 -1
index e1e4735..08b367c 100644
@@ -1620,11 +1620,12 @@ static void mld_sendpack(struct sk_buff *skb)
                      dst_output);
 out:
        if (!err) {
-               ICMP6MSGOUT_INC_STATS_BH(net, idev, ICMPV6_MLD2_REPORT);

net/ipv6/mcast.c static void mld_sendpack(struct sk_buff *skb) · line 1628

Quoted 10 lines
net/ipv6/mcast.c +6 -4
-               ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_OUTMSGS);
-               IP6_UPD_PO_STATS_BH(net, idev, IPSTATS_MIB_OUTMCAST, payload_len);
-       } else
-               IP6_INC_STATS_BH(net, idev, IPSTATS_MIB_OUTDISCARDS);
+               ICMP6MSGOUT_INC_STATS(net, idev, ICMPV6_MLD2_REPORT);
+               ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTMSGS);
+               IP6_UPD_PO_STATS(net, idev, IPSTATS_MIB_OUTMCAST, payload_len);
+       } else {
+               IP6_INC_STATS(net, idev, IPSTATS_MIB_OUTDISCARDS);
+       }

Thanks, Hannes. This makes NFS-mount to work fine again:

#6 lore raw
Quoted 27 lines · Fabio Estevam
Quoted 11 lines · Hannes Frederic Sowa

Would you be able to quickly test this one?

net/ipv6/mcast.c +0 -1
index e1e4735..08b367c 100644
@@ -1620,11 +1620,12 @@ static void mld_sendpack(struct sk_buff *skb)
                      dst_output);
 out:
        if (!err) {
-               ICMP6MSGOUT_INC_STATS_BH(net, idev, ICMPV6_MLD2_REPORT);

net/ipv6/mcast.c static void mld_sendpack(struct sk_buff *skb) · line 1628

Quoted 10 lines
net/ipv6/mcast.c +6 -4
-               ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_OUTMSGS);
-               IP6_UPD_PO_STATS_BH(net, idev, IPSTATS_MIB_OUTMCAST, payload_len);
-       } else
-               IP6_INC_STATS_BH(net, idev, IPSTATS_MIB_OUTDISCARDS);
+               ICMP6MSGOUT_INC_STATS(net, idev, ICMPV6_MLD2_REPORT);
+               ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTMSGS);
+               IP6_UPD_PO_STATS(net, idev, IPSTATS_MIB_OUTMCAST, payload_len);
+       } else {
+               IP6_INC_STATS(net, idev, IPSTATS_MIB_OUTDISCARDS);
+       }

Thanks, Hannes. This makes NFS-mount to work fine again:

Quoted 1 line

Thanks, Fabio!

Eric, do you mind if I take over, I'll audit the rest of the stack regarding this change, too.

#7 lore raw
Quoted 2 lines · Hannes Frederic Sowa

Eric, do you mind if I take over, I'll audit the rest of the stack regarding this change, too.

I do not mind at all ;)

#8 lore raw
In reply to Fabio Estevam
Quoted 14 lines · Fabio Estevam

Hi Eric,

Quoted 10 lines · Eric Dumazet

Hi Fabio

Could you try the following patch ?

net/ipv6/mcast.c +0 -0
index e1e47350784b..74a774af8265 100644
@@ -1588,7 +1588,7 @@ static void mld_sendpack(struct sk_buff *skb)
 
Quoted 6 lines

net/ipv6/mcast.c static void mld_sendpack(struct sk_buff *skb) · line 1591

Quoted 4 lines
net/ipv6/mcast.c +1 -1
        rcu_read_lock();
        idev = __in6_dev_get(skb->dev);
-       IP6_UPD_PO_STATS(net, idev, IPSTATS_MIB_OUT, skb->len);
+       IP6_UPD_PO_STATS_BH(net, idev, IPSTATS_MIB_OUT, skb->len);

Thanks for the suggestion, but still get the same problem.

Arg, I reversed the patch , problem is that we can be called from process context, not from softirq

net/ipv6/mcast.c +6 -6
index e1e47350784b..11a8d352c6b4 100644
@@ -1620,12 +1620,12 @@ static void mld_sendpack(struct sk_buff *skb)
 		      dst_output);
 out:
 	if (!err) {
-		ICMP6MSGOUT_INC_STATS_BH(net, idev, ICMPV6_MLD2_REPORT);
-		ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_OUTMSGS);
-		IP6_UPD_PO_STATS_BH(net, idev, IPSTATS_MIB_OUTMCAST, payload_len);
-	} else
-		IP6_INC_STATS_BH(net, idev, IPSTATS_MIB_OUTDISCARDS);
-
+		ICMP6MSGOUT_INC_STATS(net, idev, ICMPV6_MLD2_REPORT);
+		ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTMSGS);
+		IP6_UPD_PO_STATS(net, idev, IPSTATS_MIB_OUTMCAST, payload_len);
+	} else {
+		IP6_INC_STATS(net, idev, IPSTATS_MIB_OUTDISCARDS);
+	}
 	rcu_read_unlock();
 	return;
 
#9 lore raw

PATCH 1/1 ipv6: some ipv6 statistic counters failed to disable bh

In reply to Fabio Estevam

After commit c15b1ccadb323ea ("ipv6: move DAD and addrconf_verify processing to workqueue") some counters are now updated in process context and thus need to disable bh before doing so, otherwise deadlocks can happen on 32-bit archs. Fabio Estevam noticed this while while mounting a NFS volume on an ARM board.

As a compensation for missing this I looked after the other *_STATS_BH and found three other calls which need updating:

1) icmp6_send: ip6_fragment -> icmpv6_send -> icmp6_send (error handling)
2) ip6_push_pending_frames: rawv6_sendmsg -> rawv6_push_pending_frames -> ... (only in case of icmp protocol with raw sockets in error handling)
3) ping6_v6_sendmsg (error handling)

Fixes c15b1ccadb323ea ("ipv6: move DAD and addrconf_verify processing to workqueue")
Cc Eric Dumazet <[email protected]>

---

I would propose this patch for -stable, too.

Thanks!

 net/ipv6/icmp.c       |  2 +-
 net/ipv6/ip6_output.c |  4 ++--
 net/ipv6/mcast.c      | 11 ++++++-----
 net/ipv6/ping.c       |  4 ++--
 4 files changed, 11 insertions(+), 10 deletions(-)
net/ipv6/icmp.c +1 -1
index f2610e1..7b32652 100644
@@ -520,7 +520,7 @@ static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info)
 			      np->tclass, NULL, &fl6, (struct rt6_info *)dst,
 			      MSG_DONTWAIT, np->dontfrag);
 	if (err) {
-		ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_OUTERRORS);
+		ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTERRORS);
 		ip6_flush_pending_frames(sk);
 	} else {
 		err = icmpv6_push_pending_frames(sk, &fl6, &tmp_hdr,
net/ipv6/ip6_output.c +2 -2
index 64d6073..3702d17 100644
@@ -1566,8 +1566,8 @@ int ip6_push_pending_frames(struct sock *sk)
 	if (proto == IPPROTO_ICMPV6) {
 		struct inet6_dev *idev = ip6_dst_idev(skb_dst(skb));
 
-		ICMP6MSGOUT_INC_STATS_BH(net, idev, icmp6_hdr(skb)->icmp6_type);
-		ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_OUTMSGS);
+		ICMP6MSGOUT_INC_STATS(net, idev, icmp6_hdr(skb)->icmp6_type);
+		ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTMSGS);
 	}
 
 	err = ip6_local_out(skb);
net/ipv6/mcast.c +6 -5
index e1e4735..08b367c 100644
@@ -1620,11 +1620,12 @@ static void mld_sendpack(struct sk_buff *skb)
 		      dst_output);
 out:
 	if (!err) {
-		ICMP6MSGOUT_INC_STATS_BH(net, idev, ICMPV6_MLD2_REPORT);
-		ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_OUTMSGS);
-		IP6_UPD_PO_STATS_BH(net, idev, IPSTATS_MIB_OUTMCAST, payload_len);
-	} else
-		IP6_INC_STATS_BH(net, idev, IPSTATS_MIB_OUTDISCARDS);
+		ICMP6MSGOUT_INC_STATS(net, idev, ICMPV6_MLD2_REPORT);
+		ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTMSGS);
+		IP6_UPD_PO_STATS(net, idev, IPSTATS_MIB_OUTMCAST, payload_len);
+	} else {
+		IP6_INC_STATS(net, idev, IPSTATS_MIB_OUTDISCARDS);
+	}
 
 	rcu_read_unlock();
 	return;
net/ipv6/ping.c +2 -2
index 587bbdc..bda7429 100644
@@ -182,8 +182,8 @@ int ping_v6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
 			      MSG_DONTWAIT, np->dontfrag);
 
 	if (err) {
-		ICMP6_INC_STATS_BH(sock_net(sk), rt->rt6i_idev,
-				   ICMP6_MIB_OUTERRORS);
+		ICMP6_INC_STATS(sock_net(sk), rt->rt6i_idev,
+				ICMP6_MIB_OUTERRORS);
 		ip6_flush_pending_frames(sk);
 	} else {
 		err = icmpv6_push_pending_frames(sk, &fl6,
Signature · 1 line
1.9.0
maintainer
#10 lore raw

Re: [PATCH net] ipv6: some ipv6 statistic counters failed to disable bh

From: Hannes Frederic Sowa <[email protected]>
Date: Mon, 31 Mar 2014 20:14:10 +0200

Quoted 14 lines

After commit c15b1ccadb323ea ("ipv6: move DAD and addrconf_verify processing to workqueue") some counters are now updated in process context and thus need to disable bh before doing so, otherwise deadlocks can happen on 32-bit archs. Fabio Estevam noticed this while while mounting a NFS volume on an ARM board.

As a compensation for missing this I looked after the other *_STATS_BH and found three other calls which need updating:

1) icmp6_send: ip6_fragment -> icmpv6_send -> icmp6_send (error handling)
2) ip6_push_pending_frames: rawv6_sendmsg -> rawv6_push_pending_frames -> ... (only in case of icmp protocol with raw sockets in error handling)
3) ping6_v6_sendmsg (error handling)

Quoted 8 lines
Fixes c15b1ccadb323ea ("ipv6: move DAD and addrconf_verify processing to workqueue")
Cc Eric Dumazet <[email protected]>

---

I would propose this patch for -stable, too.

Applied and queued up for -stable, thanks.