Skip to content

Commit 91a683c

Browse files
committed
Merge tag 'dlm-6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm
Pull dlm updates from David Teigland: "This set of patches has some minor fixes for message handling, some misc cleanups, and updates the maintainers entry" * tag 'dlm-6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm: MAINTAINERS: Update dlm maintainer and web page dlm: slow down filling up processing queue dlm: fix no ack after final message dlm: be sure we reset all nodes at forced shutdown dlm: fix remove member after close call dlm: fix creating multiple node structures fs: dlm: Remove some useless memset() fs: dlm: Fix the size of a buffer in dlm_create_debug_file() fs: dlm: Simplify buffer size computation in dlm_create_debug_file()
2 parents 17fc808 + eb53c01 commit 91a683c

File tree

4 files changed

+53
-20
lines changed

4 files changed

+53
-20
lines changed

MAINTAINERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6172,11 +6172,11 @@ F: drivers/video/fbdev/udlfb.c
61726172
F: include/video/udlfb.h
61736173

61746174
DISTRIBUTED LOCK MANAGER (DLM)
6175-
M: Christine Caulfield <ccaulfie@redhat.com>
6175+
M: Alexander Aring <aahringo@redhat.com>
61766176
M: David Teigland <[email protected]>
61776177
61786178
S: Supported
6179-
W: http://sources.redhat.com/cluster/
6179+
W: https://pagure.io/dlm
61806180
T: git git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm.git
61816181
F: fs/dlm/
61826182

fs/dlm/debug_fs.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -973,7 +973,8 @@ void dlm_delete_debug_comms_file(void *ctx)
973973

974974
void dlm_create_debug_file(struct dlm_ls *ls)
975975
{
976-
char name[DLM_LOCKSPACE_LEN + 8];
976+
/* Reserve enough space for the longest file name */
977+
char name[DLM_LOCKSPACE_LEN + sizeof("_queued_asts")];
977978

978979
/* format 1 */
979980

@@ -985,8 +986,7 @@ void dlm_create_debug_file(struct dlm_ls *ls)
985986

986987
/* format 2 */
987988

988-
memset(name, 0, sizeof(name));
989-
snprintf(name, DLM_LOCKSPACE_LEN + 8, "%s_locks", ls->ls_name);
989+
snprintf(name, sizeof(name), "%s_locks", ls->ls_name);
990990

991991
ls->ls_debug_locks_dentry = debugfs_create_file(name,
992992
0644,
@@ -996,8 +996,7 @@ void dlm_create_debug_file(struct dlm_ls *ls)
996996

997997
/* format 3 */
998998

999-
memset(name, 0, sizeof(name));
1000-
snprintf(name, DLM_LOCKSPACE_LEN + 8, "%s_all", ls->ls_name);
999+
snprintf(name, sizeof(name), "%s_all", ls->ls_name);
10011000

10021001
ls->ls_debug_all_dentry = debugfs_create_file(name,
10031002
S_IFREG | S_IRUGO,
@@ -1007,17 +1006,15 @@ void dlm_create_debug_file(struct dlm_ls *ls)
10071006

10081007
/* format 4 */
10091008

1010-
memset(name, 0, sizeof(name));
1011-
snprintf(name, DLM_LOCKSPACE_LEN + 8, "%s_toss", ls->ls_name);
1009+
snprintf(name, sizeof(name), "%s_toss", ls->ls_name);
10121010

10131011
ls->ls_debug_toss_dentry = debugfs_create_file(name,
10141012
S_IFREG | S_IRUGO,
10151013
dlm_root,
10161014
ls,
10171015
&format4_fops);
10181016

1019-
memset(name, 0, sizeof(name));
1020-
snprintf(name, DLM_LOCKSPACE_LEN + 8, "%s_waiters", ls->ls_name);
1017+
snprintf(name, sizeof(name), "%s_waiters", ls->ls_name);
10211018

10221019
ls->ls_debug_waiters_dentry = debugfs_create_file(name,
10231020
0644,
@@ -1027,8 +1024,7 @@ void dlm_create_debug_file(struct dlm_ls *ls)
10271024

10281025
/* format 5 */
10291026

1030-
memset(name, 0, sizeof(name));
1031-
snprintf(name, DLM_LOCKSPACE_LEN + 8, "%s_queued_asts", ls->ls_name);
1027+
snprintf(name, sizeof(name), "%s_queued_asts", ls->ls_name);
10321028

10331029
ls->ls_debug_queued_asts_dentry = debugfs_create_file(name,
10341030
0644,

fs/dlm/lowcomms.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
#include "config.h"
6464

6565
#define DLM_SHUTDOWN_WAIT_TIMEOUT msecs_to_jiffies(5000)
66+
#define DLM_MAX_PROCESS_BUFFERS 24
6667
#define NEEDED_RMEM (4*1024*1024)
6768

6869
struct connection {
@@ -194,6 +195,7 @@ static const struct dlm_proto_ops *dlm_proto_ops;
194195
#define DLM_IO_END 1
195196
#define DLM_IO_EOF 2
196197
#define DLM_IO_RESCHED 3
198+
#define DLM_IO_FLUSH 4
197199

198200
static void process_recv_sockets(struct work_struct *work);
199201
static void process_send_sockets(struct work_struct *work);
@@ -202,6 +204,7 @@ static void process_dlm_messages(struct work_struct *work);
202204
static DECLARE_WORK(process_work, process_dlm_messages);
203205
static DEFINE_SPINLOCK(processqueue_lock);
204206
static bool process_dlm_messages_pending;
207+
static atomic_t processqueue_count;
205208
static LIST_HEAD(processqueue);
206209

207210
bool dlm_lowcomms_is_running(void)
@@ -874,6 +877,7 @@ static void process_dlm_messages(struct work_struct *work)
874877
}
875878

876879
list_del(&pentry->list);
880+
atomic_dec(&processqueue_count);
877881
spin_unlock(&processqueue_lock);
878882

879883
for (;;) {
@@ -891,6 +895,7 @@ static void process_dlm_messages(struct work_struct *work)
891895
}
892896

893897
list_del(&pentry->list);
898+
atomic_dec(&processqueue_count);
894899
spin_unlock(&processqueue_lock);
895900
}
896901
}
@@ -962,13 +967,17 @@ static int receive_from_sock(struct connection *con, int buflen)
962967
con->rx_leftover);
963968

964969
spin_lock(&processqueue_lock);
970+
ret = atomic_inc_return(&processqueue_count);
965971
list_add_tail(&pentry->list, &processqueue);
966972
if (!process_dlm_messages_pending) {
967973
process_dlm_messages_pending = true;
968974
queue_work(process_workqueue, &process_work);
969975
}
970976
spin_unlock(&processqueue_lock);
971977

978+
if (ret > DLM_MAX_PROCESS_BUFFERS)
979+
return DLM_IO_FLUSH;
980+
972981
return DLM_IO_SUCCESS;
973982
}
974983

@@ -1503,6 +1512,9 @@ static void process_recv_sockets(struct work_struct *work)
15031512
wake_up(&con->shutdown_wait);
15041513
/* CF_RECV_PENDING cleared */
15051514
break;
1515+
case DLM_IO_FLUSH:
1516+
flush_workqueue(process_workqueue);
1517+
fallthrough;
15061518
case DLM_IO_RESCHED:
15071519
cond_resched();
15081520
queue_work(io_workqueue, &con->rwork);

fs/dlm/midcomms.c

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -337,13 +337,21 @@ static struct midcomms_node *nodeid2node(int nodeid)
337337

338338
int dlm_midcomms_addr(int nodeid, struct sockaddr_storage *addr, int len)
339339
{
340-
int ret, r = nodeid_hash(nodeid);
340+
int ret, idx, r = nodeid_hash(nodeid);
341341
struct midcomms_node *node;
342342

343343
ret = dlm_lowcomms_addr(nodeid, addr, len);
344344
if (ret)
345345
return ret;
346346

347+
idx = srcu_read_lock(&nodes_srcu);
348+
node = __find_node(nodeid, r);
349+
if (node) {
350+
srcu_read_unlock(&nodes_srcu, idx);
351+
return 0;
352+
}
353+
srcu_read_unlock(&nodes_srcu, idx);
354+
347355
node = kmalloc(sizeof(*node), GFP_NOFS);
348356
if (!node)
349357
return -ENOMEM;
@@ -1030,15 +1038,15 @@ struct dlm_mhandle *dlm_midcomms_get_mhandle(int nodeid, int len,
10301038

10311039
break;
10321040
case DLM_VERSION_3_2:
1041+
/* send ack back if necessary */
1042+
dlm_send_ack_threshold(node, DLM_SEND_ACK_BACK_MSG_THRESHOLD);
1043+
10331044
msg = dlm_midcomms_get_msg_3_2(mh, nodeid, len, allocation,
10341045
ppc);
10351046
if (!msg) {
10361047
dlm_free_mhandle(mh);
10371048
goto err;
10381049
}
1039-
1040-
/* send ack back if necessary */
1041-
dlm_send_ack_threshold(node, DLM_SEND_ACK_BACK_MSG_THRESHOLD);
10421050
break;
10431051
default:
10441052
dlm_free_mhandle(mh);
@@ -1260,12 +1268,23 @@ void dlm_midcomms_remove_member(int nodeid)
12601268

12611269
idx = srcu_read_lock(&nodes_srcu);
12621270
node = nodeid2node(nodeid);
1263-
if (WARN_ON_ONCE(!node)) {
1271+
/* in case of dlm_midcomms_close() removes node */
1272+
if (!node) {
12641273
srcu_read_unlock(&nodes_srcu, idx);
12651274
return;
12661275
}
12671276

12681277
spin_lock(&node->state_lock);
1278+
/* case of dlm_midcomms_addr() created node but
1279+
* was not added before because dlm_midcomms_close()
1280+
* removed the node
1281+
*/
1282+
if (!node->users) {
1283+
spin_unlock(&node->state_lock);
1284+
srcu_read_unlock(&nodes_srcu, idx);
1285+
return;
1286+
}
1287+
12691288
node->users--;
12701289
pr_debug("node %d users dec count %d\n", nodeid, node->users);
12711290

@@ -1386,10 +1405,16 @@ void dlm_midcomms_shutdown(void)
13861405
midcomms_shutdown(node);
13871406
}
13881407
}
1389-
srcu_read_unlock(&nodes_srcu, idx);
1390-
mutex_unlock(&close_lock);
13911408

13921409
dlm_lowcomms_shutdown();
1410+
1411+
for (i = 0; i < CONN_HASH_SIZE; i++) {
1412+
hlist_for_each_entry_rcu(node, &node_hash[i], hlist) {
1413+
midcomms_node_reset(node);
1414+
}
1415+
}
1416+
srcu_read_unlock(&nodes_srcu, idx);
1417+
mutex_unlock(&close_lock);
13931418
}
13941419

13951420
int dlm_midcomms_close(int nodeid)

0 commit comments

Comments
 (0)