mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-12-22 18:47:06 +01:00
nfsd: unregister with rpcbind when deleting a transport
[ Upstream commit898374fdd7] When a listener is added, a part of creation of transport also registers program/port with rpcbind. However, when the listener is removed, while transport goes away, rpcbind still has the entry for that port/type. When deleting the transport, unregister with rpcbind when appropriate. ---v2 created a new xpt_flag XPT_RPCB_UNREG to mark TCP and UDP transport and at xprt destroy send rpcbind unregister if flag set. Suggested-by: Chuck Lever <chuck.lever@oracle.com> Fixes:d093c90892("nfsd: fix management of listener transports") Cc: stable@vger.kernel.org Signed-off-by: Olga Kornievskaia <okorniev@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
0a1ee3c932
commit
efbc2d6a92
|
|
@ -103,6 +103,9 @@ enum {
|
|||
* it has access to. It is NOT counted
|
||||
* in ->sv_tmpcnt.
|
||||
*/
|
||||
XPT_RPCB_UNREG, /* transport that needs unregistering
|
||||
* with rpcbind (TCP, UDP) on destroy
|
||||
*/
|
||||
};
|
||||
|
||||
static inline void svc_xprt_set_valid(struct svc_xprt *xpt)
|
||||
|
|
|
|||
|
|
@ -1028,6 +1028,19 @@ static void svc_delete_xprt(struct svc_xprt *xprt)
|
|||
struct svc_serv *serv = xprt->xpt_server;
|
||||
struct svc_deferred_req *dr;
|
||||
|
||||
/* unregister with rpcbind for when transport type is TCP or UDP.
|
||||
*/
|
||||
if (test_bit(XPT_RPCB_UNREG, &xprt->xpt_flags)) {
|
||||
struct svc_sock *svsk = container_of(xprt, struct svc_sock,
|
||||
sk_xprt);
|
||||
struct socket *sock = svsk->sk_sock;
|
||||
|
||||
if (svc_register(serv, xprt->xpt_net, sock->sk->sk_family,
|
||||
sock->sk->sk_protocol, 0) < 0)
|
||||
pr_warn("failed to unregister %s with rpcbind\n",
|
||||
xprt->xpt_class->xcl_name);
|
||||
}
|
||||
|
||||
if (test_and_set_bit(XPT_DEAD, &xprt->xpt_flags))
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -837,6 +837,7 @@ static void svc_udp_init(struct svc_sock *svsk, struct svc_serv *serv)
|
|||
/* data might have come in before data_ready set up */
|
||||
set_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags);
|
||||
set_bit(XPT_CHNGBUF, &svsk->sk_xprt.xpt_flags);
|
||||
set_bit(XPT_RPCB_UNREG, &svsk->sk_xprt.xpt_flags);
|
||||
|
||||
/* make sure we get destination address info */
|
||||
switch (svsk->sk_sk->sk_family) {
|
||||
|
|
@ -1357,6 +1358,7 @@ static void svc_tcp_init(struct svc_sock *svsk, struct svc_serv *serv)
|
|||
if (sk->sk_state == TCP_LISTEN) {
|
||||
strcpy(svsk->sk_xprt.xpt_remotebuf, "listener");
|
||||
set_bit(XPT_LISTENER, &svsk->sk_xprt.xpt_flags);
|
||||
set_bit(XPT_RPCB_UNREG, &svsk->sk_xprt.xpt_flags);
|
||||
sk->sk_data_ready = svc_tcp_listen_data_ready;
|
||||
set_bit(XPT_CONN, &svsk->sk_xprt.xpt_flags);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user