2017-01-05 21:35:11

by Scott Mayhew

[permalink] [raw]
Subject: [PATCH 0/3] nfsd/lockd notifier block fixes

These patches fix some issues with the notifier blocks used by nfsd and
lockd. The first two patches initialize the scope id for link local
addresses (this is needed because rpc_cmp_addr6 looks at it when
comparing link local addresses). The third patch fixes the illegal
context switch warnings such as the following:


Jan 04 16:27:20 fedora25 kernel: ===============================
Jan 04 16:27:20 fedora25 kernel: [ INFO: suspicious RCU usage. ]
Jan 04 16:27:20 fedora25 kernel: 4.10.0-rc2+ #9 Not tainted
Jan 04 16:27:20 fedora25 kernel: -------------------------------
Jan 04 16:27:20 fedora25 kernel: ./include/linux/rcupdate.h:557 Illegal context switch in RCU read-side critical section!
Jan 04 16:27:20 fedora25 kernel:
other info that might help us debug this:
Jan 04 16:27:20 fedora25 kernel:
rcu_scheduler_active = 1, debug_locks = 1
Jan 04 16:27:20 fedora25 kernel: 2 locks held by ip/1281:
Jan 04 16:27:20 fedora25 kernel: #0: (rtnl_mutex){+.+.+.}, at: [<ffffffff977abd6b>] rtnetlink_rcv+0x1b/0x40
Jan 04 16:27:20 fedora25 kernel: #1: (rcu_read_lock){......}, at: [<ffffffff970d76c5>] atomic_notifier_call_chain+0x5/0x100
Jan 04 16:27:20 fedora25 kernel:
stack backtrace:
Jan 04 16:27:20 fedora25 kernel: CPU: 3 PID: 1281 Comm: ip Not tainted 4.10.0-rc2+ #9
Jan 04 16:27:20 fedora25 kernel: Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.9.1-1.fc24 04/01/2014
Jan 04 16:27:20 fedora25 kernel: Call Trace:
Jan 04 16:27:20 fedora25 kernel: dump_stack+0x86/0xc3
Jan 04 16:27:20 fedora25 kernel: lockdep_rcu_suspicious+0xc5/0x100
Jan 04 16:27:20 fedora25 kernel: __schedule+0x4a8/0xab0
Jan 04 16:27:20 fedora25 kernel: ? irq_work_queue+0x8d/0xa0
Jan 04 16:27:20 fedora25 kernel: _cond_resched+0x2b/0x40
Jan 04 16:27:20 fedora25 kernel: lock_sock_nested+0x24/0xa0
Jan 04 16:27:20 fedora25 kernel: sock_setsockopt+0x8b/0xac0
Jan 04 16:27:20 fedora25 kernel: ? __local_bh_enable_ip+0x70/0xc0
Jan 04 16:27:20 fedora25 kernel: kernel_setsockopt+0x49/0x50
Jan 04 16:27:20 fedora25 kernel: svc_tcp_kill_temp_xprt+0x4a/0x60 [sunrpc]
Jan 04 16:27:20 fedora25 kernel: svc_age_temp_xprts_now+0x186/0x210 [sunrpc]
Jan 04 16:27:20 fedora25 kernel: nfsd_inet6addr_event+0x1a5/0x200 [nfsd]
Jan 04 16:27:20 fedora25 kernel: ? nfsd_inet6addr_event+0x5/0x200 [nfsd]
Jan 04 16:27:20 fedora25 kernel: notifier_call_chain+0x4a/0x70
Jan 04 16:27:20 fedora25 kernel: atomic_notifier_call_chain+0x67/0x100
Jan 04 16:27:20 fedora25 kernel: ? atomic_notifier_call_chain+0x5/0x100
Jan 04 16:27:20 fedora25 kernel: inet6addr_notifier_call_chain+0x1b/0x20
Jan 04 16:27:20 fedora25 kernel: ipv6_del_addr+0x145/0x250
Jan 04 16:27:20 fedora25 kernel: inet6_addr_del+0xf1/0x1b0
Jan 04 16:27:20 fedora25 kernel: inet6_rtm_deladdr+0xa9/0xc0
Jan 04 16:27:20 fedora25 kernel: rtnetlink_rcv_msg+0xe6/0x210
Jan 04 16:27:20 fedora25 kernel: ? debug_lockdep_rcu_enabled+0x1d/0x20
Jan 04 16:27:20 fedora25 kernel: ? rtnl_newlink+0x860/0x860
Jan 04 16:27:20 fedora25 kernel: netlink_rcv_skb+0xa4/0xc0
Jan 04 16:27:20 fedora25 kernel: rtnetlink_rcv+0x2a/0x40
Jan 04 16:27:20 fedora25 kernel: netlink_unicast+0x1e5/0x2e0
Jan 04 16:27:20 fedora25 kernel: ? netlink_unicast+0x16f/0x2e0
Jan 04 16:27:20 fedora25 kernel: netlink_sendmsg+0x2fe/0x3b0
Jan 04 16:27:20 fedora25 kernel: sock_sendmsg+0x38/0x50
Jan 04 16:27:20 fedora25 kernel: ___sys_sendmsg+0x2e0/0x2f0
Jan 04 16:27:20 fedora25 kernel: ? trace_hardirqs_on_caller+0xf5/0x1b0
Jan 04 16:27:20 fedora25 kernel: ? _raw_spin_unlock+0x27/0x30
Jan 04 16:27:20 fedora25 kernel: ? handle_mm_fault+0x6b5/0x15f0
Jan 04 16:27:20 fedora25 kernel: ? handle_mm_fault+0x4f/0x15f0
Jan 04 16:27:20 fedora25 kernel: ? debug_lockdep_rcu_enabled+0x1d/0x20
Jan 04 16:27:20 fedora25 kernel: __sys_sendmsg+0x54/0x90
Jan 04 16:27:20 fedora25 kernel: SyS_sendmsg+0x12/0x20
Jan 04 16:27:20 fedora25 kernel: entry_SYSCALL_64_fastpath+0x1f/0xc2
Jan 04 16:27:20 fedora25 kernel: RIP: 0033:0x7f8fd55e6037
Jan 04 16:27:20 fedora25 kernel: RSP: 002b:00007ffc7f1a7558 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
Jan 04 16:27:20 fedora25 kernel: RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f8fd55e6037
Jan 04 16:27:20 fedora25 kernel: RDX: 0000000000000000 RSI: 00007ffc7f1a75a0 RDI: 0000000000000003
Jan 04 16:27:20 fedora25 kernel: RBP: 00007ffc7f1a75a0 R08: 0000000000000400 R09: fefefeff77686d74
Jan 04 16:27:20 fedora25 kernel: R10: 00000000000005eb R11: 0000000000000246 R12: 0000000000000000
Jan 04 16:27:20 fedora25 kernel: R13: 000000000065d3a0 R14: 00007ffc7f1af6e0 R15: 00007ffc7f1af6e8


Scott Mayhew (3):
nfsd: initialize sin6_scope_id in nfsd_inet6addr_event()
lockd: initialize sin6_scope_id in lockd_inet6addr_event()
sunrpc: don't call sleeping functions from the notifier block
callbacks

fs/lockd/svc.c | 2 ++
fs/nfsd/nfssvc.c | 2 ++
include/linux/sunrpc/svc_xprt.h | 1 +
net/sunrpc/svc_xprt.c | 10 +++++++---
4 files changed, 12 insertions(+), 3 deletions(-)

--
2.7.4



2017-01-05 21:35:11

by Scott Mayhew

[permalink] [raw]
Subject: [PATCH 3/3] sunrpc: don't call sleeping functions from the notifier block callbacks

The inet6addr_chain is an atomic notifier chain, so we can't call
anything that might sleep (like lock_sock)... instead of closing the
socket from svc_age_temp_xprts_now (which is called by the notifier
function), just have the rpc service threads do it instead.

Signed-off-by: Scott Mayhew <[email protected]>
---
include/linux/sunrpc/svc_xprt.h | 1 +
net/sunrpc/svc_xprt.c | 10 +++++++---
2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h
index e5d1934..7440290 100644
--- a/include/linux/sunrpc/svc_xprt.h
+++ b/include/linux/sunrpc/svc_xprt.h
@@ -66,6 +66,7 @@ struct svc_xprt {
#define XPT_LISTENER 10 /* listening endpoint */
#define XPT_CACHE_AUTH 11 /* cache auth info */
#define XPT_LOCAL 12 /* connection from loopback interface */
+#define XPT_KILL_TEMP 13 /* call xpo_kill_temp_xprt before closing */

struct svc_serv *xpt_server; /* service for transport */
atomic_t xpt_reserved; /* space on outq that is rsvd */
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
index 3bc1d61..9c9db55 100644
--- a/net/sunrpc/svc_xprt.c
+++ b/net/sunrpc/svc_xprt.c
@@ -799,6 +799,8 @@ static int svc_handle_xprt(struct svc_rqst *rqstp, struct svc_xprt *xprt)

if (test_bit(XPT_CLOSE, &xprt->xpt_flags)) {
dprintk("svc_recv: found XPT_CLOSE\n");
+ if (test_and_clear_bit(XPT_KILL_TEMP, &xprt->xpt_flags))
+ xprt->xpt_ops->xpo_kill_temp_xprt(xprt);
svc_delete_xprt(xprt);
/* Leave XPT_BUSY set on the dead xprt: */
goto out;
@@ -1020,9 +1022,11 @@ void svc_age_temp_xprts_now(struct svc_serv *serv, struct sockaddr *server_addr)
le = to_be_closed.next;
list_del_init(le);
xprt = list_entry(le, struct svc_xprt, xpt_list);
- dprintk("svc_age_temp_xprts_now: closing %p\n", xprt);
- xprt->xpt_ops->xpo_kill_temp_xprt(xprt);
- svc_close_xprt(xprt);
+ set_bit(XPT_CLOSE, &xprt->xpt_flags);
+ set_bit(XPT_KILL_TEMP, &xprt->xpt_flags);
+ dprintk("svc_age_temp_xprts_now: queuing xprt %p for closing\n",
+ xprt);
+ svc_xprt_enqueue(xprt);
}
}
EXPORT_SYMBOL_GPL(svc_age_temp_xprts_now);
--
2.7.4


2017-01-05 21:35:11

by Scott Mayhew

[permalink] [raw]
Subject: [PATCH 2/3] lockd: initialize sin6_scope_id in lockd_inet6addr_event()

I noticed this was missing when I was testing with link local addresses.

Signed-off-by: Scott Mayhew <[email protected]>
---
fs/lockd/svc.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
index 1c13dd8..7e4ea3b 100644
--- a/fs/lockd/svc.c
+++ b/fs/lockd/svc.c
@@ -322,6 +322,8 @@ static int lockd_inet6addr_event(struct notifier_block *this,
dprintk("lockd_inet6addr_event: removed %pI6\n", &ifa->addr);
sin6.sin6_family = AF_INET6;
sin6.sin6_addr = ifa->addr;
+ if (ipv6_addr_type(&sin6.sin6_addr) & IPV6_ADDR_LINKLOCAL)
+ sin6.sin6_scope_id = ifa->idev->dev->ifindex;
svc_age_temp_xprts_now(nlmsvc_rqst->rq_server,
(struct sockaddr *)&sin6);
}
--
2.7.4


2017-01-05 21:35:11

by Scott Mayhew

[permalink] [raw]
Subject: [PATCH 1/3] nfsd: initialize sin6_scope_id in nfsd_inet6addr_event()

I noticed this was missing when I was testing with link local addresses.

Signed-off-by: Scott Mayhew <[email protected]>
---
fs/nfsd/nfssvc.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index e6bfd96..2e378d0 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -354,6 +354,8 @@ static int nfsd_inet6addr_event(struct notifier_block *this,
dprintk("nfsd_inet6addr_event: removed %pI6\n", &ifa->addr);
sin6.sin6_family = AF_INET6;
sin6.sin6_addr = ifa->addr;
+ if (ipv6_addr_type(&sin6.sin6_addr) & IPV6_ADDR_LINKLOCAL)
+ sin6.sin6_scope_id = ifa->idev->dev->ifindex;
svc_age_temp_xprts_now(nn->nfsd_serv, (struct sockaddr *)&sin6);
}

--
2.7.4


2017-01-06 21:46:55

by J. Bruce Fields

[permalink] [raw]
Subject: Re: [PATCH 0/3] nfsd/lockd notifier block fixes

Thanks. I'm assuming the third at least should also get a stable cc
with Fixes: c3d4879e01be.

What about the first two? I'm not clear what the actual consequences
are. If it's that some local listeners might not get shut down, that
sounds like a lower priority.

--b.

On Thu, Jan 05, 2017 at 04:34:48PM -0500, Scott Mayhew wrote:
> These patches fix some issues with the notifier blocks used by nfsd and
> lockd. The first two patches initialize the scope id for link local
> addresses (this is needed because rpc_cmp_addr6 looks at it when
> comparing link local addresses). The third patch fixes the illegal
> context switch warnings such as the following:
>
>
> Jan 04 16:27:20 fedora25 kernel: ===============================
> Jan 04 16:27:20 fedora25 kernel: [ INFO: suspicious RCU usage. ]
> Jan 04 16:27:20 fedora25 kernel: 4.10.0-rc2+ #9 Not tainted
> Jan 04 16:27:20 fedora25 kernel: -------------------------------
> Jan 04 16:27:20 fedora25 kernel: ./include/linux/rcupdate.h:557 Illegal context switch in RCU read-side critical section!
> Jan 04 16:27:20 fedora25 kernel:
> other info that might help us debug this:
> Jan 04 16:27:20 fedora25 kernel:
> rcu_scheduler_active = 1, debug_locks = 1
> Jan 04 16:27:20 fedora25 kernel: 2 locks held by ip/1281:
> Jan 04 16:27:20 fedora25 kernel: #0: (rtnl_mutex){+.+.+.}, at: [<ffffffff977abd6b>] rtnetlink_rcv+0x1b/0x40
> Jan 04 16:27:20 fedora25 kernel: #1: (rcu_read_lock){......}, at: [<ffffffff970d76c5>] atomic_notifier_call_chain+0x5/0x100
> Jan 04 16:27:20 fedora25 kernel:
> stack backtrace:
> Jan 04 16:27:20 fedora25 kernel: CPU: 3 PID: 1281 Comm: ip Not tainted 4.10.0-rc2+ #9
> Jan 04 16:27:20 fedora25 kernel: Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.9.1-1.fc24 04/01/2014
> Jan 04 16:27:20 fedora25 kernel: Call Trace:
> Jan 04 16:27:20 fedora25 kernel: dump_stack+0x86/0xc3
> Jan 04 16:27:20 fedora25 kernel: lockdep_rcu_suspicious+0xc5/0x100
> Jan 04 16:27:20 fedora25 kernel: __schedule+0x4a8/0xab0
> Jan 04 16:27:20 fedora25 kernel: ? irq_work_queue+0x8d/0xa0
> Jan 04 16:27:20 fedora25 kernel: _cond_resched+0x2b/0x40
> Jan 04 16:27:20 fedora25 kernel: lock_sock_nested+0x24/0xa0
> Jan 04 16:27:20 fedora25 kernel: sock_setsockopt+0x8b/0xac0
> Jan 04 16:27:20 fedora25 kernel: ? __local_bh_enable_ip+0x70/0xc0
> Jan 04 16:27:20 fedora25 kernel: kernel_setsockopt+0x49/0x50
> Jan 04 16:27:20 fedora25 kernel: svc_tcp_kill_temp_xprt+0x4a/0x60 [sunrpc]
> Jan 04 16:27:20 fedora25 kernel: svc_age_temp_xprts_now+0x186/0x210 [sunrpc]
> Jan 04 16:27:20 fedora25 kernel: nfsd_inet6addr_event+0x1a5/0x200 [nfsd]
> Jan 04 16:27:20 fedora25 kernel: ? nfsd_inet6addr_event+0x5/0x200 [nfsd]
> Jan 04 16:27:20 fedora25 kernel: notifier_call_chain+0x4a/0x70
> Jan 04 16:27:20 fedora25 kernel: atomic_notifier_call_chain+0x67/0x100
> Jan 04 16:27:20 fedora25 kernel: ? atomic_notifier_call_chain+0x5/0x100
> Jan 04 16:27:20 fedora25 kernel: inet6addr_notifier_call_chain+0x1b/0x20
> Jan 04 16:27:20 fedora25 kernel: ipv6_del_addr+0x145/0x250
> Jan 04 16:27:20 fedora25 kernel: inet6_addr_del+0xf1/0x1b0
> Jan 04 16:27:20 fedora25 kernel: inet6_rtm_deladdr+0xa9/0xc0
> Jan 04 16:27:20 fedora25 kernel: rtnetlink_rcv_msg+0xe6/0x210
> Jan 04 16:27:20 fedora25 kernel: ? debug_lockdep_rcu_enabled+0x1d/0x20
> Jan 04 16:27:20 fedora25 kernel: ? rtnl_newlink+0x860/0x860
> Jan 04 16:27:20 fedora25 kernel: netlink_rcv_skb+0xa4/0xc0
> Jan 04 16:27:20 fedora25 kernel: rtnetlink_rcv+0x2a/0x40
> Jan 04 16:27:20 fedora25 kernel: netlink_unicast+0x1e5/0x2e0
> Jan 04 16:27:20 fedora25 kernel: ? netlink_unicast+0x16f/0x2e0
> Jan 04 16:27:20 fedora25 kernel: netlink_sendmsg+0x2fe/0x3b0
> Jan 04 16:27:20 fedora25 kernel: sock_sendmsg+0x38/0x50
> Jan 04 16:27:20 fedora25 kernel: ___sys_sendmsg+0x2e0/0x2f0
> Jan 04 16:27:20 fedora25 kernel: ? trace_hardirqs_on_caller+0xf5/0x1b0
> Jan 04 16:27:20 fedora25 kernel: ? _raw_spin_unlock+0x27/0x30
> Jan 04 16:27:20 fedora25 kernel: ? handle_mm_fault+0x6b5/0x15f0
> Jan 04 16:27:20 fedora25 kernel: ? handle_mm_fault+0x4f/0x15f0
> Jan 04 16:27:20 fedora25 kernel: ? debug_lockdep_rcu_enabled+0x1d/0x20
> Jan 04 16:27:20 fedora25 kernel: __sys_sendmsg+0x54/0x90
> Jan 04 16:27:20 fedora25 kernel: SyS_sendmsg+0x12/0x20
> Jan 04 16:27:20 fedora25 kernel: entry_SYSCALL_64_fastpath+0x1f/0xc2
> Jan 04 16:27:20 fedora25 kernel: RIP: 0033:0x7f8fd55e6037
> Jan 04 16:27:20 fedora25 kernel: RSP: 002b:00007ffc7f1a7558 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
> Jan 04 16:27:20 fedora25 kernel: RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f8fd55e6037
> Jan 04 16:27:20 fedora25 kernel: RDX: 0000000000000000 RSI: 00007ffc7f1a75a0 RDI: 0000000000000003
> Jan 04 16:27:20 fedora25 kernel: RBP: 00007ffc7f1a75a0 R08: 0000000000000400 R09: fefefeff77686d74
> Jan 04 16:27:20 fedora25 kernel: R10: 00000000000005eb R11: 0000000000000246 R12: 0000000000000000
> Jan 04 16:27:20 fedora25 kernel: R13: 000000000065d3a0 R14: 00007ffc7f1af6e0 R15: 00007ffc7f1af6e8
>
>
> Scott Mayhew (3):
> nfsd: initialize sin6_scope_id in nfsd_inet6addr_event()
> lockd: initialize sin6_scope_id in lockd_inet6addr_event()
> sunrpc: don't call sleeping functions from the notifier block
> callbacks
>
> fs/lockd/svc.c | 2 ++
> fs/nfsd/nfssvc.c | 2 ++
> include/linux/sunrpc/svc_xprt.h | 1 +
> net/sunrpc/svc_xprt.c | 10 +++++++---
> 4 files changed, 12 insertions(+), 3 deletions(-)
>
> --
> 2.7.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2017-01-10 17:09:41

by Scott Mayhew

[permalink] [raw]
Subject: Re: [PATCH 0/3] nfsd/lockd notifier block fixes

On Fri, 06 Jan 2017, J. Bruce Fields wrote:

> Thanks. I'm assuming the third at least should also get a stable cc
> with Fixes: c3d4879e01be.

Yes. Commit ea08e39230 ("sunrpc: svc_age_temp_xprts_now should not call
setsockopt non-tcp transport") is needed for the third patch to apply
cleanly, and it's in the 4.8 and 4.9 stable branches.

>
> What about the first two? I'm not clear what the actual consequences
> are. If it's that some local listeners might not get shut down, that
> sounds like a lower priority.

Correct, the first two probably don't need to be cc'ed to stable.

-Scott
>
> --b.
>
> On Thu, Jan 05, 2017 at 04:34:48PM -0500, Scott Mayhew wrote:
> > These patches fix some issues with the notifier blocks used by nfsd and
> > lockd. The first two patches initialize the scope id for link local
> > addresses (this is needed because rpc_cmp_addr6 looks at it when
> > comparing link local addresses). The third patch fixes the illegal
> > context switch warnings such as the following:
> >
> >
> > Jan 04 16:27:20 fedora25 kernel: ===============================
> > Jan 04 16:27:20 fedora25 kernel: [ INFO: suspicious RCU usage. ]
> > Jan 04 16:27:20 fedora25 kernel: 4.10.0-rc2+ #9 Not tainted
> > Jan 04 16:27:20 fedora25 kernel: -------------------------------
> > Jan 04 16:27:20 fedora25 kernel: ./include/linux/rcupdate.h:557 Illegal context switch in RCU read-side critical section!
> > Jan 04 16:27:20 fedora25 kernel:
> > other info that might help us debug this:
> > Jan 04 16:27:20 fedora25 kernel:
> > rcu_scheduler_active = 1, debug_locks = 1
> > Jan 04 16:27:20 fedora25 kernel: 2 locks held by ip/1281:
> > Jan 04 16:27:20 fedora25 kernel: #0: (rtnl_mutex){+.+.+.}, at: [<ffffffff977abd6b>] rtnetlink_rcv+0x1b/0x40
> > Jan 04 16:27:20 fedora25 kernel: #1: (rcu_read_lock){......}, at: [<ffffffff970d76c5>] atomic_notifier_call_chain+0x5/0x100
> > Jan 04 16:27:20 fedora25 kernel:
> > stack backtrace:
> > Jan 04 16:27:20 fedora25 kernel: CPU: 3 PID: 1281 Comm: ip Not tainted 4.10.0-rc2+ #9
> > Jan 04 16:27:20 fedora25 kernel: Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.9.1-1.fc24 04/01/2014
> > Jan 04 16:27:20 fedora25 kernel: Call Trace:
> > Jan 04 16:27:20 fedora25 kernel: dump_stack+0x86/0xc3
> > Jan 04 16:27:20 fedora25 kernel: lockdep_rcu_suspicious+0xc5/0x100
> > Jan 04 16:27:20 fedora25 kernel: __schedule+0x4a8/0xab0
> > Jan 04 16:27:20 fedora25 kernel: ? irq_work_queue+0x8d/0xa0
> > Jan 04 16:27:20 fedora25 kernel: _cond_resched+0x2b/0x40
> > Jan 04 16:27:20 fedora25 kernel: lock_sock_nested+0x24/0xa0
> > Jan 04 16:27:20 fedora25 kernel: sock_setsockopt+0x8b/0xac0
> > Jan 04 16:27:20 fedora25 kernel: ? __local_bh_enable_ip+0x70/0xc0
> > Jan 04 16:27:20 fedora25 kernel: kernel_setsockopt+0x49/0x50
> > Jan 04 16:27:20 fedora25 kernel: svc_tcp_kill_temp_xprt+0x4a/0x60 [sunrpc]
> > Jan 04 16:27:20 fedora25 kernel: svc_age_temp_xprts_now+0x186/0x210 [sunrpc]
> > Jan 04 16:27:20 fedora25 kernel: nfsd_inet6addr_event+0x1a5/0x200 [nfsd]
> > Jan 04 16:27:20 fedora25 kernel: ? nfsd_inet6addr_event+0x5/0x200 [nfsd]
> > Jan 04 16:27:20 fedora25 kernel: notifier_call_chain+0x4a/0x70
> > Jan 04 16:27:20 fedora25 kernel: atomic_notifier_call_chain+0x67/0x100
> > Jan 04 16:27:20 fedora25 kernel: ? atomic_notifier_call_chain+0x5/0x100
> > Jan 04 16:27:20 fedora25 kernel: inet6addr_notifier_call_chain+0x1b/0x20
> > Jan 04 16:27:20 fedora25 kernel: ipv6_del_addr+0x145/0x250
> > Jan 04 16:27:20 fedora25 kernel: inet6_addr_del+0xf1/0x1b0
> > Jan 04 16:27:20 fedora25 kernel: inet6_rtm_deladdr+0xa9/0xc0
> > Jan 04 16:27:20 fedora25 kernel: rtnetlink_rcv_msg+0xe6/0x210
> > Jan 04 16:27:20 fedora25 kernel: ? debug_lockdep_rcu_enabled+0x1d/0x20
> > Jan 04 16:27:20 fedora25 kernel: ? rtnl_newlink+0x860/0x860
> > Jan 04 16:27:20 fedora25 kernel: netlink_rcv_skb+0xa4/0xc0
> > Jan 04 16:27:20 fedora25 kernel: rtnetlink_rcv+0x2a/0x40
> > Jan 04 16:27:20 fedora25 kernel: netlink_unicast+0x1e5/0x2e0
> > Jan 04 16:27:20 fedora25 kernel: ? netlink_unicast+0x16f/0x2e0
> > Jan 04 16:27:20 fedora25 kernel: netlink_sendmsg+0x2fe/0x3b0
> > Jan 04 16:27:20 fedora25 kernel: sock_sendmsg+0x38/0x50
> > Jan 04 16:27:20 fedora25 kernel: ___sys_sendmsg+0x2e0/0x2f0
> > Jan 04 16:27:20 fedora25 kernel: ? trace_hardirqs_on_caller+0xf5/0x1b0
> > Jan 04 16:27:20 fedora25 kernel: ? _raw_spin_unlock+0x27/0x30
> > Jan 04 16:27:20 fedora25 kernel: ? handle_mm_fault+0x6b5/0x15f0
> > Jan 04 16:27:20 fedora25 kernel: ? handle_mm_fault+0x4f/0x15f0
> > Jan 04 16:27:20 fedora25 kernel: ? debug_lockdep_rcu_enabled+0x1d/0x20
> > Jan 04 16:27:20 fedora25 kernel: __sys_sendmsg+0x54/0x90
> > Jan 04 16:27:20 fedora25 kernel: SyS_sendmsg+0x12/0x20
> > Jan 04 16:27:20 fedora25 kernel: entry_SYSCALL_64_fastpath+0x1f/0xc2
> > Jan 04 16:27:20 fedora25 kernel: RIP: 0033:0x7f8fd55e6037
> > Jan 04 16:27:20 fedora25 kernel: RSP: 002b:00007ffc7f1a7558 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
> > Jan 04 16:27:20 fedora25 kernel: RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f8fd55e6037
> > Jan 04 16:27:20 fedora25 kernel: RDX: 0000000000000000 RSI: 00007ffc7f1a75a0 RDI: 0000000000000003
> > Jan 04 16:27:20 fedora25 kernel: RBP: 00007ffc7f1a75a0 R08: 0000000000000400 R09: fefefeff77686d74
> > Jan 04 16:27:20 fedora25 kernel: R10: 00000000000005eb R11: 0000000000000246 R12: 0000000000000000
> > Jan 04 16:27:20 fedora25 kernel: R13: 000000000065d3a0 R14: 00007ffc7f1af6e0 R15: 00007ffc7f1af6e8
> >
> >
> > Scott Mayhew (3):
> > nfsd: initialize sin6_scope_id in nfsd_inet6addr_event()
> > lockd: initialize sin6_scope_id in lockd_inet6addr_event()
> > sunrpc: don't call sleeping functions from the notifier block
> > callbacks
> >
> > fs/lockd/svc.c | 2 ++
> > fs/nfsd/nfssvc.c | 2 ++
> > include/linux/sunrpc/svc_xprt.h | 1 +
> > net/sunrpc/svc_xprt.c | 10 +++++++---
> > 4 files changed, 12 insertions(+), 3 deletions(-)
> >
> > --
> > 2.7.4
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> > the body of a message to [email protected]
> > More majordomo info at http://vger.kernel.org/majordomo-info.html

2017-01-12 21:16:11

by J. Bruce Fields

[permalink] [raw]
Subject: Re: [PATCH 0/3] nfsd/lockd notifier block fixes

On Tue, Jan 10, 2017 at 12:09:40PM -0500, Scott Mayhew wrote:
> On Fri, 06 Jan 2017, J. Bruce Fields wrote:
>
> > Thanks. I'm assuming the third at least should also get a stable cc
> > with Fixes: c3d4879e01be.
>
> Yes. Commit ea08e39230 ("sunrpc: svc_age_temp_xprts_now should not call
> setsockopt non-tcp transport") is needed for the third patch to apply
> cleanly, and it's in the 4.8 and 4.9 stable branches.
>
> >
> > What about the first two? I'm not clear what the actual consequences
> > are. If it's that some local listeners might not get shut down, that
> > sounds like a lower priority.
>
> Correct, the first two probably don't need to be cc'ed to stable.

OK, thanks, applying.

--b.

>
> -Scott
> >
> > --b.
> >
> > On Thu, Jan 05, 2017 at 04:34:48PM -0500, Scott Mayhew wrote:
> > > These patches fix some issues with the notifier blocks used by nfsd and
> > > lockd. The first two patches initialize the scope id for link local
> > > addresses (this is needed because rpc_cmp_addr6 looks at it when
> > > comparing link local addresses). The third patch fixes the illegal
> > > context switch warnings such as the following:
> > >
> > >
> > > Jan 04 16:27:20 fedora25 kernel: ===============================
> > > Jan 04 16:27:20 fedora25 kernel: [ INFO: suspicious RCU usage. ]
> > > Jan 04 16:27:20 fedora25 kernel: 4.10.0-rc2+ #9 Not tainted
> > > Jan 04 16:27:20 fedora25 kernel: -------------------------------
> > > Jan 04 16:27:20 fedora25 kernel: ./include/linux/rcupdate.h:557 Illegal context switch in RCU read-side critical section!
> > > Jan 04 16:27:20 fedora25 kernel:
> > > other info that might help us debug this:
> > > Jan 04 16:27:20 fedora25 kernel:
> > > rcu_scheduler_active = 1, debug_locks = 1
> > > Jan 04 16:27:20 fedora25 kernel: 2 locks held by ip/1281:
> > > Jan 04 16:27:20 fedora25 kernel: #0: (rtnl_mutex){+.+.+.}, at: [<ffffffff977abd6b>] rtnetlink_rcv+0x1b/0x40
> > > Jan 04 16:27:20 fedora25 kernel: #1: (rcu_read_lock){......}, at: [<ffffffff970d76c5>] atomic_notifier_call_chain+0x5/0x100
> > > Jan 04 16:27:20 fedora25 kernel:
> > > stack backtrace:
> > > Jan 04 16:27:20 fedora25 kernel: CPU: 3 PID: 1281 Comm: ip Not tainted 4.10.0-rc2+ #9
> > > Jan 04 16:27:20 fedora25 kernel: Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.9.1-1.fc24 04/01/2014
> > > Jan 04 16:27:20 fedora25 kernel: Call Trace:
> > > Jan 04 16:27:20 fedora25 kernel: dump_stack+0x86/0xc3
> > > Jan 04 16:27:20 fedora25 kernel: lockdep_rcu_suspicious+0xc5/0x100
> > > Jan 04 16:27:20 fedora25 kernel: __schedule+0x4a8/0xab0
> > > Jan 04 16:27:20 fedora25 kernel: ? irq_work_queue+0x8d/0xa0
> > > Jan 04 16:27:20 fedora25 kernel: _cond_resched+0x2b/0x40
> > > Jan 04 16:27:20 fedora25 kernel: lock_sock_nested+0x24/0xa0
> > > Jan 04 16:27:20 fedora25 kernel: sock_setsockopt+0x8b/0xac0
> > > Jan 04 16:27:20 fedora25 kernel: ? __local_bh_enable_ip+0x70/0xc0
> > > Jan 04 16:27:20 fedora25 kernel: kernel_setsockopt+0x49/0x50
> > > Jan 04 16:27:20 fedora25 kernel: svc_tcp_kill_temp_xprt+0x4a/0x60 [sunrpc]
> > > Jan 04 16:27:20 fedora25 kernel: svc_age_temp_xprts_now+0x186/0x210 [sunrpc]
> > > Jan 04 16:27:20 fedora25 kernel: nfsd_inet6addr_event+0x1a5/0x200 [nfsd]
> > > Jan 04 16:27:20 fedora25 kernel: ? nfsd_inet6addr_event+0x5/0x200 [nfsd]
> > > Jan 04 16:27:20 fedora25 kernel: notifier_call_chain+0x4a/0x70
> > > Jan 04 16:27:20 fedora25 kernel: atomic_notifier_call_chain+0x67/0x100
> > > Jan 04 16:27:20 fedora25 kernel: ? atomic_notifier_call_chain+0x5/0x100
> > > Jan 04 16:27:20 fedora25 kernel: inet6addr_notifier_call_chain+0x1b/0x20
> > > Jan 04 16:27:20 fedora25 kernel: ipv6_del_addr+0x145/0x250
> > > Jan 04 16:27:20 fedora25 kernel: inet6_addr_del+0xf1/0x1b0
> > > Jan 04 16:27:20 fedora25 kernel: inet6_rtm_deladdr+0xa9/0xc0
> > > Jan 04 16:27:20 fedora25 kernel: rtnetlink_rcv_msg+0xe6/0x210
> > > Jan 04 16:27:20 fedora25 kernel: ? debug_lockdep_rcu_enabled+0x1d/0x20
> > > Jan 04 16:27:20 fedora25 kernel: ? rtnl_newlink+0x860/0x860
> > > Jan 04 16:27:20 fedora25 kernel: netlink_rcv_skb+0xa4/0xc0
> > > Jan 04 16:27:20 fedora25 kernel: rtnetlink_rcv+0x2a/0x40
> > > Jan 04 16:27:20 fedora25 kernel: netlink_unicast+0x1e5/0x2e0
> > > Jan 04 16:27:20 fedora25 kernel: ? netlink_unicast+0x16f/0x2e0
> > > Jan 04 16:27:20 fedora25 kernel: netlink_sendmsg+0x2fe/0x3b0
> > > Jan 04 16:27:20 fedora25 kernel: sock_sendmsg+0x38/0x50
> > > Jan 04 16:27:20 fedora25 kernel: ___sys_sendmsg+0x2e0/0x2f0
> > > Jan 04 16:27:20 fedora25 kernel: ? trace_hardirqs_on_caller+0xf5/0x1b0
> > > Jan 04 16:27:20 fedora25 kernel: ? _raw_spin_unlock+0x27/0x30
> > > Jan 04 16:27:20 fedora25 kernel: ? handle_mm_fault+0x6b5/0x15f0
> > > Jan 04 16:27:20 fedora25 kernel: ? handle_mm_fault+0x4f/0x15f0
> > > Jan 04 16:27:20 fedora25 kernel: ? debug_lockdep_rcu_enabled+0x1d/0x20
> > > Jan 04 16:27:20 fedora25 kernel: __sys_sendmsg+0x54/0x90
> > > Jan 04 16:27:20 fedora25 kernel: SyS_sendmsg+0x12/0x20
> > > Jan 04 16:27:20 fedora25 kernel: entry_SYSCALL_64_fastpath+0x1f/0xc2
> > > Jan 04 16:27:20 fedora25 kernel: RIP: 0033:0x7f8fd55e6037
> > > Jan 04 16:27:20 fedora25 kernel: RSP: 002b:00007ffc7f1a7558 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
> > > Jan 04 16:27:20 fedora25 kernel: RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f8fd55e6037
> > > Jan 04 16:27:20 fedora25 kernel: RDX: 0000000000000000 RSI: 00007ffc7f1a75a0 RDI: 0000000000000003
> > > Jan 04 16:27:20 fedora25 kernel: RBP: 00007ffc7f1a75a0 R08: 0000000000000400 R09: fefefeff77686d74
> > > Jan 04 16:27:20 fedora25 kernel: R10: 00000000000005eb R11: 0000000000000246 R12: 0000000000000000
> > > Jan 04 16:27:20 fedora25 kernel: R13: 000000000065d3a0 R14: 00007ffc7f1af6e0 R15: 00007ffc7f1af6e8
> > >
> > >
> > > Scott Mayhew (3):
> > > nfsd: initialize sin6_scope_id in nfsd_inet6addr_event()
> > > lockd: initialize sin6_scope_id in lockd_inet6addr_event()
> > > sunrpc: don't call sleeping functions from the notifier block
> > > callbacks
> > >
> > > fs/lockd/svc.c | 2 ++
> > > fs/nfsd/nfssvc.c | 2 ++
> > > include/linux/sunrpc/svc_xprt.h | 1 +
> > > net/sunrpc/svc_xprt.c | 10 +++++++---
> > > 4 files changed, 12 insertions(+), 3 deletions(-)
> > >
> > > --
> > > 2.7.4
> > >
> > > --
> > > To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> > > the body of a message to [email protected]
> > > More majordomo info at http://vger.kernel.org/majordomo-info.html