fs: dlm: define max send buffer
authorAlexander Aring <aahringo@redhat.com>
Tue, 3 Nov 2020 01:04:17 +0000 (20:04 -0500)
committerDavid Teigland <teigland@redhat.com>
Tue, 10 Nov 2020 18:14:20 +0000 (12:14 -0600)
This patch will set the maximum transmit buffer size for rcom messages
with "names" to 4096 bytes. It's a leftover change of
commit 4798cbbfbd00 ("fs: dlm: rework receive handling"). Fact is that we
cannot allocate a contiguous transmit buffer length above of 4096 bytes.
It seems at some places the upper layer protocol will calculate according
to dlm_config.ci_buffer_size the possible payload of a dlm recovery
message. As compiler setting we will use now the maximum possible
message which dlm can send out. Commit 4e192ee68e5af ("fs: dlm: disallow
buffer size below default") disallow a buffer setting smaller than the
4096 bytes and above 4096 bytes is definitely wrong because we will then
write out of buffer space as we cannot allocate a contiguous buffer above
4096 bytes. The ci_buffer_size is still there to define the possible
maximum receive buffer size of a recvmsg() which should be at least the
maximum possible dlm message size.

Signed-off-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
fs/dlm/lockspace.c
fs/dlm/lowcomms.h
fs/dlm/member.c
fs/dlm/rcom.c

index 624617c12250ad81e7591ee7dc31d697d89e2b75..561dcad08ad6e2070ea715ff0a2c37c1f373e90e 100644 (file)
@@ -572,7 +572,7 @@ static int new_lockspace(const char *name, const char *cluster,
        mutex_init(&ls->ls_requestqueue_mutex);
        mutex_init(&ls->ls_clear_proc_locks);
 
-       ls->ls_recover_buf = kmalloc(dlm_config.ci_buffer_size, GFP_NOFS);
+       ls->ls_recover_buf = kmalloc(LOWCOMMS_MAX_TX_BUFFER_LEN, GFP_NOFS);
        if (!ls->ls_recover_buf)
                goto out_lkbidr;
 
index 687b2894e469a8292471c1391debc9b9ad3bf1bd..0918f9376489f956aafb7975f6667c52ac9dc451 100644 (file)
@@ -12,6 +12,8 @@
 #ifndef __LOWCOMMS_DOT_H__
 #define __LOWCOMMS_DOT_H__
 
+#define LOWCOMMS_MAX_TX_BUFFER_LEN     4096
+
 int dlm_lowcomms_start(void);
 void dlm_lowcomms_stop(void);
 void dlm_lowcomms_exit(void);
index 7ad83deb4505353ef0a0f3406677d1a34649a590..ceef3f2074ffd3f5585f1502c2c0e46a3c2f2a20 100644 (file)
@@ -270,7 +270,7 @@ int dlm_slots_assign(struct dlm_ls *ls, int *num_slots, int *slots_size,
 
        log_slots(ls, gen, num, NULL, array, array_size);
 
-       max_slots = (dlm_config.ci_buffer_size - sizeof(struct dlm_rcom) -
+       max_slots = (LOWCOMMS_MAX_TX_BUFFER_LEN - sizeof(struct dlm_rcom) -
                     sizeof(struct rcom_config)) / sizeof(struct rcom_slot);
 
        if (num > max_slots) {
index 4daf5dc2b51c0ffe09d0ff4e442f08ed362f65af..73ddee5159d79cebcc15f896f8d099a53ac835db 100644 (file)
@@ -162,7 +162,7 @@ retry:
        set_rcom_status(ls, (struct rcom_status *)rc->rc_buf, status_flags);
 
        allow_sync_reply(ls, &rc->rc_id);
-       memset(ls->ls_recover_buf, 0, dlm_config.ci_buffer_size);
+       memset(ls->ls_recover_buf, 0, LOWCOMMS_MAX_TX_BUFFER_LEN);
 
        send_rcom(ls, mh, rc);
 
@@ -284,7 +284,7 @@ retry:
        memcpy(rc->rc_buf, last_name, last_len);
 
        allow_sync_reply(ls, &rc->rc_id);
-       memset(ls->ls_recover_buf, 0, dlm_config.ci_buffer_size);
+       memset(ls->ls_recover_buf, 0, LOWCOMMS_MAX_TX_BUFFER_LEN);
 
        send_rcom(ls, mh, rc);
 
@@ -304,7 +304,7 @@ static void receive_rcom_names(struct dlm_ls *ls, struct dlm_rcom *rc_in)
 
        nodeid = rc_in->rc_header.h_nodeid;
        inlen = rc_in->rc_header.h_length - sizeof(struct dlm_rcom);
-       outlen = dlm_config.ci_buffer_size - sizeof(struct dlm_rcom);
+       outlen = LOWCOMMS_MAX_TX_BUFFER_LEN - sizeof(struct dlm_rcom);
 
        error = create_rcom(ls, nodeid, DLM_RCOM_NAMES_REPLY, outlen, &rc, &mh);
        if (error)