Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1733427 > unrolled thread

[PATCH] dlm: Reuse existing error handling path

Started byChristophe JAILLET <christophe.jaillet@wanadoo.fr>
First post2017-09-17 11:50 +0200
Last post2017-09-17 11:50 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] dlm: Reuse existing error handling path Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2017-09-17 11:50 +0200

#1733427 — [PATCH] dlm: Reuse existing error handling path

FromChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Date2017-09-17 11:50 +0200
Subject[PATCH] dlm: Reuse existing error handling path
Message-ID<uqEn7-6aY-3@gated-at.bofh.it>
The error handling path at label 'accept_err' already performs these
'sock_release()' and 'mutex_unlock()' calls. The order is reversed, but
it is not important.
So avoid code duplication and 'goto accept_err'.

While at it, add some missing spaces around a '='.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Instead of returning the magic number -1, we could also propagate the
return value of 'addr_to_nodeid()', that is to say -EEXIST
---
 fs/dlm/lowcomms.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index 4813d0e0cd9b..cd9305b17ad5 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -758,13 +758,12 @@ static int tcp_accept_from_sock(struct connection *con)
 	/* Get the new node's NODEID */
 	make_sockaddr(&peeraddr, 0, &len);
 	if (addr_to_nodeid(&peeraddr, &nodeid)) {
-		unsigned char *b=(unsigned char *)&peeraddr;
+		unsigned char *b = (unsigned char *)&peeraddr;
 		log_print("connect from non cluster node");
 		print_hex_dump_bytes("ss: ", DUMP_PREFIX_NONE, 
 				     b, sizeof(struct sockaddr_storage));
-		sock_release(newsock);
-		mutex_unlock(&con->sock_mutex);
-		return -1;
+		result = -1;
+		goto accept_err;
 	}
 
 	log_print("got connection from %d", nodeid);
-- 
2.11.0

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web