Skip to content

Commit 0461e0d

Browse files
alexaringteigland
authored andcommitted
fs: dlm: remove lock dependency warning
During my experiments to make dlm robust against tcpkill application I was able to run sometimes in a circular lock dependency warning between clusters_root.subsys.su_mutex and con->sock_mutex. We don't need to held the sock_mutex when getting the mark value which held the clusters_root.subsys.su_mutex. This patch moves the specific handling just before the sock_mutex will be held. Signed-off-by: Alexander Aring <aahringo@redhat.com> Signed-off-by: David Teigland <teigland@redhat.com>
1 parent 7ae0451 commit 0461e0d

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

‎fs/dlm/lowcomms.c‎

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -971,6 +971,10 @@ static void sctp_connect_to_sock(struct connection *con)
971971
return;
972972
}
973973

974+
result = dlm_comm_mark(con->nodeid, &mark);
975+
if (result < 0)
976+
return;
977+
974978
mutex_lock(&con->sock_mutex);
975979

976980
/* Some odd races can cause double-connects, ignore them */
@@ -995,11 +999,6 @@ static void sctp_connect_to_sock(struct connection *con)
995999
if (result < 0)
9961000
goto socket_err;
9971001

998-
/* set skb mark */
999-
result = dlm_comm_mark(con->nodeid, &mark);
1000-
if (result < 0)
1001-
goto bind_err;
1002-
10031002
sock_set_mark(sock->sk, mark);
10041003

10051004
con->rx_action = receive_from_sock;
@@ -1072,6 +1071,10 @@ static void tcp_connect_to_sock(struct connection *con)
10721071
return;
10731072
}
10741073

1074+
result = dlm_comm_mark(con->nodeid, &mark);
1075+
if (result < 0)
1076+
return;
1077+
10751078
mutex_lock(&con->sock_mutex);
10761079
if (con->retries++ > MAX_CONNECT_RETRIES)
10771080
goto out;
@@ -1086,11 +1089,6 @@ static void tcp_connect_to_sock(struct connection *con)
10861089
if (result < 0)
10871090
goto out_err;
10881091

1089-
/* set skb mark */
1090-
result = dlm_comm_mark(con->nodeid, &mark);
1091-
if (result < 0)
1092-
goto out_err;
1093-
10941092
sock_set_mark(sock->sk, mark);
10951093

10961094
memset(&saddr, 0, sizeof(saddr));

0 commit comments

Comments
 (0)