Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'dlm-4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm

Pull dlm fixes from David Teigland:
"This set fixes error reporting for dlm sockets, removes the unbound
property on the dlm callback workqueue to improve performance, and
includes a couple trivial changes"

* tag 'dlm-4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm:
dlm: fix error return code in sctp_accept_from_sock()
dlm: don't specify WQ_UNBOUND for the ast callback workqueue
dlm: remove lock_sock to avoid scheduling while atomic
dlm: don't save callbacks after accept
dlm: audit and remove any unnecessary uses of module.h
dlm: make genl_ops const

+22 -20
+1 -1
fs/dlm/ast.c
··· 268 268 int dlm_callback_start(struct dlm_ls *ls) 269 269 { 270 270 ls->ls_callback_wq = alloc_workqueue("dlm_callback", 271 - WQ_UNBOUND | WQ_MEM_RECLAIM, 0); 271 + WQ_HIGHPRI | WQ_MEM_RECLAIM, 0); 272 272 if (!ls->ls_callback_wq) { 273 273 log_print("can't start dlm_callback workqueue"); 274 274 return -ENOMEM;
+1 -1
fs/dlm/config.c
··· 12 12 ******************************************************************************/ 13 13 14 14 #include <linux/kernel.h> 15 - #include <linux/module.h> 15 + #include <linux/init.h> 16 16 #include <linux/configfs.h> 17 17 #include <linux/slab.h> 18 18 #include <linux/in.h>
+1 -1
fs/dlm/debug_fs.c
··· 12 12 13 13 #include <linux/pagemap.h> 14 14 #include <linux/seq_file.h> 15 - #include <linux/module.h> 15 + #include <linux/init.h> 16 16 #include <linux/ctype.h> 17 17 #include <linux/debugfs.h> 18 18 #include <linux/slab.h>
-1
fs/dlm/dlm_internal.h
··· 18 18 * This is the main header file to be included in each DLM source file. 19 19 */ 20 20 21 - #include <linux/module.h> 22 21 #include <linux/slab.h> 23 22 #include <linux/sched.h> 24 23 #include <linux/types.h>
+2
fs/dlm/lockspace.c
··· 11 11 ******************************************************************************* 12 12 ******************************************************************************/ 13 13 14 + #include <linux/module.h> 15 + 14 16 #include "dlm_internal.h" 15 17 #include "lockspace.h" 16 18 #include "member.h"
+14 -14
fs/dlm/lowcomms.c
··· 519 519 /* Note: sk_callback_lock must be locked before calling this function. */ 520 520 static void save_callbacks(struct connection *con, struct sock *sk) 521 521 { 522 - lock_sock(sk); 523 522 con->orig_data_ready = sk->sk_data_ready; 524 523 con->orig_state_change = sk->sk_state_change; 525 524 con->orig_write_space = sk->sk_write_space; 526 525 con->orig_error_report = sk->sk_error_report; 527 - release_sock(sk); 528 526 } 529 527 530 528 static void restore_callbacks(struct connection *con, struct sock *sk) 531 529 { 532 530 write_lock_bh(&sk->sk_callback_lock); 533 - lock_sock(sk); 534 531 sk->sk_user_data = NULL; 535 532 sk->sk_data_ready = con->orig_data_ready; 536 533 sk->sk_state_change = con->orig_state_change; 537 534 sk->sk_write_space = con->orig_write_space; 538 535 sk->sk_error_report = con->orig_error_report; 539 - release_sock(sk); 540 536 write_unlock_bh(&sk->sk_callback_lock); 541 537 } 542 538 543 539 /* Make a socket active */ 544 - static void add_sock(struct socket *sock, struct connection *con) 540 + static void add_sock(struct socket *sock, struct connection *con, bool save_cb) 545 541 { 546 542 struct sock *sk = sock->sk; 547 543 ··· 545 549 con->sock = sock; 546 550 547 551 sk->sk_user_data = con; 548 - if (!test_bit(CF_IS_OTHERCON, &con->flags)) 552 + if (save_cb) 549 553 save_callbacks(con, sk); 550 554 /* Install a data_ready callback */ 551 555 sk->sk_data_ready = lowcomms_data_ready; ··· 802 806 newcon->othercon = othercon; 803 807 othercon->sock = newsock; 804 808 newsock->sk->sk_user_data = othercon; 805 - add_sock(newsock, othercon); 809 + add_sock(newsock, othercon, false); 806 810 addcon = othercon; 807 811 } 808 812 else { ··· 815 819 else { 816 820 newsock->sk->sk_user_data = newcon; 817 821 newcon->rx_action = receive_from_sock; 818 - add_sock(newsock, newcon); 822 + /* accept copies the sk after we've saved the callbacks, so we 823 + don't want to save them a second time or comm errors will 824 + result in calling sk_error_report recursively. */ 825 + add_sock(newsock, newcon, false); 819 826 addcon = newcon; 820 827 } 821 828 ··· 879 880 } 880 881 881 882 make_sockaddr(&prim.ssp_addr, 0, &addr_len); 882 - if (addr_to_nodeid(&prim.ssp_addr, &nodeid)) { 883 + ret = addr_to_nodeid(&prim.ssp_addr, &nodeid); 884 + if (ret) { 883 885 unsigned char *b = (unsigned char *)&prim.ssp_addr; 884 886 885 887 log_print("reject connect from unknown addr"); ··· 919 919 newcon->othercon = othercon; 920 920 othercon->sock = newsock; 921 921 newsock->sk->sk_user_data = othercon; 922 - add_sock(newsock, othercon); 922 + add_sock(newsock, othercon, false); 923 923 addcon = othercon; 924 924 } else { 925 925 printk("Extra connection from node %d attempted\n", nodeid); ··· 930 930 } else { 931 931 newsock->sk->sk_user_data = newcon; 932 932 newcon->rx_action = receive_from_sock; 933 - add_sock(newsock, newcon); 933 + add_sock(newsock, newcon, false); 934 934 addcon = newcon; 935 935 } 936 936 ··· 1058 1058 sock->sk->sk_user_data = con; 1059 1059 con->rx_action = receive_from_sock; 1060 1060 con->connect_action = sctp_connect_to_sock; 1061 - add_sock(sock, con); 1061 + add_sock(sock, con, true); 1062 1062 1063 1063 /* Bind to all addresses. */ 1064 1064 if (sctp_bind_addrs(con, 0)) ··· 1146 1146 sock->sk->sk_user_data = con; 1147 1147 con->rx_action = receive_from_sock; 1148 1148 con->connect_action = tcp_connect_to_sock; 1149 - add_sock(sock, con); 1149 + add_sock(sock, con, true); 1150 1150 1151 1151 /* Bind to our cluster-known address connecting to avoid 1152 1152 routing problems */ ··· 1366 1366 1367 1367 sock = tcp_create_listen_sock(con, dlm_local_addr[0]); 1368 1368 if (sock) { 1369 - add_sock(sock, con); 1369 + add_sock(sock, con, true); 1370 1370 result = 0; 1371 1371 } 1372 1372 else {
+2
fs/dlm/main.c
··· 11 11 ******************************************************************************* 12 12 ******************************************************************************/ 13 13 14 + #include <linux/module.h> 15 + 14 16 #include "dlm_internal.h" 15 17 #include "lockspace.h" 16 18 #include "lock.h"
+1 -1
fs/dlm/netlink.c
··· 65 65 return 0; 66 66 } 67 67 68 - static struct genl_ops dlm_nl_ops[] = { 68 + static const struct genl_ops dlm_nl_ops[] = { 69 69 { 70 70 .cmd = DLM_CMD_HELLO, 71 71 .doit = user_cmd,
-1
fs/dlm/user.c
··· 9 9 #include <linux/miscdevice.h> 10 10 #include <linux/init.h> 11 11 #include <linux/wait.h> 12 - #include <linux/module.h> 13 12 #include <linux/file.h> 14 13 #include <linux/fs.h> 15 14 #include <linux/poll.h>