Skip to content

Commit 19d37ce

Browse files
committed
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
2 parents 3e5cecf + 26c1ec2 commit 19d37ce

9 files changed

Lines changed: 22 additions & 20 deletions

File tree

fs/dlm/ast.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ void dlm_callback_work(struct work_struct *work)
268268
int dlm_callback_start(struct dlm_ls *ls)
269269
{
270270
ls->ls_callback_wq = alloc_workqueue("dlm_callback",
271-
WQ_UNBOUND | WQ_MEM_RECLAIM, 0);
271+
WQ_HIGHPRI | WQ_MEM_RECLAIM, 0);
272272
if (!ls->ls_callback_wq) {
273273
log_print("can't start dlm_callback workqueue");
274274
return -ENOMEM;

fs/dlm/config.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
******************************************************************************/
1313

1414
#include <linux/kernel.h>
15-
#include <linux/module.h>
15+
#include <linux/init.h>
1616
#include <linux/configfs.h>
1717
#include <linux/slab.h>
1818
#include <linux/in.h>

fs/dlm/debug_fs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
#include <linux/pagemap.h>
1414
#include <linux/seq_file.h>
15-
#include <linux/module.h>
15+
#include <linux/init.h>
1616
#include <linux/ctype.h>
1717
#include <linux/debugfs.h>
1818
#include <linux/slab.h>

fs/dlm/dlm_internal.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
* This is the main header file to be included in each DLM source file.
1919
*/
2020

21-
#include <linux/module.h>
2221
#include <linux/slab.h>
2322
#include <linux/sched.h>
2423
#include <linux/types.h>

fs/dlm/lockspace.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
*******************************************************************************
1212
******************************************************************************/
1313

14+
#include <linux/module.h>
15+
1416
#include "dlm_internal.h"
1517
#include "lockspace.h"
1618
#include "member.h"

fs/dlm/lowcomms.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -519,37 +519,33 @@ static void lowcomms_error_report(struct sock *sk)
519519
/* Note: sk_callback_lock must be locked before calling this function. */
520520
static void save_callbacks(struct connection *con, struct sock *sk)
521521
{
522-
lock_sock(sk);
523522
con->orig_data_ready = sk->sk_data_ready;
524523
con->orig_state_change = sk->sk_state_change;
525524
con->orig_write_space = sk->sk_write_space;
526525
con->orig_error_report = sk->sk_error_report;
527-
release_sock(sk);
528526
}
529527

530528
static void restore_callbacks(struct connection *con, struct sock *sk)
531529
{
532530
write_lock_bh(&sk->sk_callback_lock);
533-
lock_sock(sk);
534531
sk->sk_user_data = NULL;
535532
sk->sk_data_ready = con->orig_data_ready;
536533
sk->sk_state_change = con->orig_state_change;
537534
sk->sk_write_space = con->orig_write_space;
538535
sk->sk_error_report = con->orig_error_report;
539-
release_sock(sk);
540536
write_unlock_bh(&sk->sk_callback_lock);
541537
}
542538

543539
/* 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)
545541
{
546542
struct sock *sk = sock->sk;
547543

548544
write_lock_bh(&sk->sk_callback_lock);
549545
con->sock = sock;
550546

551547
sk->sk_user_data = con;
552-
if (!test_bit(CF_IS_OTHERCON, &con->flags))
548+
if (save_cb)
553549
save_callbacks(con, sk);
554550
/* Install a data_ready callback */
555551
sk->sk_data_ready = lowcomms_data_ready;
@@ -806,7 +802,7 @@ static int tcp_accept_from_sock(struct connection *con)
806802
newcon->othercon = othercon;
807803
othercon->sock = newsock;
808804
newsock->sk->sk_user_data = othercon;
809-
add_sock(newsock, othercon);
805+
add_sock(newsock, othercon, false);
810806
addcon = othercon;
811807
}
812808
else {
@@ -819,7 +815,10 @@ static int tcp_accept_from_sock(struct connection *con)
819815
else {
820816
newsock->sk->sk_user_data = newcon;
821817
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);
823822
addcon = newcon;
824823
}
825824

@@ -880,7 +879,8 @@ static int sctp_accept_from_sock(struct connection *con)
880879
}
881880

882881
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) {
884884
unsigned char *b = (unsigned char *)&prim.ssp_addr;
885885

886886
log_print("reject connect from unknown addr");
@@ -919,7 +919,7 @@ static int sctp_accept_from_sock(struct connection *con)
919919
newcon->othercon = othercon;
920920
othercon->sock = newsock;
921921
newsock->sk->sk_user_data = othercon;
922-
add_sock(newsock, othercon);
922+
add_sock(newsock, othercon, false);
923923
addcon = othercon;
924924
} else {
925925
printk("Extra connection from node %d attempted\n", nodeid);
@@ -930,7 +930,7 @@ static int sctp_accept_from_sock(struct connection *con)
930930
} else {
931931
newsock->sk->sk_user_data = newcon;
932932
newcon->rx_action = receive_from_sock;
933-
add_sock(newsock, newcon);
933+
add_sock(newsock, newcon, false);
934934
addcon = newcon;
935935
}
936936

@@ -1058,7 +1058,7 @@ static void sctp_connect_to_sock(struct connection *con)
10581058
sock->sk->sk_user_data = con;
10591059
con->rx_action = receive_from_sock;
10601060
con->connect_action = sctp_connect_to_sock;
1061-
add_sock(sock, con);
1061+
add_sock(sock, con, true);
10621062

10631063
/* Bind to all addresses. */
10641064
if (sctp_bind_addrs(con, 0))
@@ -1146,7 +1146,7 @@ static void tcp_connect_to_sock(struct connection *con)
11461146
sock->sk->sk_user_data = con;
11471147
con->rx_action = receive_from_sock;
11481148
con->connect_action = tcp_connect_to_sock;
1149-
add_sock(sock, con);
1149+
add_sock(sock, con, true);
11501150

11511151
/* Bind to our cluster-known address connecting to avoid
11521152
routing problems */
@@ -1366,7 +1366,7 @@ static int tcp_listen_for_all(void)
13661366

13671367
sock = tcp_create_listen_sock(con, dlm_local_addr[0]);
13681368
if (sock) {
1369-
add_sock(sock, con);
1369+
add_sock(sock, con, true);
13701370
result = 0;
13711371
}
13721372
else {

fs/dlm/main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
*******************************************************************************
1212
******************************************************************************/
1313

14+
#include <linux/module.h>
15+
1416
#include "dlm_internal.h"
1517
#include "lockspace.h"
1618
#include "lock.h"

fs/dlm/netlink.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ static int user_cmd(struct sk_buff *skb, struct genl_info *info)
6565
return 0;
6666
}
6767

68-
static struct genl_ops dlm_nl_ops[] = {
68+
static const struct genl_ops dlm_nl_ops[] = {
6969
{
7070
.cmd = DLM_CMD_HELLO,
7171
.doit = user_cmd,

fs/dlm/user.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include <linux/miscdevice.h>
1010
#include <linux/init.h>
1111
#include <linux/wait.h>
12-
#include <linux/module.h>
1312
#include <linux/file.h>
1413
#include <linux/fs.h>
1514
#include <linux/poll.h>

0 commit comments

Comments
 (0)