From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Abeni Date: Tue, 16 Mar 2021 18:33:55 +0100 Subject: [Cluster-devel] [PATCHv2 dlm/next 7/8] fs: dlm: add reliable connection if reconnect In-Reply-To: <20210310191745.80824-8-aahringo@redhat.com> References: <20210310191745.80824-1-aahringo@redhat.com> <20210310191745.80824-8-aahringo@redhat.com> Message-ID: <67ecd684c22170be49be3ca9b28fdb7db5c61c36.camel@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Wed, 2021-03-10 at 14:17 -0500, Alexander Aring wrote: > @@ -116,32 +905,21 @@ int dlm_process_incoming_buffer(int nodeid, unsigned char *buf, int len) > if (msglen > len) > break; > > - switch (hd->h_cmd) { > - case DLM_MSG: > - if (msglen < sizeof(struct dlm_message)) { > - log_print("dlm msg too small: %u, will skip this message", > - msglen); > - goto skip; > - } > - > + idx = srcu_read_lock(&nodes_srcu); > + switch (le32_to_cpu(hd->h_version)) { > + case DLM_VERSION_3_1: > + dlm_midcomms_receive_buffer_3_1((union dlm_packet *)ptr, nodeid); > break; > - case DLM_RCOM: > - if (msglen < sizeof(struct dlm_rcom)) { > - log_print("dlm rcom msg too small: %u, will skip this message", > - msglen); > - goto skip; > - } > - > + case DLM_VERSION_3_2: > + dlm_midcomms_receive_buffer_3_2((union dlm_packet *)ptr, nodeid); > break; > default: > - log_print("unsupported h_cmd received: %u, will skip this message", > - hd->h_cmd); > - goto skip; > + log_print("received invalid version header: %u from node %d, will skip this message", > + le32_to_cpu(hd->h_version), nodeid); > + break; > } > + srcu_read_unlock(&nodes_srcu, idx); I think the srcu usage will be more clear if the lock/unlock are moved inside dlm_midcomms_receive_buffer_3_2() and dlm_midcomms_receive_buffe r_3_1(), so that they wrap the node lookup and access. Cheers, Paolo