View | Details | Raw Unified | Return to bug 219551
Collapse All | Expand All

(-)sys/fs/nfs/nfs_var.h (-1 / +1 lines)
Lines 514-520 int nfsrpc_layoutreturn(struct nfsmount Link Here
514
    int, uint64_t, uint64_t, nfsv4stateid_t *, int, uint32_t *, struct ucred *,
514
    int, uint64_t, uint64_t, nfsv4stateid_t *, int, uint32_t *, struct ucred *,
515
    NFSPROC_T *, void *);
515
    NFSPROC_T *, void *);
516
int nfsrpc_reclaimcomplete(struct nfsmount *, struct ucred *, NFSPROC_T *);
516
int nfsrpc_reclaimcomplete(struct nfsmount *, struct ucred *, NFSPROC_T *);
517
int nfscl_doiods(vnode_t, struct uio *, int *, int *, uint32_t,
517
int nfscl_doiods(vnode_t, struct uio *, int *, int *, uint32_t, int,
518
    struct ucred *, NFSPROC_T *);
518
    struct ucred *, NFSPROC_T *);
519
int nfscl_findlayoutforio(struct nfscllayout *, uint64_t, uint32_t,
519
int nfscl_findlayoutforio(struct nfscllayout *, uint64_t, uint32_t,
520
    struct nfsclflayout **);
520
    struct nfsclflayout **);
(-)sys/fs/nfsclient/nfs_clrpcops.c (-19 / +41 lines)
Lines 114-132 static int nfsrpc_fillsa(struct nfsmount Link Here
114
static void nfscl_initsessionslots(struct nfsclsession *);
114
static void nfscl_initsessionslots(struct nfsclsession *);
115
static int nfscl_doflayoutio(vnode_t, struct uio *, int *, int *, int *,
115
static int nfscl_doflayoutio(vnode_t, struct uio *, int *, int *, int *,
116
    nfsv4stateid_t *, int, struct nfscldevinfo *, struct nfscllayout *,
116
    nfsv4stateid_t *, int, struct nfscldevinfo *, struct nfscllayout *,
117
    struct nfsclflayout *, uint64_t, uint64_t, struct ucred *, NFSPROC_T *);
117
    struct nfsclflayout *, uint64_t, uint64_t, int, struct ucred *,
118
    NFSPROC_T *);
118
static int nfsrpc_readds(vnode_t, struct uio *, nfsv4stateid_t *, int *,
119
static int nfsrpc_readds(vnode_t, struct uio *, nfsv4stateid_t *, int *,
119
    struct nfsclds *, uint64_t, int, struct nfsfh *, struct ucred *,
120
    struct nfsclds *, uint64_t, int, struct nfsfh *, struct ucred *,
120
    NFSPROC_T *);
121
    NFSPROC_T *);
121
static int nfsrpc_writeds(vnode_t, struct uio *, int *, int *,
122
static int nfsrpc_writeds(vnode_t, struct uio *, int *, int *,
122
    nfsv4stateid_t *, struct nfsclds *, uint64_t, int,
123
    nfsv4stateid_t *, struct nfsclds *, uint64_t, int, struct nfsfh *,
123
    struct nfsfh *, int, struct ucred *, NFSPROC_T *);
124
    int, struct ucred *, NFSPROC_T *);
124
static enum nfsclds_state nfscl_getsameserver(struct nfsmount *,
125
static enum nfsclds_state nfscl_getsameserver(struct nfsmount *,
125
    struct nfsclds *, struct nfsclds **);
126
    struct nfsclds *, struct nfsclds **);
126
#ifdef notyet
127
static int nfsrpc_commitds(vnode_t, uint64_t, int, struct nfsclds *,
127
static int nfsrpc_commitds(vnode_t, uint64_t, int, struct nfsclds *,
128
    struct nfsfh *, struct ucred *, NFSPROC_T *, void *);
128
    struct nfsfh *, struct ucred *, NFSPROC_T *);
129
#endif
130
static void nfsrv_setuplayoutget(struct nfsrv_descript *, int, uint64_t,
129
static void nfsrv_setuplayoutget(struct nfsrv_descript *, int, uint64_t,
131
    uint64_t, uint64_t, nfsv4stateid_t *, int, int);
130
    uint64_t, uint64_t, nfsv4stateid_t *, int, int);
132
static int nfsrv_parselayoutget(struct nfsrv_descript *, nfsv4stateid_t *,
131
static int nfsrv_parselayoutget(struct nfsrv_descript *, nfsv4stateid_t *,
Lines 5410-5416 nfscl_initsessionslots(struct nfsclsessi Link Here
5410
 */
5409
 */
5411
int
5410
int
5412
nfscl_doiods(vnode_t vp, struct uio *uiop, int *iomode, int *must_commit,
5411
nfscl_doiods(vnode_t vp, struct uio *uiop, int *iomode, int *must_commit,
5413
    uint32_t rwaccess, struct ucred *cred, NFSPROC_T *p)
5412
    uint32_t rwaccess, int docommit, struct ucred *cred, NFSPROC_T *p)
5414
{
5413
{
5415
	struct nfsnode *np = VTONFS(vp);
5414
	struct nfsnode *np = VTONFS(vp);
5416
	struct nfsmount *nmp = VFSTONFS(vnode_mount(vp));
5415
	struct nfsmount *nmp = VFSTONFS(vnode_mount(vp));
Lines 5494-5500 nfscl_doiods(vnode_t vp, struct uio *uio Link Here
5494
			if (dip != NULL) {
5493
			if (dip != NULL) {
5495
				error = nfscl_doflayoutio(vp, uiop, iomode,
5494
				error = nfscl_doflayoutio(vp, uiop, iomode,
5496
				    must_commit, &eof, &stateid, rwaccess, dip,
5495
				    must_commit, &eof, &stateid, rwaccess, dip,
5497
				    layp, rflp, off, xfer, newcred, p);
5496
				    layp, rflp, off, xfer, docommit, newcred,
5497
				    p);
5498
				nfscl_reldevinfo(dip);
5498
				nfscl_reldevinfo(dip);
5499
				lastbyte = off + xfer - 1;
5499
				lastbyte = off + xfer - 1;
5500
				if (error == 0) {
5500
				if (error == 0) {
Lines 5570-5579 static int Link Here
5570
nfscl_doflayoutio(vnode_t vp, struct uio *uiop, int *iomode, int *must_commit,
5570
nfscl_doflayoutio(vnode_t vp, struct uio *uiop, int *iomode, int *must_commit,
5571
    int *eofp, nfsv4stateid_t *stateidp, int rwflag, struct nfscldevinfo *dp,
5571
    int *eofp, nfsv4stateid_t *stateidp, int rwflag, struct nfscldevinfo *dp,
5572
    struct nfscllayout *lyp, struct nfsclflayout *flp, uint64_t off,
5572
    struct nfscllayout *lyp, struct nfsclflayout *flp, uint64_t off,
5573
    uint64_t len, struct ucred *cred, NFSPROC_T *p)
5573
    uint64_t len, int docommit, struct ucred *cred, NFSPROC_T *p)
5574
{
5574
{
5575
	uint64_t io_off, rel_off, stripe_unit_size, transfer, xfer;
5575
	uint64_t io_off, rel_off, stripe_unit_size, transfer, xfer;
5576
	int commit_thru_mds, error = 0, stripe_index, stripe_pos;
5576
	int commit_thru_mds, error, stripe_index, stripe_pos;
5577
	struct nfsnode *np;
5577
	struct nfsnode *np;
5578
	struct nfsfh *fhp;
5578
	struct nfsfh *fhp;
5579
	struct nfsclds **dspp;
5579
	struct nfsclds **dspp;
Lines 5584-5595 nfscl_doflayoutio(vnode_t vp, struct uio Link Here
5584
	stripe_pos = (rel_off / stripe_unit_size + flp->nfsfl_stripe1) %
5584
	stripe_pos = (rel_off / stripe_unit_size + flp->nfsfl_stripe1) %
5585
	    dp->nfsdi_stripecnt;
5585
	    dp->nfsdi_stripecnt;
5586
	transfer = stripe_unit_size - (rel_off % stripe_unit_size);
5586
	transfer = stripe_unit_size - (rel_off % stripe_unit_size);
5587
	error = 0;
5587
5588
5588
	/* Loop around, doing I/O for each stripe unit. */
5589
	/* Loop around, doing I/O for each stripe unit. */
5589
	while (len > 0 && error == 0) {
5590
	while (len > 0 && error == 0) {
5590
		stripe_index = nfsfldi_stripeindex(dp, stripe_pos);
5591
		stripe_index = nfsfldi_stripeindex(dp, stripe_pos);
5591
		dspp = nfsfldi_addr(dp, stripe_index);
5592
		dspp = nfsfldi_addr(dp, stripe_index);
5592
		if (len > transfer)
5593
		if (len > transfer && docommit == 0)
5593
			xfer = transfer;
5594
			xfer = transfer;
5594
		else
5595
		else
5595
			xfer = len;
5596
			xfer = len;
Lines 5613-5623 nfscl_doflayoutio(vnode_t vp, struct uio Link Here
5613
				fhp = np->n_fhp;
5614
				fhp = np->n_fhp;
5614
			io_off = off;
5615
			io_off = off;
5615
		}
5616
		}
5616
		if ((flp->nfsfl_util & NFSFLAYUTIL_COMMIT_THRU_MDS) != 0)
5617
		if ((flp->nfsfl_util & NFSFLAYUTIL_COMMIT_THRU_MDS) != 0) {
5617
			commit_thru_mds = 1;
5618
			commit_thru_mds = 1;
5618
		else
5619
			if (docommit != 0)
5620
				error = EIO;
5621
		} else {
5619
			commit_thru_mds = 0;
5622
			commit_thru_mds = 0;
5620
		if (rwflag == FREAD)
5623
			mtx_lock(&np->n_mtx);
5624
			np->n_flag |= NDSCOMMIT;
5625
			mtx_unlock(&np->n_mtx);
5626
		}
5627
		if (docommit != 0) {
5628
			if (error == 0)
5629
				error = nfsrpc_commitds(vp, io_off, xfer,
5630
				    *dspp, fhp, cred, p);
5631
			if (error == 0) {
5632
				/*
5633
				 * Set both eof and uio_resid = 0 to end any
5634
				 * loops.
5635
				 */
5636
				*eofp = 1;
5637
				uiop->uio_resid = 0;
5638
			} else {
5639
				mtx_lock(&np->n_mtx);
5640
				np->n_flag &= ~NDSCOMMIT;
5641
				mtx_unlock(&np->n_mtx);
5642
			}
5643
		} else if (rwflag == FREAD)
5621
			error = nfsrpc_readds(vp, uiop, stateidp, eofp, *dspp,
5644
			error = nfsrpc_readds(vp, uiop, stateidp, eofp, *dspp,
5622
			    io_off, xfer, fhp, cred, p);
5645
			    io_off, xfer, fhp, cred, p);
5623
		else {
5646
		else {
Lines 5853-5865 nfscl_getsameserver(struct nfsmount *nmp Link Here
5853
	return (NFSDSP_NOTFOUND);
5876
	return (NFSDSP_NOTFOUND);
5854
}
5877
}
5855
5878
5856
#ifdef notyet
5857
/*
5879
/*
5858
 * NFS commit rpc to a DS.
5880
 * NFS commit rpc to a NFSv4.1 DS.
5859
 */
5881
 */
5860
static int
5882
static int
5861
nfsrpc_commitds(vnode_t vp, uint64_t offset, int cnt, struct nfsclds *dsp,
5883
nfsrpc_commitds(vnode_t vp, uint64_t offset, int cnt, struct nfsclds *dsp,
5862
    struct nfsfh *fhp, struct ucred *cred, NFSPROC_T *p, void *stuff)
5884
    struct nfsfh *fhp, struct ucred *cred, NFSPROC_T *p)
5863
{
5885
{
5864
	uint32_t *tl;
5886
	uint32_t *tl;
5865
	struct nfsrv_descript nfsd, *nd = &nfsd;
5887
	struct nfsrv_descript nfsd, *nd = &nfsd;
Lines 5867-5872 nfsrpc_commitds(vnode_t vp, uint64_t off Link Here
5867
	struct nfssockreq *nrp;
5889
	struct nfssockreq *nrp;
5868
	int error;
5890
	int error;
5869
	
5891
	
5892
	nd->nd_mrep = NULL;
5870
	nfscl_reqstart(nd, NFSPROC_COMMITDS, nmp, fhp->nfh_fh, fhp->nfh_len,
5893
	nfscl_reqstart(nd, NFSPROC_COMMITDS, nmp, fhp->nfh_fh, fhp->nfh_len,
5871
	    NULL, &dsp->nfsclds_sess);
5894
	    NULL, &dsp->nfsclds_sess);
5872
	NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + NFSX_UNSIGNED);
5895
	NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + NFSX_UNSIGNED);
Lines 5879-5885 nfsrpc_commitds(vnode_t vp, uint64_t off Link Here
5879
		nrp = &nmp->nm_sockreq;
5902
		nrp = &nmp->nm_sockreq;
5880
	error = newnfs_request(nd, nmp, NULL, nrp, vp, p, cred,
5903
	error = newnfs_request(nd, nmp, NULL, nrp, vp, p, cred,
5881
	    NFS_PROG, NFS_VER4, NULL, 1, NULL, &dsp->nfsclds_sess);
5904
	    NFS_PROG, NFS_VER4, NULL, 1, NULL, &dsp->nfsclds_sess);
5882
	if (error)
5905
	if (error != 0)
5883
		return (error);
5906
		return (error);
5884
	if (nd->nd_repstat == 0) {
5907
	if (nd->nd_repstat == 0) {
5885
		NFSM_DISSECT(tl, u_int32_t *, NFSX_VERF);
5908
		NFSM_DISSECT(tl, u_int32_t *, NFSX_VERF);
Lines 5896-5902 nfsmout: Link Here
5896
	mbuf_freem(nd->nd_mrep);
5919
	mbuf_freem(nd->nd_mrep);
5897
	return (error);
5920
	return (error);
5898
}
5921
}
5899
#endif
5900
5922
5901
/*
5923
/*
5902
 * Set up the XDR arguments for the LayoutGet operation.
5924
 * Set up the XDR arguments for the LayoutGet operation.
(-)sys/fs/nfsclient/nfsnode.h (+1 lines)
Lines 158-163 struct nfsnode { Link Here
158
#define	NNOLAYOUT	0x00020000  /* Can't get a layout for this file */
158
#define	NNOLAYOUT	0x00020000  /* Can't get a layout for this file */
159
#define	NWRITEOPENED	0x00040000  /* Has been opened for writing */
159
#define	NWRITEOPENED	0x00040000  /* Has been opened for writing */
160
#define	NHASBEENLOCKED	0x00080000  /* Has been file locked. */
160
#define	NHASBEENLOCKED	0x00080000  /* Has been file locked. */
161
#define	NDSCOMMIT	0x00100000  /* Commit is done via the DS. */
161
162
162
/*
163
/*
163
 * Convert between nfsnode pointers and vnode pointers
164
 * Convert between nfsnode pointers and vnode pointers
(-)sys/fs/nfsclient/nfs_clnode.c (-1 / +1 lines)
Lines 262-268 ncl_inactive(struct vop_inactive_args *a Link Here
262
	 * associated with the NFS vnode.  None of the other flags are
262
	 * associated with the NFS vnode.  None of the other flags are
263
	 * meaningful after the vnode is unused.
263
	 * meaningful after the vnode is unused.
264
	 */
264
	 */
265
	np->n_flag &= NMODIFIED;
265
	np->n_flag &= (NMODIFIED | NDSCOMMIT);
266
	mtx_unlock(&np->n_mtx);
266
	mtx_unlock(&np->n_mtx);
267
	return (0);
267
	return (0);
268
}
268
}

Return to bug 219551