Date: Wed, 16 Aug 2017 20:29:01 +0000 (UTC) From: Rick Macklem <rmacklem@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r322595 - projects/pnfs-planb-server/sys/fs/nfsserver Message-ID: <201708162029.v7GKT1Dh020655@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rmacklem Date: Wed Aug 16 20:29:00 2017 New Revision: 322595 URL: https://svnweb.freebsd.org/changeset/base/322595 Log: Cleanup of the code changes for support of mirrors. Mostly indentation changes and a few simplification of arguments. 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 Wed Aug 16 20:24:29 2017 (r322594) +++ projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdport.c Wed Aug 16 20:29:00 2017 (r322595) @@ -3803,8 +3803,8 @@ nfsrv_pnfscreate(struct vnode *vp, struct vattr *vap, tdsc->va = va; tdsc->dvp = dvp[i]; tdsc->haskproc = 1; - ret = kproc_create(start_dscreate, (void *)tdsc, NULL, - 0, 0, "nfsdpnfs"); + ret = kproc_create(start_dscreate, (void *)tdsc, NULL, 0, 0, + "nfsdpcr"); if (ret == 0) haskproc = 1; else { @@ -3929,8 +3929,7 @@ nfsrv_dsremove(struct vnode *dvp, char *fname, struct named.ni_cnd.cn_lkflags = LK_EXCLUSIVE | LK_RETRY; named.ni_cnd.cn_cred = tcred; named.ni_cnd.cn_thread = p; - named.ni_cnd.cn_flags = ISLASTCN | LOCKPARENT | LOCKLEAF | - SAVENAME; + named.ni_cnd.cn_flags = ISLASTCN | LOCKPARENT | LOCKLEAF | SAVENAME; nfsvno_setpathbuf(&named, &bufp, &hashp); named.ni_cnd.cn_nameptr = bufp; named.ni_cnd.cn_namelen = strlen(fname); @@ -3991,14 +3990,13 @@ nfsrv_pnfsremove(struct vnode **dvp, int mirrorcnt, ch tdsrm->dvp = dvp[i]; strlcpy(tdsrm->fname, fname, PNFS_FILENAME_LEN + 1); tdsrm->haskproc = 1; - ret = kproc_create(start_dsremove, (void *)tdsrm, NULL, - 0, 0, "nfsdpnfs"); + ret = kproc_create(start_dsremove, (void *)tdsrm, NULL, 0, 0, + "nfsdprm"); if (ret == 0) haskproc = 1; else { tdsrm->haskproc = 0; - nfsrv_dsremove(tdsrm->dvp, tdsrm->fname, tdsrm->tcred, - tdsrm->p); + nfsrv_dsremove(dvp[i], fname, tcred, p); } } nfsrv_dsremove(dvp[mirrorcnt - 1], fname, tcred, p); @@ -4422,25 +4420,35 @@ struct nfsrvwritedsdorpc { struct ucred *cred; NFSPROC_T *p; struct mbuf *m; - nfsv4stateid_t st; int haskproc; int err; }; static int nfsrv_writedsdorpc(struct nfsmount *nmp, fhandle_t *fhp, off_t off, int len, - nfsv4stateid_t *stp, struct nfsvattr *nap, struct mbuf *m, - struct ucred *cred, NFSPROC_T *p) + struct nfsvattr *nap, struct mbuf *m, struct ucred *cred, NFSPROC_T *p) { uint32_t *tl; struct nfsrv_descript *nd; nfsattrbit_t attrbits; + nfsv4stateid_t st; int commit, error, retlen; nd = malloc(sizeof(*nd), M_TEMP, M_WAITOK | M_ZERO); nfscl_reqstart(nd, NFSPROC_WRITE, nmp, (u_int8_t *)fhp, sizeof(fhandle_t), NULL, NULL); - nfsm_stateidtom(nd, stp, NFSSTATEID_PUTSTATEID); + + /* + * Use a stateid where other is an alternating 01010 pattern and + * seqid is 0xffffffff. This value is not defined as special by + * the RFC and is used by the FreeBSD NFS server to indicate an + * MDS->DS proxy operation. + */ + st.other[0] = 0x55555555; + st.other[1] = 0x55555555; + st.other[2] = 0x55555555; + st.seqid = 0xffffffff; + nfsm_stateidtom(nd, &st, NFSSTATEID_PUTSTATEID); NFSM_BUILD(tl, u_int32_t *, NFSX_HYPER + 2 * NFSX_UNSIGNED); txdr_hyper(off, tl); tl += 2; @@ -4483,9 +4491,8 @@ nfsrv_writedsdorpc(struct nfsmount *nmp, fhandle_t *fh /* Get rid of weak cache consistency data for now. */ if ((nd->nd_flag & (ND_NOMOREDATA | ND_NFSV4 | ND_V4WCCATTR)) == (ND_NFSV4 | ND_V4WCCATTR)) { - error = nfsv4_loadattr(nd, NULL, nap, NULL, - NULL, 0, NULL, NULL, NULL, NULL, NULL, 0, - NULL, NULL, NULL, NULL, NULL); + error = nfsv4_loadattr(nd, NULL, nap, NULL, NULL, 0, NULL, NULL, + NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL); NFSD_DEBUG(4, "nfsrv_writedsdorpc: wcc attr=%d\n", error); if (error != 0) goto nfsmout; @@ -4515,9 +4522,8 @@ nfsrv_writedsdorpc(struct nfsmount *nmp, fhandle_t *fh */ if (error == 0) { NFSM_DISSECT(tl, uint32_t *, 2 * NFSX_UNSIGNED); - error = nfsv4_loadattr(nd, NULL, nap, NULL, NULL, 0, - NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, - NULL, NULL); + error = nfsv4_loadattr(nd, NULL, nap, NULL, NULL, 0, NULL, NULL, + NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL); } NFSD_DEBUG(4, "nfsrv_writedsdorpc: aft loadattr=%d\n", error); nfsmout: @@ -4537,7 +4543,7 @@ start_writedsdorpc(void *arg) drpc = (struct nfsrvwritedsdorpc *)arg; drpc->err = nfsrv_writedsdorpc(drpc->nmp, &drpc->fh, drpc->off, - drpc->len, &drpc->st, NULL, drpc->m, drpc->cred, drpc->p); + drpc->len, NULL, drpc->m, drpc->cred, drpc->p); NFSDWRPCLOCK(); drpc->haskproc = 0; wakeup(drpc); @@ -4551,7 +4557,6 @@ nfsrv_writedsrpc(fhandle_t *fhp, off_t off, int len, s char *cp) { struct nfsrvwritedsdorpc *drpc, *tdrpc; - nfsv4stateid_t st; struct nfsvattr na; struct mbuf *m; int error, haskproc, i, offs, ret, mirrorcnt = 1; @@ -4568,24 +4573,12 @@ nfsrv_writedsrpc(fhandle_t *fhp, off_t off, int len, s NFSD_DEBUG(4, "nfsrv_writedsrpc: mcopy offs=%d len=%d\n", offs, len); /* - * Use a stateid where other is an alternating 01010 pattern and - * seqid is 0xffffffff. This value is not defined as special by - * the RFC and is used by the FreeBSD NFS server to indicate an - * MDS->DS proxy operation. - */ - st.other[0] = 0x55555555; - st.other[1] = 0x55555555; - st.other[2] = 0x55555555; - st.seqid = 0xffffffff; - - /* * Do the write RPC for every DS, using a separate kernel process * for every DS except the last one. */ haskproc = 0; error = 0; for (i = 0; i < mirrorcnt - 1; i++, tdrpc++) { - tdrpc->st = st; tdrpc->fh = *fhp; tdrpc->off = off; tdrpc->len = len; @@ -4594,20 +4587,20 @@ nfsrv_writedsrpc(fhandle_t *fhp, off_t off, int len, s tdrpc->p = p; tdrpc->m = m_copym(*mpp, offs, NFSM_RNDUP(len), M_WAITOK); tdrpc->haskproc = 1; - ret = kproc_create(start_writedsdorpc, (void *)tdrpc, - NULL, 0, 0, "nfsdpnfs"); + ret = kproc_create(start_writedsdorpc, (void *)tdrpc, NULL, 0, + 0, "nfsdpw"); if (ret == 0) haskproc = 1; else { tdrpc->haskproc = 0; - ret = nfsrv_writedsdorpc(nmp, fhp, off, len, &st, NULL, + ret = nfsrv_writedsdorpc(nmp, fhp, off, len, NULL, tdrpc->m, cred, p); if (error == 0 && ret != 0) error = ret; } } m = m_copym(*mpp, offs, NFSM_RNDUP(len), M_WAITOK); - ret = nfsrv_writedsdorpc(nmp, fhp, off, len, &st, &na, m, cred, p); + ret = nfsrv_writedsdorpc(nmp, fhp, off, len, &na, m, cred, p); if (error == 0 && ret != 0) error = ret; if (error == 0)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201708162029.v7GKT1Dh020655>