diff mbox

[2/2] supress socket error when address family is not supported

Message ID 20110517045217.29020.46681.stgit@notabene.brown (mailing list archive)
State New, archived
Headers show

Commit Message

NeilBrown May 17, 2011, 4:52 a.m. UTC
From: Suresh Jayaraman <sjayaraman@suse.de>

It was observed that when ipv6 module was not loaded and cannot be auto-loaded,
when starting NFS server, the following error occurs:
	"rpc.nfsd: unable to create inet6 TCP socket: errno 97 (Address
	family not supported by protocol)"

This is obviously a true message, but does not represent an "error" when ipv6
is not enabled.  Rather, it is an expected condition.  As such, it can be
confusing / misleading / distracting to display it in this scenario.

This patch instead of throwing error when a socket call fails with
EAFNOSUPPORT, makes it as a NOTICE.

Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de>
Signed-off-by: Neil Brown <neilb@suse.de>
---

 utils/nfsd/nfssvc.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)



--
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

Comments

Mi Jinlong May 17, 2011, 6:38 a.m. UTC | #1
Taousif_Ansari@DELLTEAM.com ??:
> Hi,
> 
> I have exported one directory from my server it is /export and my /etc/export file looks like
> 
> /export *(rw,fsid=0,sync,pnfs,insecure,no_root_squash,no_subtree_check)
> 
> At client
> tsf@client]# mount -t nfs4 -o minorversion=1 <server-ip>:/export /mnt
> Mount.nfs4: mounting <server-ip>:/export filed, reason given by server: No such file or directory.

 You should mount NFS4 as:
  # mount -t nfs4 -o minorversion=1 <server-ip>:/ /mnt

 Don't add the export dir after server-ip.

> 
> Instead, if I use simple mount then it is succeeding
> tsf@client]# mount <server-ip>:/export /mnt

 As this, you mount nfs success through NFSv3.
Steve Dickson May 23, 2011, 12:26 p.m. UTC | #2
On 05/17/2011 12:52 AM, Neil Brown wrote:
> From: Suresh Jayaraman <sjayaraman@suse.de>
> 
> It was observed that when ipv6 module was not loaded and cannot be auto-loaded,
> when starting NFS server, the following error occurs:
> 	"rpc.nfsd: unable to create inet6 TCP socket: errno 97 (Address
> 	family not supported by protocol)"
> 
> This is obviously a true message, but does not represent an "error" when ipv6
> is not enabled.  Rather, it is an expected condition.  As such, it can be
> confusing / misleading / distracting to display it in this scenario.
> 
> This patch instead of throwing error when a socket call fails with
> EAFNOSUPPORT, makes it as a NOTICE.
> 
> Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de>
> Signed-off-by: Neil Brown <neilb@suse.de>
> ---
> 
>  utils/nfsd/nfssvc.c |    9 +++++++--
>  1 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/utils/nfsd/nfssvc.c b/utils/nfsd/nfssvc.c
> index ea36399..f607214 100644
> --- a/utils/nfsd/nfssvc.c
> +++ b/utils/nfsd/nfssvc.c
> @@ -174,8 +174,13 @@ nfssvc_setfds(const struct addrinfo *hints, const char *node, const char *port)
>  		sockfd = socket(addr->ai_family, addr->ai_socktype,
>  				addr->ai_protocol);
>  		if (sockfd < 0) {
> -			xlog(L_ERROR, "unable to create %s %s socket: "
> -				"errno %d (%m)", family, proto, errno);
> +			if (errno == EAFNOSUPPORT)
> +				xlog(L_NOTICE, "address family %s not "
> +						"supported by protocol %s",
> +						family, proto);
> +			else
> +				xlog(L_ERROR, "unable to create %s %s socket: "
> +				     "errno %d (%m)", family, proto, errno);
>  			rc = errno;
>  			goto error;
>  		}
> 
> 
Committed...

steved.
--
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 ea36399..f607214 100644
--- a/utils/nfsd/nfssvc.c
+++ b/utils/nfsd/nfssvc.c
@@ -174,8 +174,13 @@  nfssvc_setfds(const struct addrinfo *hints, const char *node, const char *port)
 		sockfd = socket(addr->ai_family, addr->ai_socktype,
 				addr->ai_protocol);
 		if (sockfd < 0) {
-			xlog(L_ERROR, "unable to create %s %s socket: "
-				"errno %d (%m)", family, proto, errno);
+			if (errno == EAFNOSUPPORT)
+				xlog(L_NOTICE, "address family %s not "
+						"supported by protocol %s",
+						family, proto);
+			else
+				xlog(L_ERROR, "unable to create %s %s socket: "
+				     "errno %d (%m)", family, proto, errno);
 			rc = errno;
 			goto error;
 		}