diff mbox

rpc.nfsd: Do not fail when all address families are not support.

Message ID 20171002142033.25493-1-steved@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Steve Dickson Oct. 2, 2017, 2:20 p.m. UTC
Commit 2f8a6020 introduce a regression causing rpc.nfsd
to fail when IPv6 is not supported. rpc.nfsd should not
fail when there is at least one bounded socket.

Signed-off-by: Steve Dickson <steved@redhat.com>
---
 utils/nfsd/nfssvc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Steve Dickson Oct. 5, 2017, 2:56 p.m. UTC | #1
On 10/02/2017 10:20 AM, Steve Dickson wrote:
> Commit 2f8a6020 introduce a regression causing rpc.nfsd
> to fail when IPv6 is not supported. rpc.nfsd should not
> fail when there is at least one bounded socket.
> 
> Signed-off-by: Steve Dickson <steved@redhat.com>
Committed.... 

steved.
> ---
>  utils/nfsd/nfssvc.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/utils/nfsd/nfssvc.c b/utils/nfsd/nfssvc.c
> index e8609c1..fc36792 100644
> --- a/utils/nfsd/nfssvc.c
> +++ b/utils/nfsd/nfssvc.c
> @@ -112,7 +112,7 @@ static int
>  nfssvc_setfds(const struct addrinfo *hints, const char *node, const char *port)
>  {
>  	int fd, on = 1, fac = L_ERROR;
> -	int sockfd = -1, rc = 0;
> +	int sockfd = -1, rc = 0, bounded = 0;
>  	struct addrinfo *addrhead = NULL, *addr;
>  	char *proto, *family;
>  
> @@ -233,6 +233,8 @@ nfssvc_setfds(const struct addrinfo *hints, const char *node, const char *port)
>  			rc = errno;
>  			goto error;
>  		}
> +		bounded++;
> +
>  		close(fd);
>  		close(sockfd);
>  		sockfd = fd = -1;
> @@ -245,7 +247,7 @@ error:
>  		close(sockfd);
>  	if (addrhead)
>  		freeaddrinfo(addrhead);
> -	return rc;
> +	return (bounded ? 0 : rc);
>  }
>  
>  int
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/utils/nfsd/nfssvc.c b/utils/nfsd/nfssvc.c
index e8609c1..fc36792 100644
--- a/utils/nfsd/nfssvc.c
+++ b/utils/nfsd/nfssvc.c
@@ -112,7 +112,7 @@  static int
 nfssvc_setfds(const struct addrinfo *hints, const char *node, const char *port)
 {
 	int fd, on = 1, fac = L_ERROR;
-	int sockfd = -1, rc = 0;
+	int sockfd = -1, rc = 0, bounded = 0;
 	struct addrinfo *addrhead = NULL, *addr;
 	char *proto, *family;
 
@@ -233,6 +233,8 @@  nfssvc_setfds(const struct addrinfo *hints, const char *node, const char *port)
 			rc = errno;
 			goto error;
 		}
+		bounded++;
+
 		close(fd);
 		close(sockfd);
 		sockfd = fd = -1;
@@ -245,7 +247,7 @@  error:
 		close(sockfd);
 	if (addrhead)
 		freeaddrinfo(addrhead);
-	return rc;
+	return (bounded ? 0 : rc);
 }
 
 int