cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Andreas Gruenbacher <agruenba@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [DLM PATCH 3/6] DLM: Make consistent error path
Date: Thu, 11 Feb 2016 22:09:18 +0100	[thread overview]
Message-ID: <1455224958-1274-1-git-send-email-agruenba@redhat.com> (raw)
In-Reply-To: <1144926957.21868310.1455213550925.JavaMail.zimbra@redhat.com>

Bob,

On Thu, Feb 11, 2016 at 6:59 PM, Bob Peterson <rpeterso@redhat.com> wrote:
> ----- Original Message -----
>> > +out_err:
>> > +       sock_release(sock);
>> > +       sock = NULL;
>> > +       con->sock = NULL;
>>
>> Consolidating the error paths makes sense, but con->sock shouldn't be
>> set here at all; the caller does that in add_sock().
>
> I disagree.
>
> The caller doesn't call add_sock() in the error case, which is where
> we're setting con->sock to NULL.

well, the caller sets con->sock on success, so why doesn't it set it on failure
as well?

Andreas

---
 fs/dlm/lowcomms.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index ac7eae4..0d6e374 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -1265,7 +1265,6 @@ create_out:
 out_err:
 	sock_release(sock);
 	sock = NULL;
-	con->sock = NULL;
 
 	goto create_out;
 }
@@ -1352,7 +1351,6 @@ static int tcp_listen_for_all(void)
 {
 	struct socket *sock = NULL;
 	struct connection *con = nodeid2con(0, GFP_NOFS);
-	int result = -EINVAL;
 
 	if (!con)
 		return -ENOMEM;
@@ -1369,13 +1367,11 @@ static int tcp_listen_for_all(void)
 	sock = tcp_create_listen_sock(con, dlm_local_addr[0]);
 	if (sock) {
 		add_sock(sock, con);
-		result = 0;
-	}
-	else {
-		result = -EADDRINUSE;
+		return 0;
+	} else {
+		con->sock = NULL;
+		return -EADDRINUSE;
 	}
-
-	return result;
 }
 
 
-- 
2.5.0



  reply	other threads:[~2016-02-11 21:09 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-10 18:55 [Cluster-devel] [DLM PATCH 0/6] Misc DLM Improvements Regarding Socket Errors Bob Peterson
2016-02-10 18:55 ` [Cluster-devel] [DLM PATCH 1/6] DLM: Don't create kernel socket until we have valid node address Bob Peterson
2016-02-10 18:55 ` [Cluster-devel] [DLM PATCH 2/6] DLM: Call original error report when socket is NULL Bob Peterson
2016-02-11 16:43   ` Andreas Gruenbacher
2016-02-10 18:55 ` [Cluster-devel] [DLM PATCH 3/6] DLM: Make consistent error path through tcp_create_listen_sock Bob Peterson
2016-02-11 16:52   ` Andreas Gruenbacher
2016-02-11 17:59     ` Bob Peterson
2016-02-11 21:09       ` Andreas Gruenbacher [this message]
2016-02-10 18:55 ` [Cluster-devel] [DLM PATCH 4/6] DLM: Eliminate useless goto Bob Peterson
2016-02-11 16:53   ` Andreas Gruenbacher
2016-02-10 18:55 ` [Cluster-devel] [DLM PATCH 5/6] DLM: Add locking to protect save callback assignments Bob Peterson
2016-02-11 17:04   ` Andreas Gruenbacher
2016-02-10 18:55 ` [Cluster-devel] [DLM PATCH 6/6] DLM: save / restore all socket callbacks Bob Peterson
2016-02-11 15:31   ` Steven Whitehouse
2016-02-11 16:43     ` [Cluster-devel] [DLM PATCH 6/6][try #2] " Bob Peterson
2016-02-11 17:10       ` Andreas Gruenbacher
2016-02-11 17:05 ` [Cluster-devel] [DLM PATCH 0/6] Misc DLM Improvements Regarding Socket Errors Andreas Gruenbacher
2016-02-11 17:22 ` David Teigland
2016-02-11 18:39   ` Bob Peterson
2016-02-11 18:59     ` David Teigland
2016-02-15 21:16     ` Bob Peterson
2016-02-15 21:24       ` David Teigland

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=1455224958-1274-1-git-send-email-agruenba@redhat.com \
    --to=agruenba@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).