Deleted Added
sdiff udiff text old ( 206688 ) new ( 207082 )
full compact
1/*-
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Rick Macklem at The University of Guelph.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 18 unchanged lines hidden (view full) ---

27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 *
32 */
33
34#include <sys/cdefs.h>
35__FBSDID("$FreeBSD: head/sys/fs/nfsclient/nfs_clrpcops.c 206688 2010-04-15 22:57:30Z rmacklem $");
36
37/*
38 * Rpc op calls, generally called from the vnode op calls or through the
39 * buffer cache, for NFS v2, 3 and 4.
40 * These do not normally make any changes to vnode arguments or use
41 * structures that might change between the VFS variants. The returned
42 * arguments are all at the end, after the NFSPROC_T *p one.
43 */

--- 1297 unchanged lines hidden (view full) ---

1341nfsmout:
1342 if (nd->nd_mrep != NULL)
1343 mbuf_freem(nd->nd_mrep);
1344 return (error);
1345}
1346
1347/*
1348 * nfs write operation
1349 */
1350APPLESTATIC int
1351nfsrpc_write(vnode_t vp, struct uio *uiop, int *iomode, u_char *verfp,
1352 struct ucred *cred, NFSPROC_T *p, struct nfsvattr *nap, int *attrflagp,
1353 void *stuff)
1354{
1355 int error, expireret = 0, retrycnt, nostateid;
1356 u_int32_t clidrev = 0;
1357 struct nfsmount *nmp = VFSTONFS(vnode_mount(vp));
1358 struct nfsnode *np = VTONFS(vp);
1359 struct ucred *newcred;
1360 struct nfsfh *nfhp = NULL;
1361 nfsv4stateid_t stateid;

--- 43 unchanged lines hidden (view full) ---

1405 error == NFSERR_STALEDONTRECOVER || error == NFSERR_DELAY ||
1406 error == NFSERR_OLDSTATEID) {
1407 (void) nfs_catnap(PZERO, "nfs_write");
1408 } else if ((error == NFSERR_EXPIRED ||
1409 error == NFSERR_BADSTATEID) && clidrev != 0) {
1410 expireret = nfscl_hasexpired(nmp->nm_clp, clidrev, p);
1411 }
1412 retrycnt++;
1413 } while (error == NFSERR_GRACE || error == NFSERR_STALESTATEID ||
1414 error == NFSERR_STALEDONTRECOVER || error == NFSERR_DELAY ||
1415 (error == NFSERR_OLDSTATEID && retrycnt < 20) ||
1416 ((error == NFSERR_EXPIRED || error == NFSERR_BADSTATEID) &&
1417 expireret == 0 && clidrev != 0 && retrycnt < 4));
1418 if (error && retrycnt >= 4)
1419 error = EIO;
1420 if (NFSHASNFSV4(nmp) && p == NULL)
1421 NFSFREECRED(newcred);
1422 return (error);
1423}
1424
1425/*
1426 * The actual write RPC.

--- 2747 unchanged lines hidden ---