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