Deleted Added
full compact
nfs_clrpcops.c (206688) nfs_clrpcops.c (207082)
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>
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 $");
35__FBSDID("$FreeBSD: head/sys/fs/nfsclient/nfs_clrpcops.c 207082 2010-04-22 23:51:01Z 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
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 * When called_from_strategy != 0, it should return EIO for an error that
1350 * indicates recovery is in progress, so that the buffer will be left
1351 * dirty and be written back to the server later. If it loops around,
1352 * the recovery thread could get stuck waiting for the buffer and recovery
1353 * will then deadlock.
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,
1354 */
1355APPLESTATIC int
1356nfsrpc_write(vnode_t vp, struct uio *uiop, int *iomode, u_char *verfp,
1357 struct ucred *cred, NFSPROC_T *p, struct nfsvattr *nap, int *attrflagp,
1353 void *stuff)
1358 void *stuff, int called_from_strategy)
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++;
1359{
1360 int error, expireret = 0, retrycnt, nostateid;
1361 u_int32_t clidrev = 0;
1362 struct nfsmount *nmp = VFSTONFS(vnode_mount(vp));
1363 struct nfsnode *np = VTONFS(vp);
1364 struct ucred *newcred;
1365 struct nfsfh *nfhp = NULL;
1366 nfsv4stateid_t stateid;

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

1410 error == NFSERR_STALEDONTRECOVER || error == NFSERR_DELAY ||
1411 error == NFSERR_OLDSTATEID) {
1412 (void) nfs_catnap(PZERO, "nfs_write");
1413 } else if ((error == NFSERR_EXPIRED ||
1414 error == NFSERR_BADSTATEID) && clidrev != 0) {
1415 expireret = nfscl_hasexpired(nmp->nm_clp, clidrev, p);
1416 }
1417 retrycnt++;
1413 } while (error == NFSERR_GRACE || error == NFSERR_STALESTATEID ||
1414 error == NFSERR_STALEDONTRECOVER || error == NFSERR_DELAY ||
1418 } while (error == NFSERR_GRACE || error == NFSERR_DELAY ||
1419 ((error == NFSERR_STALESTATEID ||
1420 error == NFSERR_STALEDONTRECOVER) && called_from_strategy == 0) ||
1415 (error == NFSERR_OLDSTATEID && retrycnt < 20) ||
1416 ((error == NFSERR_EXPIRED || error == NFSERR_BADSTATEID) &&
1417 expireret == 0 && clidrev != 0 && retrycnt < 4));
1421 (error == NFSERR_OLDSTATEID && retrycnt < 20) ||
1422 ((error == NFSERR_EXPIRED || error == NFSERR_BADSTATEID) &&
1423 expireret == 0 && clidrev != 0 && retrycnt < 4));
1418 if (error && retrycnt >= 4)
1424 if (error != 0 && (retrycnt >= 4 ||
1425 ((error == NFSERR_STALESTATEID ||
1426 error == NFSERR_STALEDONTRECOVER) && called_from_strategy != 0)))
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 ---
1427 error = EIO;
1428 if (NFSHASNFSV4(nmp) && p == NULL)
1429 NFSFREECRED(newcred);
1430 return (error);
1431}
1432
1433/*
1434 * The actual write RPC.

--- 2747 unchanged lines hidden ---