From: Alexander Aring <aahringo@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCHv2 RESEND v5.10-rc2 05/13] fs: dlm: handle non blocked connect event
Date: Mon, 2 Nov 2020 20:04:20 -0500 [thread overview]
Message-ID: <20201103010428.1009384-6-aahringo@redhat.com> (raw)
In-Reply-To: <20201103010428.1009384-1-aahringo@redhat.com>
The manpage of connect shows that in non blocked mode a writeability
indicates successful connection event. This patch is handling this event
inside the writeability callback. In case of SCTP we use blocking
connect functionality which indicates a successful connect when the
function returns with a successful return value.
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
fs/dlm/lowcomms.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index c0c688aac223..193a4c91c4d8 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -78,6 +78,7 @@ struct connection {
#define CF_APP_LIMITED 7
#define CF_CLOSING 8
#define CF_SHUTDOWN 9
+#define CF_CONNECTED 10
struct list_head writequeue; /* List of outgoing writequeue_entries */
spinlock_t writequeue_lock;
int (*rx_action) (struct connection *); /* What to do when active */
@@ -419,6 +420,12 @@ static void lowcomms_write_space(struct sock *sk)
if (!con)
goto out;
+ if (!test_and_set_bit(CF_CONNECTED, &con->flags)) {
+ log_print("successful connected to node %d", con->nodeid);
+ queue_work(send_workqueue, &con->swork);
+ goto out;
+ }
+
clear_bit(SOCK_NOSPACE, &con->sock->flags);
if (test_and_clear_bit(CF_APP_LIMITED, &con->flags)) {
@@ -604,6 +611,7 @@ static void close_connection(struct connection *con, bool and_other,
con->rx_leftover = 0;
con->retries = 0;
+ clear_bit(CF_CONNECTED, &con->flags);
mutex_unlock(&con->sock_mutex);
clear_bit(CF_CLOSING, &con->flags);
}
@@ -1027,8 +1035,11 @@ static void sctp_connect_to_sock(struct connection *con)
if (result == -EINPROGRESS)
result = 0;
- if (result == 0)
+ if (result == 0) {
+ if (!test_and_set_bit(CF_CONNECTED, &con->flags))
+ log_print("successful connected to node %d", con->nodeid);
goto out;
+ }
bind_err:
con->sock = NULL;
--
2.26.2
next prev parent reply other threads:[~2020-11-03 1:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-03 1:04 [Cluster-devel] [PATCHv2 RESEND v5.10-rc2 00/13] fs: dlm: fixes and change listen socket handling Alexander Aring
2020-11-03 1:04 ` [Cluster-devel] [PATCHv2 RESEND v5.10-rc2 01/13] fs: dlm: fix proper srcu api call Alexander Aring
2020-11-03 1:04 ` [Cluster-devel] [PATCHv2 RESEND v5.10-rc2 02/13] fs: dlm: define max send buffer Alexander Aring
2020-11-03 1:04 ` [Cluster-devel] [PATCHv2 RESEND v5.10-rc2 03/13] fs: dlm: add get buffer error handling Alexander Aring
2020-11-03 1:04 ` [Cluster-devel] [PATCHv2 RESEND v5.10-rc2 04/13] fs: dlm: flush othercon at close Alexander Aring
2020-11-03 1:04 ` Alexander Aring [this message]
2020-11-03 1:04 ` [Cluster-devel] [PATCHv2 RESEND v5.10-rc2 06/13] fs: dlm: add helper for init connection Alexander Aring
2020-11-03 1:04 ` [Cluster-devel] [PATCHv2 RESEND v5.10-rc2 07/13] fs: dlm: move connect callback in node creation Alexander Aring
2020-11-03 1:04 ` [Cluster-devel] [PATCHv2 RESEND v5.10-rc2 08/13] fs: dlm: move shutdown action to " Alexander Aring
2020-11-03 1:04 ` [Cluster-devel] [PATCHv2 RESEND v5.10-rc2 09/13] fs: dlm: refactor sctp sock parameter Alexander Aring
2020-11-03 1:04 ` [Cluster-devel] [PATCHv2 RESEND v5.10-rc2 10/13] fs: dlm: listen socket out of connection hash Alexander Aring
2020-11-03 1:04 ` [Cluster-devel] [PATCHv2 RESEND v5.10-rc2 11/13] fs: dlm: fix check for multi-homed hosts Alexander Aring
2020-11-03 1:04 ` [Cluster-devel] [PATCHv2 RESEND v5.10-rc2 12/13] fs: dlm: constify addr_compare Alexander Aring
2020-11-03 1:04 ` [Cluster-devel] [PATCHv2 RESEND v5.10-rc2 13/13] fs: dlm: check on existing node address Alexander Aring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201103010428.1009384-6-aahringo@redhat.com \
--to=aahringo@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).