Skip to content

Commit 3f78cd7

Browse files
alexaringteigland
authored andcommitted
fs: dlm: fix mark per nodeid setting
This patch fixes to set per nodeid mark configuration for accepted sockets as well. Before this patch only the listen socket mark value was used for all accepted connections. This patch will ensure that the cluster mark attribute value will be always used for all sockets, if a per nodeid mark value is specified dlm will use this value for the specific node. Signed-off-by: Alexander Aring <aahringo@redhat.com> Signed-off-by: David Teigland <teigland@redhat.com>
1 parent 0461e0d commit 3f78cd7

3 files changed

Lines changed: 17 additions & 13 deletions

File tree

‎fs/dlm/config.c‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -860,18 +860,22 @@ int dlm_comm_seq(int nodeid, uint32_t *seq)
860860
return 0;
861861
}
862862

863-
int dlm_comm_mark(int nodeid, unsigned int *mark)
863+
void dlm_comm_mark(int nodeid, unsigned int *mark)
864864
{
865865
struct dlm_comm *cm;
866866

867867
cm = get_comm(nodeid);
868-
if (!cm)
869-
return -ENOENT;
868+
if (!cm) {
869+
*mark = dlm_config.ci_mark;
870+
return;
871+
}
870872

871-
*mark = cm->mark;
872-
put_comm(cm);
873+
if (cm->mark)
874+
*mark = cm->mark;
875+
else
876+
*mark = dlm_config.ci_mark;
873877

874-
return 0;
878+
put_comm(cm);
875879
}
876880

877881
int dlm_our_nodeid(void)

‎fs/dlm/config.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ void dlm_config_exit(void);
4646
int dlm_config_nodes(char *lsname, struct dlm_config_node **nodes_out,
4747
int *count_out);
4848
int dlm_comm_seq(int nodeid, uint32_t *seq);
49-
int dlm_comm_mark(int nodeid, unsigned int *mark);
49+
void dlm_comm_mark(int nodeid, unsigned int *mark);
5050
int dlm_our_nodeid(void);
5151
int dlm_our_addr(struct sockaddr_storage *addr, int num);
5252

‎fs/dlm/lowcomms.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,7 @@ static int accept_from_sock(struct connection *con)
790790
int nodeid;
791791
struct connection *newcon;
792792
struct connection *addcon;
793+
unsigned int mark;
793794

794795
if (!dlm_allow_conn) {
795796
return -1;
@@ -826,6 +827,9 @@ static int accept_from_sock(struct connection *con)
826827
return -1;
827828
}
828829

830+
dlm_comm_mark(nodeid, &mark);
831+
sock_set_mark(newsock->sk, mark);
832+
829833
log_print("got connection from %d", nodeid);
830834

831835
/* Check to see if we already have a connection to this node. This
@@ -971,9 +975,7 @@ static void sctp_connect_to_sock(struct connection *con)
971975
return;
972976
}
973977

974-
result = dlm_comm_mark(con->nodeid, &mark);
975-
if (result < 0)
976-
return;
978+
dlm_comm_mark(con->nodeid, &mark);
977979

978980
mutex_lock(&con->sock_mutex);
979981

@@ -1071,9 +1073,7 @@ static void tcp_connect_to_sock(struct connection *con)
10711073
return;
10721074
}
10731075

1074-
result = dlm_comm_mark(con->nodeid, &mark);
1075-
if (result < 0)
1076-
return;
1076+
dlm_comm_mark(con->nodeid, &mark);
10771077

10781078
mutex_lock(&con->sock_mutex);
10791079
if (con->retries++ > MAX_CONNECT_RETRIES)

0 commit comments

Comments
 (0)