nfs_clvnops.c (222722) | nfs_clvnops.c (223280) |
---|---|
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 --- 19 unchanged lines hidden (view full) --- 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 * from nfs_vnops.c 8.16 (Berkeley) 5/27/95 33 */ 34 35#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 --- 19 unchanged lines hidden (view full) --- 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 * from nfs_vnops.c 8.16 (Berkeley) 5/27/95 33 */ 34 35#include <sys/cdefs.h> |
36__FBSDID("$FreeBSD: head/sys/fs/nfsclient/nfs_clvnops.c 222722 2011-06-05 20:22:56Z rmacklem $"); | 36__FBSDID("$FreeBSD: head/sys/fs/nfsclient/nfs_clvnops.c 223280 2011-06-18 23:02:53Z rmacklem $"); |
37 38/* 39 * vnode op calls for Sun NFS version 2, 3 and 4 40 */ 41 | 37 38/* 39 * vnode op calls for Sun NFS version 2, 3 and 4 40 */ 41 |
42#include "opt_kdtrace.h" |
|
42#include "opt_inet.h" 43 44#include <sys/param.h> 45#include <sys/kernel.h> 46#include <sys/systm.h> 47#include <sys/resourcevar.h> 48#include <sys/proc.h> 49#include <sys/mount.h> --- 15 unchanged lines hidden (view full) --- 65#include <vm/vm.h> 66#include <vm/vm_extern.h> 67#include <vm/vm_object.h> 68 69#include <fs/nfs/nfsport.h> 70#include <fs/nfsclient/nfsnode.h> 71#include <fs/nfsclient/nfsmount.h> 72#include <fs/nfsclient/nfs.h> | 43#include "opt_inet.h" 44 45#include <sys/param.h> 46#include <sys/kernel.h> 47#include <sys/systm.h> 48#include <sys/resourcevar.h> 49#include <sys/proc.h> 50#include <sys/mount.h> --- 15 unchanged lines hidden (view full) --- 66#include <vm/vm.h> 67#include <vm/vm_extern.h> 68#include <vm/vm_object.h> 69 70#include <fs/nfs/nfsport.h> 71#include <fs/nfsclient/nfsnode.h> 72#include <fs/nfsclient/nfsmount.h> 73#include <fs/nfsclient/nfs.h> |
74#include <fs/nfsclient/nfs_kdtrace.h> |
|
73 74#include <net/if.h> 75#include <netinet/in.h> 76#include <netinet/in_var.h> 77 78#include <nfs/nfs_lock.h> 79 | 75 76#include <net/if.h> 77#include <netinet/in.h> 78#include <netinet/in_var.h> 79 80#include <nfs/nfs_lock.h> 81 |
82#ifdef KDTRACE_HOOKS 83#include <sys/dtrace_bsd.h> 84 85dtrace_nfsclient_accesscache_flush_probe_func_t 86 dtrace_nfscl_accesscache_flush_done_probe; 87uint32_t nfscl_accesscache_flush_done_id; 88 89dtrace_nfsclient_accesscache_get_probe_func_t 90 dtrace_nfscl_accesscache_get_hit_probe, 91 dtrace_nfscl_accesscache_get_miss_probe; 92uint32_t nfscl_accesscache_get_hit_id; 93uint32_t nfscl_accesscache_get_miss_id; 94 95dtrace_nfsclient_accesscache_load_probe_func_t 96 dtrace_nfscl_accesscache_load_done_probe; 97uint32_t nfscl_accesscache_load_done_id; 98#endif /* !KDTRACE_HOOKS */ 99 |
|
80/* Defs */ 81#define TRUE 1 82#define FALSE 0 83 84extern struct nfsstats newnfsstats; 85extern int nfsrv_useacl; 86MALLOC_DECLARE(M_NEWNFSREQ); 87 --- 205 unchanged lines hidden (view full) --- 293 if (i == NFS_ACCESSCACHESIZE) { 294 np->n_accesscache[lrupos].uid = cred->cr_uid; 295 np->n_accesscache[lrupos].mode = rmode; 296 np->n_accesscache[lrupos].stamp = time_second; 297 } 298 mtx_unlock(&np->n_mtx); 299 if (retmode != NULL) 300 *retmode = rmode; | 100/* Defs */ 101#define TRUE 1 102#define FALSE 0 103 104extern struct nfsstats newnfsstats; 105extern int nfsrv_useacl; 106MALLOC_DECLARE(M_NEWNFSREQ); 107 --- 205 unchanged lines hidden (view full) --- 313 if (i == NFS_ACCESSCACHESIZE) { 314 np->n_accesscache[lrupos].uid = cred->cr_uid; 315 np->n_accesscache[lrupos].mode = rmode; 316 np->n_accesscache[lrupos].stamp = time_second; 317 } 318 mtx_unlock(&np->n_mtx); 319 if (retmode != NULL) 320 *retmode = rmode; |
321 KDTRACE_NFS_ACCESSCACHE_LOAD_DONE(vp, cred->cr_uid, rmode, 0); |
|
301 } else if (NFS_ISV4(vp)) { 302 error = nfscl_maperr(td, error, (uid_t)0, (gid_t)0); 303 } | 322 } else if (NFS_ISV4(vp)) { 323 error = nfscl_maperr(td, error, (uid_t)0, (gid_t)0); 324 } |
325#ifdef KDTRACE_HOOKS 326 if (error != 0) 327 KDTRACE_NFS_ACCESSCACHE_LOAD_DONE(vp, cred->cr_uid, 0, 328 error); 329#endif |
|
304 return (error); 305} 306 307/* 308 * nfs access vnode op. 309 * For nfs version 2, just return ok. File accesses may fail later. 310 * For nfs version 3, use the access rpc to check accessibility. If file modes 311 * are changed on the server, accesses might still fail later. --- 80 unchanged lines hidden (view full) --- 392 (np->n_accesscache[i].mode & mode) == mode) { 393 NFSINCRGLOBAL(newnfsstats.accesscache_hits); 394 gotahit = 1; 395 } 396 break; 397 } 398 } 399 mtx_unlock(&np->n_mtx); | 330 return (error); 331} 332 333/* 334 * nfs access vnode op. 335 * For nfs version 2, just return ok. File accesses may fail later. 336 * For nfs version 3, use the access rpc to check accessibility. If file modes 337 * are changed on the server, accesses might still fail later. --- 80 unchanged lines hidden (view full) --- 418 (np->n_accesscache[i].mode & mode) == mode) { 419 NFSINCRGLOBAL(newnfsstats.accesscache_hits); 420 gotahit = 1; 421 } 422 break; 423 } 424 } 425 mtx_unlock(&np->n_mtx); |
426#ifdef KDTRACE_HOOKS 427 if (gotahit != 0) 428 KDTRACE_NFS_ACCESSCACHE_GET_HIT(vp, 429 ap->a_cred->cr_uid, mode); 430 else 431 KDTRACE_NFS_ACCESSCACHE_GET_MISS(vp, 432 ap->a_cred->cr_uid, mode); 433#endif |
|
400 if (gotahit == 0) { 401 /* 402 * Either a no, or a don't know. Go to the wire. 403 */ 404 NFSINCRGLOBAL(newnfsstats.accesscache_misses); 405 error = nfs34_access_otw(vp, wmode, ap->a_td, 406 ap->a_cred, &rmode); 407 if (!error && --- 94 unchanged lines hidden (view full) --- 502 error = ncl_vinvalbuf(vp, V_SAVE, ap->a_td, 1); 503 if (error == EINTR || error == EIO) { 504 if (NFS_ISV4(vp)) 505 (void) nfsrpc_close(vp, 0, ap->a_td); 506 return (error); 507 } 508 mtx_lock(&np->n_mtx); 509 np->n_attrstamp = 0; | 434 if (gotahit == 0) { 435 /* 436 * Either a no, or a don't know. Go to the wire. 437 */ 438 NFSINCRGLOBAL(newnfsstats.accesscache_misses); 439 error = nfs34_access_otw(vp, wmode, ap->a_td, 440 ap->a_cred, &rmode); 441 if (!error && --- 94 unchanged lines hidden (view full) --- 536 error = ncl_vinvalbuf(vp, V_SAVE, ap->a_td, 1); 537 if (error == EINTR || error == EIO) { 538 if (NFS_ISV4(vp)) 539 (void) nfsrpc_close(vp, 0, ap->a_td); 540 return (error); 541 } 542 mtx_lock(&np->n_mtx); 543 np->n_attrstamp = 0; |
544 KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp); |
|
510 if (vp->v_type == VDIR) 511 np->n_direofoffset = 0; 512 mtx_unlock(&np->n_mtx); 513 error = VOP_GETATTR(vp, &vattr, ap->a_cred); 514 if (error) { 515 if (NFS_ISV4(vp)) 516 (void) nfsrpc_close(vp, 0, ap->a_td); 517 return (error); --- 169 unchanged lines hidden (view full) --- 687 * for it, so I've disabled it when negative lookups are 688 * enabled. (What does this have to do with negative lookup 689 * caching? Well nothing, except it was reported by the 690 * same user that needed negative lookup caching and I wanted 691 * there to be a way to disable it to see if it 692 * is the cause of some caching/coherency issue that might 693 * crop up.) 694 */ | 545 if (vp->v_type == VDIR) 546 np->n_direofoffset = 0; 547 mtx_unlock(&np->n_mtx); 548 error = VOP_GETATTR(vp, &vattr, ap->a_cred); 549 if (error) { 550 if (NFS_ISV4(vp)) 551 (void) nfsrpc_close(vp, 0, ap->a_td); 552 return (error); --- 169 unchanged lines hidden (view full) --- 722 * for it, so I've disabled it when negative lookups are 723 * enabled. (What does this have to do with negative lookup 724 * caching? Well nothing, except it was reported by the 725 * same user that needed negative lookup caching and I wanted 726 * there to be a way to disable it to see if it 727 * is the cause of some caching/coherency issue that might 728 * crop up.) 729 */ |
695 if (VFSTONFS(vp->v_mount)->nm_negnametimeo == 0) | 730 if (VFSTONFS(vp->v_mount)->nm_negnametimeo == 0) { |
696 np->n_attrstamp = 0; | 731 np->n_attrstamp = 0; |
732 KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp); 733 } |
|
697 if (np->n_flag & NWRITEERR) { 698 np->n_flag &= ~NWRITEERR; 699 error = np->n_error; 700 } 701 mtx_unlock(&np->n_mtx); 702 } 703 704 if (NFS_ISV4(vp)) { --- 239 unchanged lines hidden (view full) --- 944 struct nfsvattr nfsva; 945 946 if (NFS_ISV34(vp)) { 947 mtx_lock(&np->n_mtx); 948 for (i = 0; i < NFS_ACCESSCACHESIZE; i++) 949 np->n_accesscache[i].stamp = 0; 950 np->n_flag |= NDELEGMOD; 951 mtx_unlock(&np->n_mtx); | 734 if (np->n_flag & NWRITEERR) { 735 np->n_flag &= ~NWRITEERR; 736 error = np->n_error; 737 } 738 mtx_unlock(&np->n_mtx); 739 } 740 741 if (NFS_ISV4(vp)) { --- 239 unchanged lines hidden (view full) --- 981 struct nfsvattr nfsva; 982 983 if (NFS_ISV34(vp)) { 984 mtx_lock(&np->n_mtx); 985 for (i = 0; i < NFS_ACCESSCACHESIZE; i++) 986 np->n_accesscache[i].stamp = 0; 987 np->n_flag |= NDELEGMOD; 988 mtx_unlock(&np->n_mtx); |
989 KDTRACE_NFS_ACCESSCACHE_FLUSH_DONE(vp); |
|
952 } 953 error = nfsrpc_setattr(vp, vap, NULL, cred, td, &nfsva, &attrflag, 954 NULL); 955 if (attrflag) { 956 ret = nfscl_loadattrcache(&vp, &nfsva, NULL, NULL, 0, 1); 957 if (ret && !error) 958 error = ret; 959 } --- 65 unchanged lines hidden (view full) --- 1025 */ 1026 newvp = *vpp; 1027 newnp = VTONFS(newvp); 1028 if (!(nmp->nm_flag & NFSMNT_NOCTO) && 1029 (flags & (ISLASTCN | ISOPEN)) == (ISLASTCN | ISOPEN) && 1030 !(newnp->n_flag & NMODIFIED)) { 1031 mtx_lock(&newnp->n_mtx); 1032 newnp->n_attrstamp = 0; | 990 } 991 error = nfsrpc_setattr(vp, vap, NULL, cred, td, &nfsva, &attrflag, 992 NULL); 993 if (attrflag) { 994 ret = nfscl_loadattrcache(&vp, &nfsva, NULL, NULL, 0, 1); 995 if (ret && !error) 996 error = ret; 997 } --- 65 unchanged lines hidden (view full) --- 1063 */ 1064 newvp = *vpp; 1065 newnp = VTONFS(newvp); 1066 if (!(nmp->nm_flag & NFSMNT_NOCTO) && 1067 (flags & (ISLASTCN | ISOPEN)) == (ISLASTCN | ISOPEN) && 1068 !(newnp->n_flag & NMODIFIED)) { 1069 mtx_lock(&newnp->n_mtx); 1070 newnp->n_attrstamp = 0; |
1071 KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(newvp); |
|
1033 mtx_unlock(&newnp->n_mtx); 1034 } 1035 if (nfscl_nodeleg(newvp, 0) == 0 || 1036 (VOP_GETATTR(newvp, &vattr, cnp->cn_cred) == 0 && 1037 timespeccmp(&vattr.va_ctime, &newnp->n_ctime, ==))) { 1038 NFSINCRGLOBAL(newnfsstats.lookupcache_hits); 1039 if (cnp->cn_nameiop != LOOKUP && 1040 (flags & ISLASTCN)) --- 187 unchanged lines hidden (view full) --- 1228 /* 1229 * Flush the attribute cache when opening a 1230 * leaf node to ensure that fresh attributes 1231 * are fetched in nfs_open() since we did not 1232 * fetch attributes from the LOOKUP reply. 1233 */ 1234 mtx_lock(&np->n_mtx); 1235 np->n_attrstamp = 0; | 1072 mtx_unlock(&newnp->n_mtx); 1073 } 1074 if (nfscl_nodeleg(newvp, 0) == 0 || 1075 (VOP_GETATTR(newvp, &vattr, cnp->cn_cred) == 0 && 1076 timespeccmp(&vattr.va_ctime, &newnp->n_ctime, ==))) { 1077 NFSINCRGLOBAL(newnfsstats.lookupcache_hits); 1078 if (cnp->cn_nameiop != LOOKUP && 1079 (flags & ISLASTCN)) --- 187 unchanged lines hidden (view full) --- 1267 /* 1268 * Flush the attribute cache when opening a 1269 * leaf node to ensure that fresh attributes 1270 * are fetched in nfs_open() since we did not 1271 * fetch attributes from the LOOKUP reply. 1272 */ 1273 mtx_lock(&np->n_mtx); 1274 np->n_attrstamp = 0; |
1275 KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(newvp); |
|
1236 mtx_unlock(&np->n_mtx); 1237 } 1238 } 1239 if (cnp->cn_nameiop != LOOKUP && (flags & ISLASTCN)) 1240 cnp->cn_flags |= SAVENAME; 1241 if ((cnp->cn_flags & MAKEENTRY) && 1242 (cnp->cn_nameiop != DELETE || !(flags & ISLASTCN))) { 1243 np->n_ctime = np->n_vattr.na_vattr.va_ctime; --- 163 unchanged lines hidden (view full) --- 1407 *vpp = newvp; 1408 } else if (NFS_ISV4(dvp)) { 1409 error = nfscl_maperr(cnp->cn_thread, error, vap->va_uid, 1410 vap->va_gid); 1411 } 1412 dnp = VTONFS(dvp); 1413 mtx_lock(&dnp->n_mtx); 1414 dnp->n_flag |= NMODIFIED; | 1276 mtx_unlock(&np->n_mtx); 1277 } 1278 } 1279 if (cnp->cn_nameiop != LOOKUP && (flags & ISLASTCN)) 1280 cnp->cn_flags |= SAVENAME; 1281 if ((cnp->cn_flags & MAKEENTRY) && 1282 (cnp->cn_nameiop != DELETE || !(flags & ISLASTCN))) { 1283 np->n_ctime = np->n_vattr.na_vattr.va_ctime; --- 163 unchanged lines hidden (view full) --- 1447 *vpp = newvp; 1448 } else if (NFS_ISV4(dvp)) { 1449 error = nfscl_maperr(cnp->cn_thread, error, vap->va_uid, 1450 vap->va_gid); 1451 } 1452 dnp = VTONFS(dvp); 1453 mtx_lock(&dnp->n_mtx); 1454 dnp->n_flag |= NMODIFIED; |
1415 if (!dattrflag) | 1455 if (!dattrflag) { |
1416 dnp->n_attrstamp = 0; | 1456 dnp->n_attrstamp = 0; |
1457 KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(dvp); 1458 } |
|
1417 mtx_unlock(&dnp->n_mtx); 1418 return (error); 1419} 1420 1421/* 1422 * nfs mknod vop 1423 * just call nfs_mknodrpc() to do the work. 1424 */ --- 136 unchanged lines hidden (view full) --- 1561 cache_enter(dvp, newvp, cnp); 1562 *ap->a_vpp = newvp; 1563 } else if (NFS_ISV4(dvp)) { 1564 error = nfscl_maperr(cnp->cn_thread, error, vap->va_uid, 1565 vap->va_gid); 1566 } 1567 mtx_lock(&dnp->n_mtx); 1568 dnp->n_flag |= NMODIFIED; | 1459 mtx_unlock(&dnp->n_mtx); 1460 return (error); 1461} 1462 1463/* 1464 * nfs mknod vop 1465 * just call nfs_mknodrpc() to do the work. 1466 */ --- 136 unchanged lines hidden (view full) --- 1603 cache_enter(dvp, newvp, cnp); 1604 *ap->a_vpp = newvp; 1605 } else if (NFS_ISV4(dvp)) { 1606 error = nfscl_maperr(cnp->cn_thread, error, vap->va_uid, 1607 vap->va_gid); 1608 } 1609 mtx_lock(&dnp->n_mtx); 1610 dnp->n_flag |= NMODIFIED; |
1569 if (!dattrflag) | 1611 if (!dattrflag) { |
1570 dnp->n_attrstamp = 0; | 1612 dnp->n_attrstamp = 0; |
1613 KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(dvp); 1614 } |
|
1571 mtx_unlock(&dnp->n_mtx); 1572 return (error); 1573} 1574 1575/* 1576 * nfs file remove call 1577 * To try and make nfs semantics closer to ufs semantics, a file that has 1578 * other processes using the vnode is renamed instead of removed and then --- 46 unchanged lines hidden (view full) --- 1625 */ 1626 if (error == ENOENT) 1627 error = 0; 1628 } else if (!np->n_sillyrename) 1629 error = nfs_sillyrename(dvp, vp, cnp); 1630 mtx_lock(&np->n_mtx); 1631 np->n_attrstamp = 0; 1632 mtx_unlock(&np->n_mtx); | 1615 mtx_unlock(&dnp->n_mtx); 1616 return (error); 1617} 1618 1619/* 1620 * nfs file remove call 1621 * To try and make nfs semantics closer to ufs semantics, a file that has 1622 * other processes using the vnode is renamed instead of removed and then --- 46 unchanged lines hidden (view full) --- 1669 */ 1670 if (error == ENOENT) 1671 error = 0; 1672 } else if (!np->n_sillyrename) 1673 error = nfs_sillyrename(dvp, vp, cnp); 1674 mtx_lock(&np->n_mtx); 1675 np->n_attrstamp = 0; 1676 mtx_unlock(&np->n_mtx); |
1677 KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp); |
|
1633 return (error); 1634} 1635 1636/* 1637 * nfs file remove rpc called from nfs_inactive 1638 */ 1639int 1640ncl_removeit(struct sillyrename *sp, struct vnode *vp) --- 32 unchanged lines hidden (view full) --- 1673 } else { 1674 dnp->n_flag &= ~NREMOVEINPROG; 1675 mtx_unlock(&dnp->n_mtx); 1676 } 1677 if (dattrflag) 1678 (void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, NULL, 0, 1); 1679 mtx_lock(&dnp->n_mtx); 1680 dnp->n_flag |= NMODIFIED; | 1678 return (error); 1679} 1680 1681/* 1682 * nfs file remove rpc called from nfs_inactive 1683 */ 1684int 1685ncl_removeit(struct sillyrename *sp, struct vnode *vp) --- 32 unchanged lines hidden (view full) --- 1718 } else { 1719 dnp->n_flag &= ~NREMOVEINPROG; 1720 mtx_unlock(&dnp->n_mtx); 1721 } 1722 if (dattrflag) 1723 (void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, NULL, 0, 1); 1724 mtx_lock(&dnp->n_mtx); 1725 dnp->n_flag |= NMODIFIED; |
1681 if (!dattrflag) | 1726 if (!dattrflag) { |
1682 dnp->n_attrstamp = 0; | 1727 dnp->n_attrstamp = 0; |
1728 KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(dvp); 1729 } |
|
1683 mtx_unlock(&dnp->n_mtx); 1684 if (error && NFS_ISV4(dvp)) 1685 error = nfscl_maperr(td, error, (uid_t)0, (gid_t)0); 1686 return (error); 1687} 1688 1689/* 1690 * nfs file rename call --- 161 unchanged lines hidden (view full) --- 1852 mtx_lock(&fdnp->n_mtx); 1853 fdnp->n_flag |= NMODIFIED; 1854 if (fattrflag != 0) { 1855 mtx_unlock(&fdnp->n_mtx); 1856 (void) nfscl_loadattrcache(&fdvp, &fnfsva, NULL, NULL, 0, 1); 1857 } else { 1858 fdnp->n_attrstamp = 0; 1859 mtx_unlock(&fdnp->n_mtx); | 1730 mtx_unlock(&dnp->n_mtx); 1731 if (error && NFS_ISV4(dvp)) 1732 error = nfscl_maperr(td, error, (uid_t)0, (gid_t)0); 1733 return (error); 1734} 1735 1736/* 1737 * nfs file rename call --- 161 unchanged lines hidden (view full) --- 1899 mtx_lock(&fdnp->n_mtx); 1900 fdnp->n_flag |= NMODIFIED; 1901 if (fattrflag != 0) { 1902 mtx_unlock(&fdnp->n_mtx); 1903 (void) nfscl_loadattrcache(&fdvp, &fnfsva, NULL, NULL, 0, 1); 1904 } else { 1905 fdnp->n_attrstamp = 0; 1906 mtx_unlock(&fdnp->n_mtx); |
1907 KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(fdvp); |
|
1860 } 1861 mtx_lock(&tdnp->n_mtx); 1862 tdnp->n_flag |= NMODIFIED; 1863 if (tattrflag != 0) { 1864 mtx_unlock(&tdnp->n_mtx); 1865 (void) nfscl_loadattrcache(&tdvp, &tnfsva, NULL, NULL, 0, 1); 1866 } else { 1867 tdnp->n_attrstamp = 0; 1868 mtx_unlock(&tdnp->n_mtx); | 1908 } 1909 mtx_lock(&tdnp->n_mtx); 1910 tdnp->n_flag |= NMODIFIED; 1911 if (tattrflag != 0) { 1912 mtx_unlock(&tdnp->n_mtx); 1913 (void) nfscl_loadattrcache(&tdvp, &tnfsva, NULL, NULL, 0, 1); 1914 } else { 1915 tdnp->n_attrstamp = 0; 1916 mtx_unlock(&tdnp->n_mtx); |
1917 KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(tdvp); |
|
1869 } 1870 if (error && NFS_ISV4(fdvp)) 1871 error = nfscl_maperr(td, error, (uid_t)0, (gid_t)0); 1872 return (error); 1873} 1874 1875/* 1876 * nfs hard link create call --- 26 unchanged lines hidden (view full) --- 1903 mtx_lock(&tdnp->n_mtx); 1904 tdnp->n_flag |= NMODIFIED; 1905 if (dattrflag != 0) { 1906 mtx_unlock(&tdnp->n_mtx); 1907 (void) nfscl_loadattrcache(&tdvp, &dnfsva, NULL, NULL, 0, 1); 1908 } else { 1909 tdnp->n_attrstamp = 0; 1910 mtx_unlock(&tdnp->n_mtx); | 1918 } 1919 if (error && NFS_ISV4(fdvp)) 1920 error = nfscl_maperr(td, error, (uid_t)0, (gid_t)0); 1921 return (error); 1922} 1923 1924/* 1925 * nfs hard link create call --- 26 unchanged lines hidden (view full) --- 1952 mtx_lock(&tdnp->n_mtx); 1953 tdnp->n_flag |= NMODIFIED; 1954 if (dattrflag != 0) { 1955 mtx_unlock(&tdnp->n_mtx); 1956 (void) nfscl_loadattrcache(&tdvp, &dnfsva, NULL, NULL, 0, 1); 1957 } else { 1958 tdnp->n_attrstamp = 0; 1959 mtx_unlock(&tdnp->n_mtx); |
1960 KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(tdvp); |
|
1911 } 1912 if (attrflag) 1913 (void) nfscl_loadattrcache(&vp, &nfsva, NULL, NULL, 0, 1); 1914 else { 1915 np = VTONFS(vp); 1916 mtx_lock(&np->n_mtx); 1917 np->n_attrstamp = 0; 1918 mtx_unlock(&np->n_mtx); | 1961 } 1962 if (attrflag) 1963 (void) nfscl_loadattrcache(&vp, &nfsva, NULL, NULL, 0, 1); 1964 else { 1965 np = VTONFS(vp); 1966 mtx_lock(&np->n_mtx); 1967 np->n_attrstamp = 0; 1968 mtx_unlock(&np->n_mtx); |
1969 KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp); |
|
1919 } 1920 /* 1921 * If negative lookup caching is enabled, I might as well 1922 * add an entry for this node. Not necessary for correctness, 1923 * but if negative caching is enabled, then the system 1924 * must care about lookup caching hit rate, so... 1925 */ 1926 if (VFSTONFS(vp->v_mount)->nm_negnametimeo != 0 && --- 70 unchanged lines hidden (view full) --- 1997 mtx_lock(&dnp->n_mtx); 1998 dnp->n_flag |= NMODIFIED; 1999 if (dattrflag != 0) { 2000 mtx_unlock(&dnp->n_mtx); 2001 (void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, NULL, 0, 1); 2002 } else { 2003 dnp->n_attrstamp = 0; 2004 mtx_unlock(&dnp->n_mtx); | 1970 } 1971 /* 1972 * If negative lookup caching is enabled, I might as well 1973 * add an entry for this node. Not necessary for correctness, 1974 * but if negative caching is enabled, then the system 1975 * must care about lookup caching hit rate, so... 1976 */ 1977 if (VFSTONFS(vp->v_mount)->nm_negnametimeo != 0 && --- 70 unchanged lines hidden (view full) --- 2048 mtx_lock(&dnp->n_mtx); 2049 dnp->n_flag |= NMODIFIED; 2050 if (dattrflag != 0) { 2051 mtx_unlock(&dnp->n_mtx); 2052 (void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, NULL, 0, 1); 2053 } else { 2054 dnp->n_attrstamp = 0; 2055 mtx_unlock(&dnp->n_mtx); |
2056 KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(dvp); |
|
2005 } 2006 return (error); 2007} 2008 2009/* 2010 * nfs make dir call 2011 */ 2012static int --- 19 unchanged lines hidden (view full) --- 2032 mtx_lock(&dnp->n_mtx); 2033 dnp->n_flag |= NMODIFIED; 2034 if (dattrflag != 0) { 2035 mtx_unlock(&dnp->n_mtx); 2036 (void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, NULL, 0, 1); 2037 } else { 2038 dnp->n_attrstamp = 0; 2039 mtx_unlock(&dnp->n_mtx); | 2057 } 2058 return (error); 2059} 2060 2061/* 2062 * nfs make dir call 2063 */ 2064static int --- 19 unchanged lines hidden (view full) --- 2084 mtx_lock(&dnp->n_mtx); 2085 dnp->n_flag |= NMODIFIED; 2086 if (dattrflag != 0) { 2087 mtx_unlock(&dnp->n_mtx); 2088 (void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, NULL, 0, 1); 2089 } else { 2090 dnp->n_attrstamp = 0; 2091 mtx_unlock(&dnp->n_mtx); |
2092 KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(dvp); |
|
2040 } 2041 if (nfhp) { 2042 ret = nfscl_nget(dvp->v_mount, dvp, nfhp, cnp, cnp->cn_thread, 2043 &np, NULL, LK_EXCLUSIVE); 2044 if (!ret) { 2045 newvp = NFSTOV(np); 2046 if (attrflag) 2047 (void) nfscl_loadattrcache(&newvp, &nfsva, NULL, --- 52 unchanged lines hidden (view full) --- 2100 mtx_lock(&dnp->n_mtx); 2101 dnp->n_flag |= NMODIFIED; 2102 if (dattrflag != 0) { 2103 mtx_unlock(&dnp->n_mtx); 2104 (void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, NULL, 0, 1); 2105 } else { 2106 dnp->n_attrstamp = 0; 2107 mtx_unlock(&dnp->n_mtx); | 2093 } 2094 if (nfhp) { 2095 ret = nfscl_nget(dvp->v_mount, dvp, nfhp, cnp, cnp->cn_thread, 2096 &np, NULL, LK_EXCLUSIVE); 2097 if (!ret) { 2098 newvp = NFSTOV(np); 2099 if (attrflag) 2100 (void) nfscl_loadattrcache(&newvp, &nfsva, NULL, --- 52 unchanged lines hidden (view full) --- 2153 mtx_lock(&dnp->n_mtx); 2154 dnp->n_flag |= NMODIFIED; 2155 if (dattrflag != 0) { 2156 mtx_unlock(&dnp->n_mtx); 2157 (void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, NULL, 0, 1); 2158 } else { 2159 dnp->n_attrstamp = 0; 2160 mtx_unlock(&dnp->n_mtx); |
2161 KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(dvp); |
|
2108 } 2109 2110 cache_purge(dvp); 2111 cache_purge(vp); 2112 if (error && NFS_ISV4(dvp)) 2113 error = nfscl_maperr(cnp->cn_thread, error, (uid_t)0, 2114 (gid_t)0); 2115 /* --- 825 unchanged lines hidden (view full) --- 2941 /* 2942 * Now, if we just got a lock, invalidate data in the buffer 2943 * cache, as required, so that the coherency conforms with 2944 * RFC3530 Sec. 9.3.2. 2945 */ 2946 if (ap->a_op == F_SETLK) { 2947 if ((np->n_flag & NMODIFIED) == 0) { 2948 np->n_attrstamp = 0; | 2162 } 2163 2164 cache_purge(dvp); 2165 cache_purge(vp); 2166 if (error && NFS_ISV4(dvp)) 2167 error = nfscl_maperr(cnp->cn_thread, error, (uid_t)0, 2168 (gid_t)0); 2169 /* --- 825 unchanged lines hidden (view full) --- 2995 /* 2996 * Now, if we just got a lock, invalidate data in the buffer 2997 * cache, as required, so that the coherency conforms with 2998 * RFC3530 Sec. 9.3.2. 2999 */ 3000 if (ap->a_op == F_SETLK) { 3001 if ((np->n_flag & NMODIFIED) == 0) { 3002 np->n_attrstamp = 0; |
3003 KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp); |
|
2949 ret = VOP_GETATTR(vp, &va, cred); 2950 } 2951 if ((np->n_flag & NMODIFIED) || ret || 2952 np->n_change != va.va_filerev) { 2953 (void) ncl_vinvalbuf(vp, V_SAVE, td, 1); 2954 np->n_attrstamp = 0; | 3004 ret = VOP_GETATTR(vp, &va, cred); 3005 } 3006 if ((np->n_flag & NMODIFIED) || ret || 3007 np->n_change != va.va_filerev) { 3008 (void) ncl_vinvalbuf(vp, V_SAVE, td, 1); 3009 np->n_attrstamp = 0; |
3010 KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp); |
|
2955 ret = VOP_GETATTR(vp, &va, cred); 2956 if (!ret) { 2957 np->n_mtime = va.va_mtime; 2958 np->n_change = va.va_filerev; 2959 } 2960 } 2961 } 2962 VOP_UNLOCK(vp, 0); --- 445 unchanged lines hidden --- | 3011 ret = VOP_GETATTR(vp, &va, cred); 3012 if (!ret) { 3013 np->n_mtime = va.va_mtime; 3014 np->n_change = va.va_filerev; 3015 } 3016 } 3017 } 3018 VOP_UNLOCK(vp, 0); --- 445 unchanged lines hidden --- |