FreeBSD Bugzilla – Attachment 182909 Details for
Bug 219551
Add support for DS Commits to the NFSv4.1/pNFS client
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Add DS commit support to the pNFS client
dscommit.patch (text/plain), 7.09 KB, created by
Rick Macklem
on 2017-05-25 20:11:13 UTC
(
hide
)
Description:
Add DS commit support to the pNFS client
Filename:
MIME Type:
Creator:
Rick Macklem
Created:
2017-05-25 20:11:13 UTC
Size:
7.09 KB
patch
obsolete
>--- sys/fs/nfs/nfs_var.h.savndscmt 2017-05-22 08:56:54.173839000 -0400 >+++ sys/fs/nfs/nfs_var.h 2017-05-22 08:57:09.568026000 -0400 >@@ -514,7 +514,7 @@ int nfsrpc_layoutreturn(struct nfsmount > int, uint64_t, uint64_t, nfsv4stateid_t *, int, uint32_t *, struct ucred *, > NFSPROC_T *, void *); > int nfsrpc_reclaimcomplete(struct nfsmount *, struct ucred *, NFSPROC_T *); >-int nfscl_doiods(vnode_t, struct uio *, int *, int *, uint32_t, >+int nfscl_doiods(vnode_t, struct uio *, int *, int *, uint32_t, int, > struct ucred *, NFSPROC_T *); > int nfscl_findlayoutforio(struct nfscllayout *, uint64_t, uint32_t, > struct nfsclflayout **); >--- sys/fs/nfsclient/nfs_clrpcops.c.savndscmt 2017-05-22 08:01:20.248932000 -0400 >+++ sys/fs/nfsclient/nfs_clrpcops.c 2017-05-22 09:21:02.589598000 -0400 >@@ -114,19 +114,18 @@ static int nfsrpc_fillsa(struct nfsmount > static void nfscl_initsessionslots(struct nfsclsession *); > static int nfscl_doflayoutio(vnode_t, struct uio *, int *, int *, int *, > nfsv4stateid_t *, int, struct nfscldevinfo *, struct nfscllayout *, >- struct nfsclflayout *, uint64_t, uint64_t, struct ucred *, NFSPROC_T *); >+ struct nfsclflayout *, uint64_t, uint64_t, int, struct ucred *, >+ NFSPROC_T *); > static int nfsrpc_readds(vnode_t, struct uio *, nfsv4stateid_t *, int *, > struct nfsclds *, uint64_t, int, struct nfsfh *, struct ucred *, > NFSPROC_T *); > static int nfsrpc_writeds(vnode_t, struct uio *, int *, int *, >- nfsv4stateid_t *, struct nfsclds *, uint64_t, int, >- struct nfsfh *, int, struct ucred *, NFSPROC_T *); >+ nfsv4stateid_t *, struct nfsclds *, uint64_t, int, struct nfsfh *, >+ int, struct ucred *, NFSPROC_T *); > static enum nfsclds_state nfscl_getsameserver(struct nfsmount *, > struct nfsclds *, struct nfsclds **); >-#ifdef notyet > static int nfsrpc_commitds(vnode_t, uint64_t, int, struct nfsclds *, >- struct nfsfh *, struct ucred *, NFSPROC_T *, void *); >-#endif >+ struct nfsfh *, struct ucred *, NFSPROC_T *); > static void nfsrv_setuplayoutget(struct nfsrv_descript *, int, uint64_t, > uint64_t, uint64_t, nfsv4stateid_t *, int, int); > static int nfsrv_parselayoutget(struct nfsrv_descript *, nfsv4stateid_t *, >@@ -5410,7 +5409,7 @@ nfscl_initsessionslots(struct nfsclsessi > */ > int > nfscl_doiods(vnode_t vp, struct uio *uiop, int *iomode, int *must_commit, >- uint32_t rwaccess, struct ucred *cred, NFSPROC_T *p) >+ uint32_t rwaccess, int docommit, struct ucred *cred, NFSPROC_T *p) > { > struct nfsnode *np = VTONFS(vp); > struct nfsmount *nmp = VFSTONFS(vnode_mount(vp)); >@@ -5494,7 +5493,8 @@ nfscl_doiods(vnode_t vp, struct uio *uio > if (dip != NULL) { > error = nfscl_doflayoutio(vp, uiop, iomode, > must_commit, &eof, &stateid, rwaccess, dip, >- layp, rflp, off, xfer, newcred, p); >+ layp, rflp, off, xfer, docommit, newcred, >+ p); > nfscl_reldevinfo(dip); > lastbyte = off + xfer - 1; > if (error == 0) { >@@ -5570,10 +5570,10 @@ static int > nfscl_doflayoutio(vnode_t vp, struct uio *uiop, int *iomode, int *must_commit, > int *eofp, nfsv4stateid_t *stateidp, int rwflag, struct nfscldevinfo *dp, > struct nfscllayout *lyp, struct nfsclflayout *flp, uint64_t off, >- uint64_t len, struct ucred *cred, NFSPROC_T *p) >+ uint64_t len, int docommit, struct ucred *cred, NFSPROC_T *p) > { > uint64_t io_off, rel_off, stripe_unit_size, transfer, xfer; >- int commit_thru_mds, error = 0, stripe_index, stripe_pos; >+ int commit_thru_mds, error, stripe_index, stripe_pos; > struct nfsnode *np; > struct nfsfh *fhp; > struct nfsclds **dspp; >@@ -5584,12 +5584,13 @@ nfscl_doflayoutio(vnode_t vp, struct uio > stripe_pos = (rel_off / stripe_unit_size + flp->nfsfl_stripe1) % > dp->nfsdi_stripecnt; > transfer = stripe_unit_size - (rel_off % stripe_unit_size); >+ error = 0; > > /* Loop around, doing I/O for each stripe unit. */ > while (len > 0 && error == 0) { > stripe_index = nfsfldi_stripeindex(dp, stripe_pos); > dspp = nfsfldi_addr(dp, stripe_index); >- if (len > transfer) >+ if (len > transfer && docommit == 0) > xfer = transfer; > else > xfer = len; >@@ -5613,11 +5614,33 @@ nfscl_doflayoutio(vnode_t vp, struct uio > fhp = np->n_fhp; > io_off = off; > } >- if ((flp->nfsfl_util & NFSFLAYUTIL_COMMIT_THRU_MDS) != 0) >+ if ((flp->nfsfl_util & NFSFLAYUTIL_COMMIT_THRU_MDS) != 0) { > commit_thru_mds = 1; >- else >+ if (docommit != 0) >+ error = EIO; >+ } else { > commit_thru_mds = 0; >- if (rwflag == FREAD) >+ mtx_lock(&np->n_mtx); >+ np->n_flag |= NDSCOMMIT; >+ mtx_unlock(&np->n_mtx); >+ } >+ if (docommit != 0) { >+ if (error == 0) >+ error = nfsrpc_commitds(vp, io_off, xfer, >+ *dspp, fhp, cred, p); >+ if (error == 0) { >+ /* >+ * Set both eof and uio_resid = 0 to end any >+ * loops. >+ */ >+ *eofp = 1; >+ uiop->uio_resid = 0; >+ } else { >+ mtx_lock(&np->n_mtx); >+ np->n_flag &= ~NDSCOMMIT; >+ mtx_unlock(&np->n_mtx); >+ } >+ } else if (rwflag == FREAD) > error = nfsrpc_readds(vp, uiop, stateidp, eofp, *dspp, > io_off, xfer, fhp, cred, p); > else { >@@ -5853,13 +5876,12 @@ nfscl_getsameserver(struct nfsmount *nmp > return (NFSDSP_NOTFOUND); > } > >-#ifdef notyet > /* >- * NFS commit rpc to a DS. >+ * NFS commit rpc to a NFSv4.1 DS. > */ > static int > nfsrpc_commitds(vnode_t vp, uint64_t offset, int cnt, struct nfsclds *dsp, >- struct nfsfh *fhp, struct ucred *cred, NFSPROC_T *p, void *stuff) >+ struct nfsfh *fhp, struct ucred *cred, NFSPROC_T *p) > { > uint32_t *tl; > struct nfsrv_descript nfsd, *nd = &nfsd; >@@ -5867,6 +5889,7 @@ nfsrpc_commitds(vnode_t vp, uint64_t off > struct nfssockreq *nrp; > int error; > >+ nd->nd_mrep = NULL; > nfscl_reqstart(nd, NFSPROC_COMMITDS, nmp, fhp->nfh_fh, fhp->nfh_len, > NULL, &dsp->nfsclds_sess); > NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + NFSX_UNSIGNED); >@@ -5879,7 +5902,7 @@ nfsrpc_commitds(vnode_t vp, uint64_t off > nrp = &nmp->nm_sockreq; > error = newnfs_request(nd, nmp, NULL, nrp, vp, p, cred, > NFS_PROG, NFS_VER4, NULL, 1, NULL, &dsp->nfsclds_sess); >- if (error) >+ if (error != 0) > return (error); > if (nd->nd_repstat == 0) { > NFSM_DISSECT(tl, u_int32_t *, NFSX_VERF); >@@ -5896,7 +5919,6 @@ nfsmout: > mbuf_freem(nd->nd_mrep); > return (error); > } >-#endif > > /* > * Set up the XDR arguments for the LayoutGet operation. >--- sys/fs/nfsclient/nfsnode.h.savndscmt 2017-05-22 07:48:37.491078000 -0400 >+++ sys/fs/nfsclient/nfsnode.h 2017-05-22 07:53:53.454367000 -0400 >@@ -158,6 +158,7 @@ struct nfsnode { > #define NNOLAYOUT 0x00020000 /* Can't get a layout for this file */ > #define NWRITEOPENED 0x00040000 /* Has been opened for writing */ > #define NHASBEENLOCKED 0x00080000 /* Has been file locked. */ >+#define NDSCOMMIT 0x00100000 /* Commit is done via the DS. */ > > /* > * Convert between nfsnode pointers and vnode pointers >--- sys/fs/nfsclient/nfs_clnode.c.savndscmt 2017-05-22 07:58:11.925171000 -0400 >+++ sys/fs/nfsclient/nfs_clnode.c 2017-05-22 07:58:42.208801000 -0400 >@@ -262,7 +262,7 @@ ncl_inactive(struct vop_inactive_args *a > * associated with the NFS vnode. None of the other flags are > * meaningful after the vnode is unused. > */ >- np->n_flag &= NMODIFIED; >+ np->n_flag &= (NMODIFIED | NDSCOMMIT); > mtx_unlock(&np->n_mtx); > return (0); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 219551
: 182909