1 From 391fbdc5d527149578490db2f1619951d91f3561 Mon Sep 17 00:00:00 2001
2 From: Christine Caulfield <ccaulfie@redhat.com>
3 Date: Thu, 7 May 2009 10:54:16 -0500
4 Subject: [PATCH] dlm: connect to nodes earlier
6 Make network connections to other nodes earlier, in the context of
7 dlm_recoverd. This avoids connecting to nodes from dlm_send where we
8 try to avoid allocations which could possibly deadlock if memory reclaim
9 goes into the cluster fs which may try to do a dlm operation.
11 Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
12 Signed-off-by: David Teigland <teigland@redhat.com>
13 Signed-off-by: Coly Li <coly.li@suse.de>
15 fs/dlm/lowcomms.c | 16 +++++++++++++++-
16 fs/dlm/lowcomms.h | 3 ++-
17 fs/dlm/member.c | 11 +++++++++--
18 3 files changed, 26 insertions(+), 4 deletions(-)
20 diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
21 index 609108a..2559a97 100644
22 --- a/fs/dlm/lowcomms.c
23 +++ b/fs/dlm/lowcomms.c
24 @@ -309,6 +309,20 @@ static void lowcomms_state_change(struct sock *sk)
25 lowcomms_write_space(sk);
28 +int dlm_lowcomms_connect_node(int nodeid)
30 + struct connection *con;
32 + if (nodeid == dlm_our_nodeid())
35 + con = nodeid2con(nodeid, GFP_NOFS);
38 + lowcomms_connect_sock(con);
42 /* Make a socket active */
43 static int add_sock(struct socket *sock, struct connection *con)
45 @@ -1421,7 +1435,7 @@ static int work_start(void)
46 static void stop_conn(struct connection *con)
50 + if (con->sock && con->sock->sk)
51 con->sock->sk->sk_user_data = NULL;
54 diff --git a/fs/dlm/lowcomms.h b/fs/dlm/lowcomms.h
55 index a9a9618..1311e64 100644
56 --- a/fs/dlm/lowcomms.h
57 +++ b/fs/dlm/lowcomms.h
59 *******************************************************************************
61 ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
62 -** Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved.
63 +** Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved.
65 ** This copyrighted material is made available to anyone wishing to use,
66 ** modify, copy, or redistribute it subject to the terms and conditions
67 @@ -19,6 +19,7 @@ void dlm_lowcomms_stop(void);
68 int dlm_lowcomms_close(int nodeid);
69 void *dlm_lowcomms_get_buffer(int nodeid, int len, gfp_t allocation, char **ppc);
70 void dlm_lowcomms_commit_buffer(void *mh);
71 +int dlm_lowcomms_connect_node(int nodeid);
73 #endif /* __LOWCOMMS_DOT_H__ */
75 diff --git a/fs/dlm/member.c b/fs/dlm/member.c
76 index 26133f0..2afb770 100644
80 /******************************************************************************
81 *******************************************************************************
83 -** Copyright (C) 2005-2008 Red Hat, Inc. All rights reserved.
84 +** Copyright (C) 2005-2009 Red Hat, Inc. All rights reserved.
86 ** This copyrighted material is made available to anyone wishing to use,
87 ** modify, copy, or redistribute it subject to the terms and conditions
92 +#include "lowcomms.h"
94 static void add_ordered_member(struct dlm_ls *ls, struct dlm_member *new)
96 @@ -45,7 +46,7 @@ static void add_ordered_member(struct dlm_ls *ls, struct dlm_member *new)
97 static int dlm_add_member(struct dlm_ls *ls, int nodeid)
99 struct dlm_member *memb;
103 memb = kzalloc(sizeof(struct dlm_member), GFP_KERNEL);
105 @@ -57,6 +58,12 @@ static int dlm_add_member(struct dlm_ls *ls, int nodeid)
109 + error = dlm_lowcomms_connect_node(nodeid);
115 memb->nodeid = nodeid;
117 add_ordered_member(ls, memb);