nfs_clvnops.c (9698d992306dee298e1f130fcf437a0ce9add73e) nfs_clvnops.c (abd80ddb9474948fb291becc395d72b40927a32b)
1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 1989, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Rick Macklem at The University of Guelph.

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

1230 }
1231 cache_purge(newvp);
1232 if (dvp != newvp)
1233 vput(newvp);
1234 else
1235 vrele(newvp);
1236 *vpp = NULLVP;
1237 } else if (error == ENOENT) {
1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 1989, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Rick Macklem at The University of Guelph.

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

1230 }
1231 cache_purge(newvp);
1232 if (dvp != newvp)
1233 vput(newvp);
1234 else
1235 vrele(newvp);
1236 *vpp = NULLVP;
1237 } else if (error == ENOENT) {
1238 if (dvp->v_iflag & VI_DOOMED)
1238 if (VN_IS_DOOMED(dvp))
1239 return (ENOENT);
1240 /*
1241 * We only accept a negative hit in the cache if the
1242 * modification time of the parent directory matches
1243 * the cached copy in the name cache entry.
1244 * Otherwise, we discard all of the negative cache
1245 * entries for this directory. We also only trust
1246 * negative cache entries for up to nm_negnametimeo

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

1335 ltype = NFSVOPISLOCKED(dvp);
1336 error = vfs_busy(mp, MBF_NOWAIT);
1337 if (error != 0) {
1338 vfs_ref(mp);
1339 NFSVOPUNLOCK(dvp, 0);
1340 error = vfs_busy(mp, 0);
1341 NFSVOPLOCK(dvp, ltype | LK_RETRY);
1342 vfs_rel(mp);
1239 return (ENOENT);
1240 /*
1241 * We only accept a negative hit in the cache if the
1242 * modification time of the parent directory matches
1243 * the cached copy in the name cache entry.
1244 * Otherwise, we discard all of the negative cache
1245 * entries for this directory. We also only trust
1246 * negative cache entries for up to nm_negnametimeo

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

1335 ltype = NFSVOPISLOCKED(dvp);
1336 error = vfs_busy(mp, MBF_NOWAIT);
1337 if (error != 0) {
1338 vfs_ref(mp);
1339 NFSVOPUNLOCK(dvp, 0);
1340 error = vfs_busy(mp, 0);
1341 NFSVOPLOCK(dvp, ltype | LK_RETRY);
1342 vfs_rel(mp);
1343 if (error == 0 && (dvp->v_iflag & VI_DOOMED)) {
1343 if (error == 0 && VN_IS_DOOMED(dvp)) {
1344 vfs_unbusy(mp);
1345 error = ENOENT;
1346 }
1347 if (error != 0)
1348 return (error);
1349 }
1350 NFSVOPUNLOCK(dvp, 0);
1351 error = nfscl_nget(mp, dvp, nfhp, cnp, td, &np, NULL,
1352 cnp->cn_lkflags);
1353 if (error == 0)
1354 newvp = NFSTOV(np);
1355 vfs_unbusy(mp);
1356 if (newvp != dvp)
1357 NFSVOPLOCK(dvp, ltype | LK_RETRY);
1344 vfs_unbusy(mp);
1345 error = ENOENT;
1346 }
1347 if (error != 0)
1348 return (error);
1349 }
1350 NFSVOPUNLOCK(dvp, 0);
1351 error = nfscl_nget(mp, dvp, nfhp, cnp, td, &np, NULL,
1352 cnp->cn_lkflags);
1353 if (error == 0)
1354 newvp = NFSTOV(np);
1355 vfs_unbusy(mp);
1356 if (newvp != dvp)
1357 NFSVOPLOCK(dvp, ltype | LK_RETRY);
1358 if (dvp->v_iflag & VI_DOOMED) {
1358 if (VN_IS_DOOMED(dvp)) {
1359 if (error == 0) {
1360 if (newvp == dvp)
1361 vrele(newvp);
1362 else
1363 vput(newvp);
1364 }
1365 error = ENOENT;
1366 }

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

3134 error = EINVAL;
3135 goto out;
3136 }
3137 if ((ap->a_flags & F_POSIX) != 0)
3138 cred = p->p_ucred;
3139 else
3140 cred = td->td_ucred;
3141 NFSVOPLOCK(vp, LK_UPGRADE | LK_RETRY);
1359 if (error == 0) {
1360 if (newvp == dvp)
1361 vrele(newvp);
1362 else
1363 vput(newvp);
1364 }
1365 error = ENOENT;
1366 }

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

3134 error = EINVAL;
3135 goto out;
3136 }
3137 if ((ap->a_flags & F_POSIX) != 0)
3138 cred = p->p_ucred;
3139 else
3140 cred = td->td_ucred;
3141 NFSVOPLOCK(vp, LK_UPGRADE | LK_RETRY);
3142 if (vp->v_iflag & VI_DOOMED) {
3142 if (VN_IS_DOOMED(vp)) {
3143 error = EBADF;
3144 goto out;
3145 }
3146
3147 /*
3148 * If this is unlocking a write locked region, flush and
3149 * commit them before unlocking. This is required by
3150 * RFC3530 Sec. 9.3.2.

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

3164 if (ret == NFSERR_DENIED && (ap->a_flags & F_WAIT) &&
3165 ap->a_op == F_SETLK) {
3166 NFSVOPUNLOCK(vp, 0);
3167 error = nfs_catnap(PZERO | PCATCH, ret,
3168 "ncladvl");
3169 if (error)
3170 return (EINTR);
3171 NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY);
3143 error = EBADF;
3144 goto out;
3145 }
3146
3147 /*
3148 * If this is unlocking a write locked region, flush and
3149 * commit them before unlocking. This is required by
3150 * RFC3530 Sec. 9.3.2.

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

3164 if (ret == NFSERR_DENIED && (ap->a_flags & F_WAIT) &&
3165 ap->a_op == F_SETLK) {
3166 NFSVOPUNLOCK(vp, 0);
3167 error = nfs_catnap(PZERO | PCATCH, ret,
3168 "ncladvl");
3169 if (error)
3170 return (EINTR);
3171 NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY);
3172 if (vp->v_iflag & VI_DOOMED) {
3172 if (VN_IS_DOOMED(vp)) {
3173 error = EBADF;
3174 goto out;
3175 }
3176 }
3177 } while (ret == NFSERR_DENIED && (ap->a_flags & F_WAIT) &&
3178 ap->a_op == F_SETLK);
3179 if (ret == NFSERR_DENIED) {
3180 error = EAGAIN;

--- 442 unchanged lines hidden ---
3173 error = EBADF;
3174 goto out;
3175 }
3176 }
3177 } while (ret == NFSERR_DENIED && (ap->a_flags & F_WAIT) &&
3178 ap->a_op == F_SETLK);
3179 if (ret == NFSERR_DENIED) {
3180 error = EAGAIN;

--- 442 unchanged lines hidden ---