Merge tag 'nfsd-4.9-2' of git://linux-nfs.org/~bfields/linux

Pull nfsd bugfix from Bruce Fields:
"Just one fix for an NFS/RDMA crash"

* tag 'nfsd-4.9-2' of git://linux-nfs.org/~bfields/linux:
sunrpc: svc_age_temp_xprts_now should not call setsockopt non-tcp transports

+29 -10
+1
include/linux/sunrpc/svc_xprt.h
··· 25 void (*xpo_detach)(struct svc_xprt *); 26 void (*xpo_free)(struct svc_xprt *); 27 int (*xpo_secure_port)(struct svc_rqst *); 28 }; 29 30 struct svc_xprt_class {
··· 25 void (*xpo_detach)(struct svc_xprt *); 26 void (*xpo_free)(struct svc_xprt *); 27 int (*xpo_secure_port)(struct svc_rqst *); 28 + void (*xpo_kill_temp_xprt)(struct svc_xprt *); 29 }; 30 31 struct svc_xprt_class {
+1 -10
net/sunrpc/svc_xprt.c
··· 1002 void svc_age_temp_xprts_now(struct svc_serv *serv, struct sockaddr *server_addr) 1003 { 1004 struct svc_xprt *xprt; 1005 - struct svc_sock *svsk; 1006 - struct socket *sock; 1007 struct list_head *le, *next; 1008 LIST_HEAD(to_be_closed); 1009 - struct linger no_linger = { 1010 - .l_onoff = 1, 1011 - .l_linger = 0, 1012 - }; 1013 1014 spin_lock_bh(&serv->sv_lock); 1015 list_for_each_safe(le, next, &serv->sv_tempsocks) { ··· 1021 list_del_init(le); 1022 xprt = list_entry(le, struct svc_xprt, xpt_list); 1023 dprintk("svc_age_temp_xprts_now: closing %p\n", xprt); 1024 - svsk = container_of(xprt, struct svc_sock, sk_xprt); 1025 - sock = svsk->sk_sock; 1026 - kernel_setsockopt(sock, SOL_SOCKET, SO_LINGER, 1027 - (char *)&no_linger, sizeof(no_linger)); 1028 svc_close_xprt(xprt); 1029 } 1030 }
··· 1002 void svc_age_temp_xprts_now(struct svc_serv *serv, struct sockaddr *server_addr) 1003 { 1004 struct svc_xprt *xprt; 1005 struct list_head *le, *next; 1006 LIST_HEAD(to_be_closed); 1007 1008 spin_lock_bh(&serv->sv_lock); 1009 list_for_each_safe(le, next, &serv->sv_tempsocks) { ··· 1027 list_del_init(le); 1028 xprt = list_entry(le, struct svc_xprt, xpt_list); 1029 dprintk("svc_age_temp_xprts_now: closing %p\n", xprt); 1030 + xprt->xpt_ops->xpo_kill_temp_xprt(xprt); 1031 svc_close_xprt(xprt); 1032 } 1033 }
+21
net/sunrpc/svcsock.c
··· 438 return !test_bit(SOCK_NOSPACE, &svsk->sk_sock->flags); 439 } 440 441 /* 442 * See net/ipv6/ip_sockglue.c : ip_cmsg_recv_pktinfo 443 */ ··· 663 return NULL; 664 } 665 666 static struct svc_xprt *svc_udp_create(struct svc_serv *serv, 667 struct net *net, 668 struct sockaddr *sa, int salen, ··· 686 .xpo_has_wspace = svc_udp_has_wspace, 687 .xpo_accept = svc_udp_accept, 688 .xpo_secure_port = svc_sock_secure_port, 689 }; 690 691 static struct svc_xprt_class svc_udp_class = { ··· 1262 .xpo_has_wspace = svc_tcp_has_wspace, 1263 .xpo_accept = svc_tcp_accept, 1264 .xpo_secure_port = svc_sock_secure_port, 1265 }; 1266 1267 static struct svc_xprt_class svc_tcp_class = {
··· 438 return !test_bit(SOCK_NOSPACE, &svsk->sk_sock->flags); 439 } 440 441 + static void svc_tcp_kill_temp_xprt(struct svc_xprt *xprt) 442 + { 443 + struct svc_sock *svsk; 444 + struct socket *sock; 445 + struct linger no_linger = { 446 + .l_onoff = 1, 447 + .l_linger = 0, 448 + }; 449 + 450 + svsk = container_of(xprt, struct svc_sock, sk_xprt); 451 + sock = svsk->sk_sock; 452 + kernel_setsockopt(sock, SOL_SOCKET, SO_LINGER, 453 + (char *)&no_linger, sizeof(no_linger)); 454 + } 455 + 456 /* 457 * See net/ipv6/ip_sockglue.c : ip_cmsg_recv_pktinfo 458 */ ··· 648 return NULL; 649 } 650 651 + static void svc_udp_kill_temp_xprt(struct svc_xprt *xprt) 652 + { 653 + } 654 + 655 static struct svc_xprt *svc_udp_create(struct svc_serv *serv, 656 struct net *net, 657 struct sockaddr *sa, int salen, ··· 667 .xpo_has_wspace = svc_udp_has_wspace, 668 .xpo_accept = svc_udp_accept, 669 .xpo_secure_port = svc_sock_secure_port, 670 + .xpo_kill_temp_xprt = svc_udp_kill_temp_xprt, 671 }; 672 673 static struct svc_xprt_class svc_udp_class = { ··· 1242 .xpo_has_wspace = svc_tcp_has_wspace, 1243 .xpo_accept = svc_tcp_accept, 1244 .xpo_secure_port = svc_sock_secure_port, 1245 + .xpo_kill_temp_xprt = svc_tcp_kill_temp_xprt, 1246 }; 1247 1248 static struct svc_xprt_class svc_tcp_class = {
+6
net/sunrpc/xprtrdma/svc_rdma_transport.c
··· 67 static void svc_rdma_free(struct svc_xprt *xprt); 68 static int svc_rdma_has_wspace(struct svc_xprt *xprt); 69 static int svc_rdma_secure_port(struct svc_rqst *); 70 71 static struct svc_xprt_ops svc_rdma_ops = { 72 .xpo_create = svc_rdma_create, ··· 80 .xpo_has_wspace = svc_rdma_has_wspace, 81 .xpo_accept = svc_rdma_accept, 82 .xpo_secure_port = svc_rdma_secure_port, 83 }; 84 85 struct svc_xprt_class svc_rdma_class = { ··· 1317 static int svc_rdma_secure_port(struct svc_rqst *rqstp) 1318 { 1319 return 1; 1320 } 1321 1322 int svc_rdma_send(struct svcxprt_rdma *xprt, struct ib_send_wr *wr)
··· 67 static void svc_rdma_free(struct svc_xprt *xprt); 68 static int svc_rdma_has_wspace(struct svc_xprt *xprt); 69 static int svc_rdma_secure_port(struct svc_rqst *); 70 + static void svc_rdma_kill_temp_xprt(struct svc_xprt *); 71 72 static struct svc_xprt_ops svc_rdma_ops = { 73 .xpo_create = svc_rdma_create, ··· 79 .xpo_has_wspace = svc_rdma_has_wspace, 80 .xpo_accept = svc_rdma_accept, 81 .xpo_secure_port = svc_rdma_secure_port, 82 + .xpo_kill_temp_xprt = svc_rdma_kill_temp_xprt, 83 }; 84 85 struct svc_xprt_class svc_rdma_class = { ··· 1315 static int svc_rdma_secure_port(struct svc_rqst *rqstp) 1316 { 1317 return 1; 1318 + } 1319 + 1320 + static void svc_rdma_kill_temp_xprt(struct svc_xprt *xprt) 1321 + { 1322 } 1323 1324 int svc_rdma_send(struct svcxprt_rdma *xprt, struct ib_send_wr *wr)