[PATCH v3 11/14] nfsd: support vsock xprt creation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



nfs-utils will write the vsock address details to /proc/fs/nfsd/portlist
to start listening for NFS client connections.

Signed-off-by: Stefan Hajnoczi <stefanha@xxxxxxxxxx>
---
 fs/nfsd/nfsctl.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 6493df6..1b71c28 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -768,15 +768,22 @@ static ssize_t __write_ports_addxprt(char *buf, struct net *net)
 	if (err != 0)
 		return err;
 
-	err = svc_create_xprt(nn->nfsd_serv, transport, net,
-				PF_INET, port, SVC_SOCK_ANONYMOUS);
-	if (err < 0)
-		goto out_err;
+	if (!strcmp(transport, "vsock")) {
+		err = svc_create_xprt(nn->nfsd_serv, transport, net,
+					AF_VSOCK, port, SVC_SOCK_ANONYMOUS);
+		if (err < 0)
+			goto out_err;
+	} else {
+		err = svc_create_xprt(nn->nfsd_serv, transport, net,
+					PF_INET, port, SVC_SOCK_ANONYMOUS);
+		if (err < 0)
+			goto out_err;
 
-	err = svc_create_xprt(nn->nfsd_serv, transport, net,
-				PF_INET6, port, SVC_SOCK_ANONYMOUS);
-	if (err < 0 && err != -EAFNOSUPPORT)
-		goto out_close;
+		err = svc_create_xprt(nn->nfsd_serv, transport, net,
+					PF_INET6, port, SVC_SOCK_ANONYMOUS);
+		if (err < 0 && err != -EAFNOSUPPORT)
+			goto out_close;
+	}
 
 	/* Decrease the count, but don't shut down the service */
 	nn->nfsd_serv->sv_nrthreads--;
-- 
2.9.4

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux