Date: Fri, 29 Jun 2018 01:06:48 +0000 (UTC) From: Rick Macklem <rmacklem@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r335789 - projects/pnfs-planb-server/sys/fs/nfsserver Message-ID: <201806290106.w5T16m4T079235@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rmacklem Date: Fri Jun 29 01:06:47 2018 New Revision: 335789 URL: https://svnweb.freebsd.org/changeset/base/335789 Log: Fix a bug that was introduced by the recent addition of the "#<mds-path" optional suffix and the fact that I didn't realize that TAILQ_FOREACH_FROM() will start at the beginning of the list if the first argument == NULL when it is called. Modified: projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdport.c Modified: projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdport.c Thu Jun 28 22:24:16 2018 (r335788) +++ projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdport.c Fri Jun 29 01:06:47 2018 (r335789) @@ -3881,8 +3881,8 @@ nfsrv_pnfscreate(struct vnode *vp, struct vattr *vap, i = dsdir[0] = ds->nfsdev_nextdir; ds->nfsdev_nextdir = (ds->nfsdev_nextdir + 1) % nfsrv_dsdirsize; dvp[0] = ds->nfsdev_dsdir[i]; - if (nfsrv_maxpnfsmirror > 1) { - mds = TAILQ_NEXT(ds, nfsdev_list); + mds = TAILQ_NEXT(ds, nfsdev_list); + if (nfsrv_maxpnfsmirror > 1 && mds != NULL) { TAILQ_FOREACH_FROM(mds, &nfsrv_devidhead, nfsdev_list) { if (mds->nfsdev_nmp != NULL && (mds->nfsdev_mdsisset == 0 || @@ -3906,7 +3906,8 @@ nfsrv_pnfscreate(struct vnode *vp, struct vattr *vap, if (mirrorcnt > 1) tdsc = dsc = malloc(sizeof(*dsc) * (mirrorcnt - 1), M_TEMP, M_WAITOK | M_ZERO); - tpf = pf = malloc(sizeof(*pf) * mirrorcnt, M_TEMP, M_WAITOK | M_ZERO); + tpf = pf = malloc(sizeof(*pf) * nfsrv_maxpnfsmirror, M_TEMP, M_WAITOK | + M_ZERO); error = nfsvno_getfh(vp, &fh, p); if (error == 0) @@ -4014,11 +4015,27 @@ nfsrv_pnfscreate(struct vnode *vp, struct vattr *vap, NFSFREECRED(tcred); if (error == 0) { ASSERT_VOP_ELOCKED(vp, "nfsrv_pnfscreate vp"); + + NFSD_DEBUG(4, "nfsrv_pnfscreate: mirrorcnt=%d maxmirror=%d\n", + mirrorcnt, nfsrv_maxpnfsmirror); + /* + * For all mirrors that couldn't be created, fill in the + * *pf structure, but with an IP address == 0.0.0.0. + */ + tpf = pf + mirrorcnt; + for (i = mirrorcnt; i < nfsrv_maxpnfsmirror; i++, tpf++) { + *tpf = *pf; + tpf->dsf_sin.sin_family = AF_INET; + tpf->dsf_sin.sin_len = sizeof(struct sockaddr_in); + tpf->dsf_sin.sin_addr.s_addr = 0; + tpf->dsf_sin.sin_port = 0; + } + error = vn_start_write(vp, &mp, V_WAIT); if (error == 0) { error = vn_extattr_set(vp, IO_NODELOCKED, EXTATTR_NAMESPACE_SYSTEM, "pnfsd.dsfile", - sizeof(*pf) * mirrorcnt, (char *)pf, p); + sizeof(*pf) * nfsrv_maxpnfsmirror, (char *)pf, p); if (error == 0) error = vn_extattr_set(vp, IO_NODELOCKED, EXTATTR_NAMESPACE_SYSTEM, "pnfsd.dsattr",
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806290106.w5T16m4T079235>