]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/suse-2.6.27.39/patches.fixes/dlm-connect-to-nodes-earlier.patch
Fix oinkmaster patch.
[ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.fixes / dlm-connect-to-nodes-earlier.patch
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
5
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.
10
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>
14 ---
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(-)
19
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);
26 }
27
28 +int dlm_lowcomms_connect_node(int nodeid)
29 +{
30 + struct connection *con;
31 +
32 + if (nodeid == dlm_our_nodeid())
33 + return 0;
34 +
35 + con = nodeid2con(nodeid, GFP_NOFS);
36 + if (!con)
37 + return -ENOMEM;
38 + lowcomms_connect_sock(con);
39 + return 0;
40 +}
41 +
42 /* Make a socket active */
43 static int add_sock(struct socket *sock, struct connection *con)
44 {
45 @@ -1421,7 +1435,7 @@ static int work_start(void)
46 static void stop_conn(struct connection *con)
47 {
48 con->flags |= 0x0F;
49 - if (con->sock)
50 + if (con->sock && con->sock->sk)
51 con->sock->sk->sk_user_data = NULL;
52 }
53
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
58 @@ -2,7 +2,7 @@
59 *******************************************************************************
60 **
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.
64 **
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);
72
73 #endif /* __LOWCOMMS_DOT_H__ */
74
75 diff --git a/fs/dlm/member.c b/fs/dlm/member.c
76 index 26133f0..2afb770 100644
77 --- a/fs/dlm/member.c
78 +++ b/fs/dlm/member.c
79 @@ -1,7 +1,7 @@
80 /******************************************************************************
81 *******************************************************************************
82 **
83 -** Copyright (C) 2005-2008 Red Hat, Inc. All rights reserved.
84 +** Copyright (C) 2005-2009 Red Hat, Inc. All rights reserved.
85 **
86 ** This copyrighted material is made available to anyone wishing to use,
87 ** modify, copy, or redistribute it subject to the terms and conditions
88 @@ -17,6 +17,7 @@
89 #include "recover.h"
90 #include "rcom.h"
91 #include "config.h"
92 +#include "lowcomms.h"
93
94 static void add_ordered_member(struct dlm_ls *ls, struct dlm_member *new)
95 {
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)
98 {
99 struct dlm_member *memb;
100 - int w;
101 + int w, error;
102
103 memb = kzalloc(sizeof(struct dlm_member), GFP_KERNEL);
104 if (!memb)
105 @@ -57,6 +58,12 @@ static int dlm_add_member(struct dlm_ls *ls, int nodeid)
106 return w;
107 }
108
109 + error = dlm_lowcomms_connect_node(nodeid);
110 + if (error < 0) {
111 + kfree(memb);
112 + return error;
113 + }
114 +
115 memb->nodeid = nodeid;
116 memb->weight = w;
117 add_ordered_member(ls, memb);
118 --
119 1.6.0.2
120