diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-12-14 11:31:37 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-12-14 11:31:37 -0500 |
commit | 19d37ce2a7159ee30bd59d14fe5fe13c932bd5b7 (patch) | |
tree | fe92aedc62b5283b2473cd1506ef760285d94f7a | |
parent | 3e5cecf26842ecfde8ea487c02cb12709cd90ef5 (diff) | |
parent | 26c1ec2fe410ba861f15ebbfc9f44f907a41b6ff (diff) |
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
-rw-r--r-- | fs/dlm/ast.c | 2 | ||||
-rw-r--r-- | fs/dlm/config.c | 2 | ||||
-rw-r--r-- | fs/dlm/debug_fs.c | 2 | ||||
-rw-r--r-- | fs/dlm/dlm_internal.h | 1 | ||||
-rw-r--r-- | fs/dlm/lockspace.c | 2 | ||||
-rw-r--r-- | fs/dlm/lowcomms.c | 28 | ||||
-rw-r--r-- | fs/dlm/main.c | 2 | ||||
-rw-r--r-- | fs/dlm/netlink.c | 2 | ||||
-rw-r--r-- | fs/dlm/user.c | 1 |
9 files changed, 22 insertions, 20 deletions
diff --git a/fs/dlm/ast.c b/fs/dlm/ast.c index dcea1e37a1b7..07fed838d8fd 100644 --- a/fs/dlm/ast.c +++ b/fs/dlm/ast.c | |||
@@ -268,7 +268,7 @@ void dlm_callback_work(struct work_struct *work) | |||
268 | int dlm_callback_start(struct dlm_ls *ls) | 268 | int dlm_callback_start(struct dlm_ls *ls) |
269 | { | 269 | { |
270 | ls->ls_callback_wq = alloc_workqueue("dlm_callback", | 270 | ls->ls_callback_wq = alloc_workqueue("dlm_callback", |
271 | WQ_UNBOUND | WQ_MEM_RECLAIM, 0); | 271 | WQ_HIGHPRI | WQ_MEM_RECLAIM, 0); |
272 | if (!ls->ls_callback_wq) { | 272 | if (!ls->ls_callback_wq) { |
273 | log_print("can't start dlm_callback workqueue"); | 273 | log_print("can't start dlm_callback workqueue"); |
274 | return -ENOMEM; | 274 | return -ENOMEM; |
diff --git a/fs/dlm/config.c b/fs/dlm/config.c index df955d2209ce..7211e826d90d 100644 --- a/fs/dlm/config.c +++ b/fs/dlm/config.c | |||
@@ -12,7 +12,7 @@ | |||
12 | ******************************************************************************/ | 12 | ******************************************************************************/ |
13 | 13 | ||
14 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
15 | #include <linux/module.h> | 15 | #include <linux/init.h> |
16 | #include <linux/configfs.h> | 16 | #include <linux/configfs.h> |
17 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
18 | #include <linux/in.h> | 18 | #include <linux/in.h> |
diff --git a/fs/dlm/debug_fs.c b/fs/dlm/debug_fs.c index 466f7d60edc2..ca7089aeadab 100644 --- a/fs/dlm/debug_fs.c +++ b/fs/dlm/debug_fs.c | |||
@@ -12,7 +12,7 @@ | |||
12 | 12 | ||
13 | #include <linux/pagemap.h> | 13 | #include <linux/pagemap.h> |
14 | #include <linux/seq_file.h> | 14 | #include <linux/seq_file.h> |
15 | #include <linux/module.h> | 15 | #include <linux/init.h> |
16 | #include <linux/ctype.h> | 16 | #include <linux/ctype.h> |
17 | #include <linux/debugfs.h> | 17 | #include <linux/debugfs.h> |
18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
diff --git a/fs/dlm/dlm_internal.h b/fs/dlm/dlm_internal.h index 216b61604ef9..b670f5601fbb 100644 --- a/fs/dlm/dlm_internal.h +++ b/fs/dlm/dlm_internal.h | |||
@@ -18,7 +18,6 @@ | |||
18 | * This is the main header file to be included in each DLM source file. | 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 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
23 | #include <linux/sched.h> | 22 | #include <linux/sched.h> |
24 | #include <linux/types.h> | 23 | #include <linux/types.h> |
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c index f3e72787e7f9..91592b75c309 100644 --- a/fs/dlm/lockspace.c +++ b/fs/dlm/lockspace.c | |||
@@ -11,6 +11,8 @@ | |||
11 | ******************************************************************************* | 11 | ******************************************************************************* |
12 | ******************************************************************************/ | 12 | ******************************************************************************/ |
13 | 13 | ||
14 | #include <linux/module.h> | ||
15 | |||
14 | #include "dlm_internal.h" | 16 | #include "dlm_internal.h" |
15 | #include "lockspace.h" | 17 | #include "lockspace.h" |
16 | #include "member.h" | 18 | #include "member.h" |
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index 609998de533e..7d398d300e97 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c | |||
@@ -519,29 +519,25 @@ out: | |||
519 | /* Note: sk_callback_lock must be locked before calling this function. */ | 519 | /* Note: sk_callback_lock must be locked before calling this function. */ |
520 | static void save_callbacks(struct connection *con, struct sock *sk) | 520 | static void save_callbacks(struct connection *con, struct sock *sk) |
521 | { | 521 | { |
522 | lock_sock(sk); | ||
523 | con->orig_data_ready = sk->sk_data_ready; | 522 | con->orig_data_ready = sk->sk_data_ready; |
524 | con->orig_state_change = sk->sk_state_change; | 523 | con->orig_state_change = sk->sk_state_change; |
525 | con->orig_write_space = sk->sk_write_space; | 524 | con->orig_write_space = sk->sk_write_space; |
526 | con->orig_error_report = sk->sk_error_report; | 525 | con->orig_error_report = sk->sk_error_report; |
527 | release_sock(sk); | ||
528 | } | 526 | } |
529 | 527 | ||
530 | static void restore_callbacks(struct connection *con, struct sock *sk) | 528 | static void restore_callbacks(struct connection *con, struct sock *sk) |
531 | { | 529 | { |
532 | write_lock_bh(&sk->sk_callback_lock); | 530 | write_lock_bh(&sk->sk_callback_lock); |
533 | lock_sock(sk); | ||
534 | sk->sk_user_data = NULL; | 531 | sk->sk_user_data = NULL; |
535 | sk->sk_data_ready = con->orig_data_ready; | 532 | sk->sk_data_ready = con->orig_data_ready; |
536 | sk->sk_state_change = con->orig_state_change; | 533 | sk->sk_state_change = con->orig_state_change; |
537 | sk->sk_write_space = con->orig_write_space; | 534 | sk->sk_write_space = con->orig_write_space; |
538 | sk->sk_error_report = con->orig_error_report; | 535 | sk->sk_error_report = con->orig_error_report; |
539 | release_sock(sk); | ||
540 | write_unlock_bh(&sk->sk_callback_lock); | 536 | write_unlock_bh(&sk->sk_callback_lock); |
541 | } | 537 | } |
542 | 538 | ||
543 | /* Make a socket active */ | 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 | struct sock *sk = sock->sk; | 542 | struct sock *sk = sock->sk; |
547 | 543 | ||
@@ -549,7 +545,7 @@ static void add_sock(struct socket *sock, struct connection *con) | |||
549 | con->sock = sock; | 545 | con->sock = sock; |
550 | 546 | ||
551 | sk->sk_user_data = con; | 547 | sk->sk_user_data = con; |
552 | if (!test_bit(CF_IS_OTHERCON, &con->flags)) | 548 | if (save_cb) |
553 | save_callbacks(con, sk); | 549 | save_callbacks(con, sk); |
554 | /* Install a data_ready callback */ | 550 | /* Install a data_ready callback */ |
555 | sk->sk_data_ready = lowcomms_data_ready; | 551 | sk->sk_data_ready = lowcomms_data_ready; |
@@ -806,7 +802,7 @@ static int tcp_accept_from_sock(struct connection *con) | |||
806 | newcon->othercon = othercon; | 802 | newcon->othercon = othercon; |
807 | othercon->sock = newsock; | 803 | othercon->sock = newsock; |
808 | newsock->sk->sk_user_data = othercon; | 804 | newsock->sk->sk_user_data = othercon; |
809 | add_sock(newsock, othercon); | 805 | add_sock(newsock, othercon, false); |
810 | addcon = othercon; | 806 | addcon = othercon; |
811 | } | 807 | } |
812 | else { | 808 | else { |
@@ -819,7 +815,10 @@ static int tcp_accept_from_sock(struct connection *con) | |||
819 | else { | 815 | else { |
820 | newsock->sk->sk_user_data = newcon; | 816 | newsock->sk->sk_user_data = newcon; |
821 | newcon->rx_action = receive_from_sock; | 817 | newcon->rx_action = receive_from_sock; |
822 | add_sock(newsock, newcon); | 818 | /* accept copies the sk after we've saved the callbacks, so we |
819 | don't want to save them a second time or comm errors will | ||
820 | result in calling sk_error_report recursively. */ | ||
821 | add_sock(newsock, newcon, false); | ||
823 | addcon = newcon; | 822 | addcon = newcon; |
824 | } | 823 | } |
825 | 824 | ||
@@ -880,7 +879,8 @@ static int sctp_accept_from_sock(struct connection *con) | |||
880 | } | 879 | } |
881 | 880 | ||
882 | make_sockaddr(&prim.ssp_addr, 0, &addr_len); | 881 | make_sockaddr(&prim.ssp_addr, 0, &addr_len); |
883 | if (addr_to_nodeid(&prim.ssp_addr, &nodeid)) { | 882 | ret = addr_to_nodeid(&prim.ssp_addr, &nodeid); |
883 | if (ret) { | ||
884 | unsigned char *b = (unsigned char *)&prim.ssp_addr; | 884 | unsigned char *b = (unsigned char *)&prim.ssp_addr; |
885 | 885 | ||
886 | log_print("reject connect from unknown addr"); | 886 | log_print("reject connect from unknown addr"); |
@@ -919,7 +919,7 @@ static int sctp_accept_from_sock(struct connection *con) | |||
919 | newcon->othercon = othercon; | 919 | newcon->othercon = othercon; |
920 | othercon->sock = newsock; | 920 | othercon->sock = newsock; |
921 | newsock->sk->sk_user_data = othercon; | 921 | newsock->sk->sk_user_data = othercon; |
922 | add_sock(newsock, othercon); | 922 | add_sock(newsock, othercon, false); |
923 | addcon = othercon; | 923 | addcon = othercon; |
924 | } else { | 924 | } else { |
925 | printk("Extra connection from node %d attempted\n", nodeid); | 925 | printk("Extra connection from node %d attempted\n", nodeid); |
@@ -930,7 +930,7 @@ static int sctp_accept_from_sock(struct connection *con) | |||
930 | } else { | 930 | } else { |
931 | newsock->sk->sk_user_data = newcon; | 931 | newsock->sk->sk_user_data = newcon; |
932 | newcon->rx_action = receive_from_sock; | 932 | newcon->rx_action = receive_from_sock; |
933 | add_sock(newsock, newcon); | 933 | add_sock(newsock, newcon, false); |
934 | addcon = newcon; | 934 | addcon = newcon; |
935 | } | 935 | } |
936 | 936 | ||
@@ -1058,7 +1058,7 @@ static void sctp_connect_to_sock(struct connection *con) | |||
1058 | sock->sk->sk_user_data = con; | 1058 | sock->sk->sk_user_data = con; |
1059 | con->rx_action = receive_from_sock; | 1059 | con->rx_action = receive_from_sock; |
1060 | con->connect_action = sctp_connect_to_sock; | 1060 | con->connect_action = sctp_connect_to_sock; |
1061 | add_sock(sock, con); | 1061 | add_sock(sock, con, true); |
1062 | 1062 | ||
1063 | /* Bind to all addresses. */ | 1063 | /* Bind to all addresses. */ |
1064 | if (sctp_bind_addrs(con, 0)) | 1064 | if (sctp_bind_addrs(con, 0)) |
@@ -1146,7 +1146,7 @@ static void tcp_connect_to_sock(struct connection *con) | |||
1146 | sock->sk->sk_user_data = con; | 1146 | sock->sk->sk_user_data = con; |
1147 | con->rx_action = receive_from_sock; | 1147 | con->rx_action = receive_from_sock; |
1148 | con->connect_action = tcp_connect_to_sock; | 1148 | con->connect_action = tcp_connect_to_sock; |
1149 | add_sock(sock, con); | 1149 | add_sock(sock, con, true); |
1150 | 1150 | ||
1151 | /* Bind to our cluster-known address connecting to avoid | 1151 | /* Bind to our cluster-known address connecting to avoid |
1152 | routing problems */ | 1152 | routing problems */ |
@@ -1366,7 +1366,7 @@ static int tcp_listen_for_all(void) | |||
1366 | 1366 | ||
1367 | sock = tcp_create_listen_sock(con, dlm_local_addr[0]); | 1367 | sock = tcp_create_listen_sock(con, dlm_local_addr[0]); |
1368 | if (sock) { | 1368 | if (sock) { |
1369 | add_sock(sock, con); | 1369 | add_sock(sock, con, true); |
1370 | result = 0; | 1370 | result = 0; |
1371 | } | 1371 | } |
1372 | else { | 1372 | else { |
diff --git a/fs/dlm/main.c b/fs/dlm/main.c index 079c0bd71ab7..8e1b618891be 100644 --- a/fs/dlm/main.c +++ b/fs/dlm/main.c | |||
@@ -11,6 +11,8 @@ | |||
11 | ******************************************************************************* | 11 | ******************************************************************************* |
12 | ******************************************************************************/ | 12 | ******************************************************************************/ |
13 | 13 | ||
14 | #include <linux/module.h> | ||
15 | |||
14 | #include "dlm_internal.h" | 16 | #include "dlm_internal.h" |
15 | #include "lockspace.h" | 17 | #include "lockspace.h" |
16 | #include "lock.h" | 18 | #include "lock.h" |
diff --git a/fs/dlm/netlink.c b/fs/dlm/netlink.c index 0643ae44f342..43a96c330570 100644 --- a/fs/dlm/netlink.c +++ b/fs/dlm/netlink.c | |||
@@ -65,7 +65,7 @@ static int user_cmd(struct sk_buff *skb, struct genl_info *info) | |||
65 | return 0; | 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 | .cmd = DLM_CMD_HELLO, | 70 | .cmd = DLM_CMD_HELLO, |
71 | .doit = user_cmd, | 71 | .doit = user_cmd, |
diff --git a/fs/dlm/user.c b/fs/dlm/user.c index 58c2f4a21b7f..1ce908c2232c 100644 --- a/fs/dlm/user.c +++ b/fs/dlm/user.c | |||
@@ -9,7 +9,6 @@ | |||
9 | #include <linux/miscdevice.h> | 9 | #include <linux/miscdevice.h> |
10 | #include <linux/init.h> | 10 | #include <linux/init.h> |
11 | #include <linux/wait.h> | 11 | #include <linux/wait.h> |
12 | #include <linux/module.h> | ||
13 | #include <linux/file.h> | 12 | #include <linux/file.h> |
14 | #include <linux/fs.h> | 13 | #include <linux/fs.h> |
15 | #include <linux/poll.h> | 14 | #include <linux/poll.h> |