svn commit: r321061 - in projects/pnfs-planb-server/sys/fs: nfs nfsserver
Rick Macklem
rmacklem at FreeBSD.org
Sun Jul 16 21:04:00 UTC 2017
Author: rmacklem
Date: Sun Jul 16 21:03:58 2017
New Revision: 321061
URL: https://svnweb.freebsd.org/changeset/base/321061
Log:
Fix the server so that nfssvc() returns ENXIO when the "-p" option is
misconfigured.
Modified:
projects/pnfs-planb-server/sys/fs/nfs/nfs_var.h
projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdkrpc.c
projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c
Modified: projects/pnfs-planb-server/sys/fs/nfs/nfs_var.h
==============================================================================
--- projects/pnfs-planb-server/sys/fs/nfs/nfs_var.h Sun Jul 16 21:03:26 2017 (r321060)
+++ projects/pnfs-planb-server/sys/fs/nfs/nfs_var.h Sun Jul 16 21:03:58 2017 (r321061)
@@ -148,7 +148,7 @@ int nfsrv_layoutreturn(struct nfsrv_descript *, vnode_
NFSPROC_T *);
int nfsrv_getdevinfo(char *, int, uint32_t *, uint32_t *, int *, char **);
void nfsrv_freealllayoutsanddevids(void);
-void nfsrv_createdevids(struct nfsd_nfsd_args *, NFSPROC_T *);
+int nfsrv_createdevids(struct nfsd_nfsd_args *, NFSPROC_T *);
int nfsrv_checkdsattr(struct nfsrv_descript *, vnode_t, NFSPROC_T *);
/* nfs_nfsdserv.c */
Modified: projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdkrpc.c
==============================================================================
--- projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdkrpc.c Sun Jul 16 21:03:26 2017 (r321060)
+++ projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdkrpc.c Sun Jul 16 21:03:58 2017 (r321061)
@@ -502,32 +502,36 @@ nfsrvd_nfsd(struct thread *td, struct nfsd_nfsd_args *
newnfs_numnfsd++;
NFSD_UNLOCK();
- nfsrv_createdevids(args, td);
-
- /* An empty string implies AUTH_SYS only. */
- if (principal[0] != '\0') {
- ret2 = rpc_gss_set_svc_name_call(principal,
- "kerberosv5", GSS_C_INDEFINITE, NFS_PROG, NFS_VER2);
- ret3 = rpc_gss_set_svc_name_call(principal,
- "kerberosv5", GSS_C_INDEFINITE, NFS_PROG, NFS_VER3);
- ret4 = rpc_gss_set_svc_name_call(principal,
- "kerberosv5", GSS_C_INDEFINITE, NFS_PROG, NFS_VER4);
-
- if (!ret2 || !ret3 || !ret4)
- printf("nfsd: can't register svc name\n");
+ error = nfsrv_createdevids(args, td);
+ if (error == 0) {
+ /* An empty string implies AUTH_SYS only. */
+ if (principal[0] != '\0') {
+ ret2 = rpc_gss_set_svc_name_call(principal,
+ "kerberosv5", GSS_C_INDEFINITE, NFS_PROG,
+ NFS_VER2);
+ ret3 = rpc_gss_set_svc_name_call(principal,
+ "kerberosv5", GSS_C_INDEFINITE, NFS_PROG,
+ NFS_VER3);
+ ret4 = rpc_gss_set_svc_name_call(principal,
+ "kerberosv5", GSS_C_INDEFINITE, NFS_PROG,
+ NFS_VER4);
+
+ if (!ret2 || !ret3 || !ret4)
+ printf(
+ "nfsd: can't register svc name\n");
+ }
+
+ nfsrvd_pool->sp_minthreads = args->minthreads;
+ nfsrvd_pool->sp_maxthreads = args->maxthreads;
+
+ svc_run(nfsrvd_pool);
+
+ if (principal[0] != '\0') {
+ rpc_gss_clear_svc_name_call(NFS_PROG, NFS_VER2);
+ rpc_gss_clear_svc_name_call(NFS_PROG, NFS_VER3);
+ rpc_gss_clear_svc_name_call(NFS_PROG, NFS_VER4);
+ }
}
-
- nfsrvd_pool->sp_minthreads = args->minthreads;
- nfsrvd_pool->sp_maxthreads = args->maxthreads;
-
- svc_run(nfsrvd_pool);
-
- if (principal[0] != '\0') {
- rpc_gss_clear_svc_name_call(NFS_PROG, NFS_VER2);
- rpc_gss_clear_svc_name_call(NFS_PROG, NFS_VER3);
- rpc_gss_clear_svc_name_call(NFS_PROG, NFS_VER4);
- }
-
NFSD_LOCK();
newnfs_numnfsd--;
nfsrvd_init(1);
Modified: projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c
==============================================================================
--- projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c Sun Jul 16 21:03:26 2017 (r321060)
+++ projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c Sun Jul 16 21:03:58 2017 (r321061)
@@ -6775,8 +6775,10 @@ nfsrv_allocdevid(struct nfsdevice *ds, char *addr, cha
/*
* Create the device id list.
+ * Return 0 if the nfsd threads are to run and ENXIO if the "-p" argument
+ * is misconfigured.
*/
-void
+int
nfsrv_createdevids(struct nfsd_nfsd_args *args, NFSPROC_T *p)
{
struct nfsdevice *ds;
@@ -6787,7 +6789,7 @@ nfsrv_createdevids(struct nfsd_nfsd_args *args, NFSPRO
dnshostp = args->dnshost;
dspathp = args->dspath;
if (addrp == NULL || dnshostp == NULL || dspathp == NULL)
- return;
+ return (0);
/*
* Loop around for each nul-terminated string in args->addr and
@@ -6800,13 +6802,14 @@ nfsrv_createdevids(struct nfsd_nfsd_args *args, NFSPRO
if (error != 0) {
/* Free all DS servers. */
nfsrv_freealldevids();
- return;
+ return (ENXIO);
}
nfsrv_allocdevid(ds, addrp, dnshostp);
addrp += (strlen(addrp) + 1);
dnshostp += (strlen(dnshostp) + 1);
dspathp += (strlen(dspathp) + 1);
}
+ return (0);
}
/*
More information about the svn-src-projects
mailing list