Lines Matching full:np

315  * np->n_mtx : Protects the fields in the nfsnode.
331 struct nfsnode *np; in nfs_lock() local
341 np = VTONFS(vp); in nfs_lock()
342 if (np == NULL) in nfs_lock()
344 NFSLOCKNODE(np); in nfs_lock()
345 if ((np->n_flag & NVNSETSZSKIP) == 0 || (lktype != LK_SHARED && in nfs_lock()
348 NFSUNLOCKNODE(np); in nfs_lock()
360 NFSUNLOCKNODE(np); in nfs_lock()
366 NFSUNLOCKNODE(np); in nfs_lock()
370 NFSUNLOCKNODE(np); in nfs_lock()
379 MPASS(vp->v_data == np); in nfs_lock()
380 NFSLOCKNODE(np); in nfs_lock()
381 if ((np->n_flag & NVNSETSZSKIP) == 0) { in nfs_lock()
382 NFSUNLOCKNODE(np); in nfs_lock()
386 np->n_flag &= ~NVNSETSZSKIP; in nfs_lock()
387 nsize = np->n_size; in nfs_lock()
388 NFSUNLOCKNODE(np); in nfs_lock()
405 struct nfsnode *np = VTONFS(vp); in nfs34_access_otw() local
414 NFSLOCKNODE(np); in nfs34_access_otw()
416 if (np->n_accesscache[i].uid == cred->cr_uid) { in nfs34_access_otw()
417 np->n_accesscache[i].mode = rmode; in nfs34_access_otw()
418 np->n_accesscache[i].stamp = time_second; in nfs34_access_otw()
421 if (i > 0 && np->n_accesscache[i].stamp < in nfs34_access_otw()
422 np->n_accesscache[lrupos].stamp) in nfs34_access_otw()
426 np->n_accesscache[lrupos].uid = cred->cr_uid; in nfs34_access_otw()
427 np->n_accesscache[lrupos].mode = rmode; in nfs34_access_otw()
428 np->n_accesscache[lrupos].stamp = time_second; in nfs34_access_otw()
430 NFSUNLOCKNODE(np); in nfs34_access_otw()
458 struct nfsnode *np = VTONFS(vp); in nfs_access() local
525 NFSLOCKNODE(np); in nfs_access()
527 if (ap->a_cred->cr_uid == np->n_accesscache[i].uid) { in nfs_access()
528 if (time_second < (np->n_accesscache[i].stamp in nfs_access()
530 (np->n_accesscache[i].mode & mode) == mode) { in nfs_access()
537 NFSUNLOCKNODE(np); in nfs_access()
569 NFSLOCKNODE(np); in nfs_access()
576 NFSUNLOCKNODE(np); in nfs_access()
602 NFSUNLOCKNODE(np); in nfs_access()
619 struct nfsnode *np = VTONFS(vp); in nfs_open() local
646 NFSLOCKNODE(np); in nfs_open()
647 if (np->n_flag & NMODIFIED) { in nfs_open()
648 NFSUNLOCKNODE(np); in nfs_open()
660 NFSLOCKNODE(np); in nfs_open()
661 np->n_attrstamp = 0; in nfs_open()
664 np->n_direofoffset = 0; in nfs_open()
665 NFSUNLOCKNODE(np); in nfs_open()
672 NFSLOCKNODE(np); in nfs_open()
673 np->n_mtime = vattr.va_mtime; in nfs_open()
675 np->n_change = vattr.va_filerev; in nfs_open()
677 NFSUNLOCKNODE(np); in nfs_open()
684 NFSLOCKNODE(np); in nfs_open()
685 if ((NFS_ISV4(vp) && np->n_change != vattr.va_filerev) || in nfs_open()
686 NFS_TIMESPEC_COMPARE(&np->n_mtime, &vattr.va_mtime)) { in nfs_open()
688 np->n_direofoffset = 0; in nfs_open()
689 NFSUNLOCKNODE(np); in nfs_open()
701 NFSLOCKNODE(np); in nfs_open()
702 np->n_mtime = vattr.va_mtime; in nfs_open()
704 np->n_change = vattr.va_filerev; in nfs_open()
713 if (np->n_directio_opens == 0) { in nfs_open()
714 NFSUNLOCKNODE(np); in nfs_open()
726 NFSLOCKNODE(np); in nfs_open()
727 np->n_flag |= NNONCACHE; in nfs_open()
729 np->n_directio_opens++; in nfs_open()
734 np->n_flag |= NWRITEOPENED; in nfs_open()
744 cred = np->n_writecred; in nfs_open()
745 np->n_writecred = crhold(ap->a_cred); in nfs_open()
748 NFSUNLOCKNODE(np); in nfs_open()
777 np = VTONFS(vp); in nfs_open()
778 NFSLOCKNODE(np); in nfs_open()
779 np->n_mtime = np->n_vattr.na_mtime; in nfs_open()
780 NFSUNLOCKNODE(np); in nfs_open()
825 struct nfsnode *np = VTONFS(vp); in nfs_close() local
858 NFSLOCKNODE(np); in nfs_close()
859 if (np->n_flag & NMODIFIED) { in nfs_close()
860 NFSUNLOCKNODE(np); in nfs_close()
871 * We cannot clear the NMODIFIED bit in np->n_flag due to in nfs_close()
884 /* np->n_flag &= ~NMODIFIED; */ in nfs_close()
899 * np->n_flag &= ~NMODIFIED; in nfs_close()
911 NFSLOCKNODE(np); in nfs_close()
929 np->n_attrstamp = 0; in nfs_close()
932 if (np->n_flag & NWRITEERR) { in nfs_close()
933 np->n_flag &= ~NWRITEERR; in nfs_close()
934 error = np->n_error; in nfs_close()
936 NFSUNLOCKNODE(np); in nfs_close()
948 np->n_change = nfsva.na_filerev; in nfs_close()
965 NFSLOCKNODE(np); in nfs_close()
966 KASSERT((np->n_directio_opens > 0), in nfs_close()
968 np->n_directio_opens--; in nfs_close()
969 if (np->n_directio_opens == 0) in nfs_close()
970 np->n_flag &= ~NNONCACHE; in nfs_close()
971 NFSUNLOCKNODE(np); in nfs_close()
986 struct nfsnode *np = VTONFS(vp); in nfs_getattr() local
997 NFSLOCKNODE(np); in nfs_getattr()
998 if (np->n_flag & (NACC | NUPD)) in nfs_getattr()
999 np->n_flag |= NCHG; in nfs_getattr()
1000 NFSUNLOCKNODE(np); in nfs_getattr()
1048 struct nfsnode *np = VTONFS(vp); in nfs_setattr() local
1101 * we must set np->n_size now to avoid vinvalbuf in nfs_setattr()
1105 NFSLOCKNODE(np); in nfs_setattr()
1106 tsize = np->n_size; in nfs_setattr()
1107 NFSUNLOCKNODE(np); in nfs_setattr()
1109 NFSLOCKNODE(np); in nfs_setattr()
1110 if (np->n_flag & NMODIFIED) { in nfs_setattr()
1111 tsize = np->n_size; in nfs_setattr()
1112 NFSUNLOCKNODE(np); in nfs_setattr()
1125 NFSUNLOCKNODE(np); in nfs_setattr()
1127 * np->n_size has already been set to vap->va_size in nfs_setattr()
1130 * ncl_meta_setsize() and could modify np->n_size. in nfs_setattr()
1132 NFSLOCKNODE(np); in nfs_setattr()
1133 np->n_vattr.na_size = np->n_size = vap->va_size; in nfs_setattr()
1134 NFSUNLOCKNODE(np); in nfs_setattr()
1137 NFSLOCKNODE(np); in nfs_setattr()
1139 (np->n_flag & NMODIFIED) && vp->v_type == VREG) { in nfs_setattr()
1140 NFSUNLOCKNODE(np); in nfs_setattr()
1145 NFSUNLOCKNODE(np); in nfs_setattr()
1151 NFSLOCKNODE(np); in nfs_setattr()
1152 np->n_localmodtime = ts; in nfs_setattr()
1153 NFSUNLOCKNODE(np); in nfs_setattr()
1155 NFSLOCKNODE(np); in nfs_setattr()
1156 np->n_size = np->n_vattr.na_size = tsize; in nfs_setattr()
1158 NFSUNLOCKNODE(np); in nfs_setattr()
1171 struct nfsnode *np = VTONFS(vp); in nfs_setattrrpc() local
1176 NFSLOCKNODE(np); in nfs_setattrrpc()
1178 np->n_accesscache[i].stamp = 0; in nfs_setattrrpc()
1179 np->n_flag |= NDELEGMOD; in nfs_setattrrpc()
1180 NFSUNLOCKNODE(np); in nfs_setattrrpc()
1209 struct nfsnode *np, *newnp; in nfs_lookup() local
1225 np = VTONFS(dvp); in nfs_lookup()
1228 NFSLOCKNODE(np); in nfs_lookup()
1229 while (NFSHASNFSV4(nmp) && (np->n_flag & NREMOVEINPROG)) { in nfs_lookup()
1230 np->n_flag |= NREMOVEWANT; in nfs_lookup()
1231 (void) msleep((caddr_t)np, &np->n_mtx, PZERO, "nfslkup", 0); in nfs_lookup()
1233 NFSUNLOCKNODE(np); in nfs_lookup()
1381 NFSLOCKNODE(np); in nfs_lookup()
1382 if (timespeccmp(&np->n_vattr.na_mtime, in nfs_lookup()
1384 NFSUNLOCKNODE(np); in nfs_lookup()
1388 NFSUNLOCKNODE(np); in nfs_lookup()
1397 if (NFS_CMPFH(np, nfhp->nfh_fh, nfhp->nfh_len)) { in nfs_lookup()
1401 error = nfscl_nget(mp, dvp, nfhp, cnp, td, &np, LK_EXCLUSIVE); in nfs_lookup()
1404 newvp = NFSTOV(np); in nfs_lookup()
1413 NFSLOCKNODE(np); in nfs_lookup()
1414 if (timespecisset(&np->n_localmodtime) && in nfs_lookup()
1415 timespeccmp(&np->n_localmodtime, &ts, >=)) { in nfs_lookup()
1420 NFSUNLOCKNODE(np); in nfs_lookup()
1444 error = nfscl_nget(mp, dvp, nfhp, cnp, td, &np, in nfs_lookup()
1447 newvp = NFSTOV(np); in nfs_lookup()
1464 } else if (NFS_CMPFH(np, nfhp->nfh_fh, nfhp->nfh_len)) { in nfs_lookup()
1471 error = nfscl_nget(mp, dvp, nfhp, cnp, td, &np, in nfs_lookup()
1475 newvp = NFSTOV(np); in nfs_lookup()
1484 NFSLOCKNODE(np); in nfs_lookup()
1485 if (timespecisset(&np->n_localmodtime) && in nfs_lookup()
1486 timespeccmp(&np->n_localmodtime, &ts, >=)) { in nfs_lookup()
1491 NFSUNLOCKNODE(np); in nfs_lookup()
1495 !(np->n_flag & NMODIFIED)) { in nfs_lookup()
1502 NFSLOCKNODE(np); in nfs_lookup()
1503 np->n_attrstamp = 0; in nfs_lookup()
1505 NFSUNLOCKNODE(np); in nfs_lookup()
1650 struct nfsnode *np = NULL, *dnp; in nfs_mknodrpc() local
1674 curthread, &np, LK_EXCLUSIVE); in nfs_mknodrpc()
1679 newvp = NFSTOV(np); in nfs_mknodrpc()
1747 struct nfsnode *np = NULL, *dnp; in nfs_create() local
1788 curthread, &np, LK_EXCLUSIVE); in nfs_create()
1793 newvp = NFSTOV(np); in nfs_create()
1870 struct nfsnode *np = VTONFS(vp); in nfs_remove() local
1877 else if (vrefcnt(vp) == 1 || (np->n_sillyrename && in nfs_remove()
1905 } else if (!np->n_sillyrename) in nfs_remove()
1907 NFSLOCKNODE(np); in nfs_remove()
1908 np->n_attrstamp = 0; in nfs_remove()
1909 NFSUNLOCKNODE(np); in nfs_remove()
2156 struct nfsnode *np, *tdnp; in nfs_link() local
2183 np = VTONFS(vp); in nfs_link()
2184 NFSLOCKNODE(np); in nfs_link()
2185 np->n_attrstamp = 0; in nfs_link()
2186 NFSUNLOCKNODE(np); in nfs_link()
2220 struct nfsnode *np = NULL, *dnp; in nfs_symlink() local
2230 &np, LK_EXCLUSIVE); in nfs_symlink()
2232 newvp = NFSTOV(np); in nfs_symlink()
2246 cnp->cn_cred, curthread, &np); in nfs_symlink()
2248 newvp = NFSTOV(np); in nfs_symlink()
2298 struct nfsnode *np = NULL, *dnp; in nfs_mkdir() local
2324 &np, LK_EXCLUSIVE); in nfs_mkdir()
2326 newvp = NFSTOV(np); in nfs_mkdir()
2335 cnp->cn_cred, curthread, &np); in nfs_mkdir()
2337 newvp = NFSTOV(np); in nfs_mkdir()
2420 struct nfsnode *np = VTONFS(vp); in nfs_readdir() local
2434 NFSLOCKNODE(np); in nfs_readdir()
2435 if (np->n_direofoffset > 0 && uio->uio_offset >= np->n_direofoffset && in nfs_readdir()
2436 (np->n_flag & NMODIFIED) == 0) { in nfs_readdir()
2437 NFSUNLOCKNODE(np); in nfs_readdir()
2439 NFSLOCKNODE(np); in nfs_readdir()
2440 if ((NFS_ISV4(vp) && np->n_change == vattr.va_filerev) || in nfs_readdir()
2441 !NFS_TIMESPEC_COMPARE(&np->n_mtime, &vattr.va_mtime)) { in nfs_readdir()
2442 NFSUNLOCKNODE(np); in nfs_readdir()
2448 NFSUNLOCKNODE(np); in nfs_readdir()
2451 NFSUNLOCKNODE(np); in nfs_readdir()
2631 struct nfsnode *np; in nfs_sillyrename() local
2637 np = VTONFS(vp); in nfs_sillyrename()
2667 curthread, &np); in nfs_sillyrename()
2668 np->n_sillyrename = sp; in nfs_sillyrename()
2690 struct nfsnode *np, *dnp = VTONFS(dvp); in nfs_lookitup() local
2705 np = *npp; in nfs_lookitup()
2706 vp = NFSTOV(np); in nfs_lookitup()
2711 if (np->n_v4 != NULL && nfsva.na_type == VREG && in nfs_lookitup()
2712 (np->n_v4->n4_namelen != len || in nfs_lookitup()
2713 NFSBCMP(name, NFS4NODENAME(np->n_v4), len) || in nfs_lookitup()
2714 dnp->n_fhp->nfh_len != np->n_v4->n4_fhlen || in nfs_lookitup()
2715 NFSBCMP(dnp->n_fhp->nfh_fh, np->n_v4->n4_data, in nfs_lookitup()
2717 free(np->n_v4, M_NFSV4NODE); in nfs_lookitup()
2718 np->n_v4 = malloc( in nfs_lookitup()
2722 np->n_v4->n4_fhlen = dnp->n_fhp->nfh_len; in nfs_lookitup()
2723 np->n_v4->n4_namelen = len; in nfs_lookitup()
2724 NFSBCOPY(dnp->n_fhp->nfh_fh, np->n_v4->n4_data, in nfs_lookitup()
2726 NFSBCOPY(name, NFS4NODENAME(np->n_v4), len); in nfs_lookitup()
2730 onfhp = np->n_fhp; in nfs_lookitup()
2735 np->n_fhp = nfhp; in nfs_lookitup()
2738 newvp = NFSTOV(np); in nfs_lookitup()
2747 &np, LK_EXCLUSIVE); in nfs_lookitup()
2750 newvp = NFSTOV(np); in nfs_lookitup()
2759 NFSLOCKNODE(np); in nfs_lookitup()
2760 if (timespecisset(&np->n_localmodtime) && in nfs_lookitup()
2761 timespeccmp(&np->n_localmodtime, &ts, >=)) { in nfs_lookitup()
2766 NFSUNLOCKNODE(np); in nfs_lookitup()
2787 *npp = np; in nfs_lookitup()
2803 struct nfsnode *np; in ncl_commit() local
2807 np = VTONFS(vp); in ncl_commit()
2810 if (NFSHASPNFS(nmp) && (np->n_flag & NDSCOMMIT) != 0) { in ncl_commit()
2816 NFSLOCKNODE(np); in ncl_commit()
2817 np->n_flag &= ~NDSCOMMIT; in ncl_commit()
2818 NFSUNLOCKNODE(np); in ncl_commit()
2908 struct nfsnode *np = VTONFS(vp); in ncl_flush() local
3201 NFSLOCKNODE(np); in ncl_flush()
3202 np->n_attrstamp = 0; in ncl_flush()
3204 NFSLOCKNODE(np); in ncl_flush()
3205 if (np->n_flag & NWRITEERR) { in ncl_flush()
3206 error = np->n_error; in ncl_flush()
3207 np->n_flag &= ~NWRITEERR; in ncl_flush()
3211 np->n_flag &= ~NMODIFIED; in ncl_flush()
3212 NFSUNLOCKNODE(np); in ncl_flush()
3231 NFSLOCKNODE(np); in ncl_flush()
3232 np->n_localmodtime = ts; in ncl_flush()
3233 NFSUNLOCKNODE(np); in ncl_flush()
3246 struct nfsnode *np = VTONFS(ap->a_vp); in nfs_advlock() local
3260 size = np->n_size; in nfs_advlock()
3275 NFSLOCKNODE(np); in nfs_advlock()
3276 np->n_flag |= NHASBEENLOCKED; in nfs_advlock()
3277 NFSUNLOCKNODE(np); in nfs_advlock()
3317 NFSLOCKNODE(np); in nfs_advlock()
3318 np->n_flag |= NMIGHTBELOCKED; in nfs_advlock()
3319 NFSUNLOCKNODE(np); in nfs_advlock()
3327 ret = nfsrpc_advlock(vp, np->n_size, ap->a_op, in nfs_advlock()
3361 if ((np->n_flag & NMODIFIED) == 0) { in nfs_advlock()
3362 np->n_attrstamp = 0; in nfs_advlock()
3366 if ((np->n_flag & NMODIFIED) || ret || in nfs_advlock()
3367 np->n_change != va.va_filerev) { in nfs_advlock()
3369 np->n_attrstamp = 0; in nfs_advlock()
3373 np->n_mtime = va.va_mtime; in nfs_advlock()
3374 np->n_change = va.va_filerev; in nfs_advlock()
3378 NFSLOCKNODE(np); in nfs_advlock()
3379 np->n_flag |= NHASBEENLOCKED; in nfs_advlock()
3380 NFSUNLOCKNODE(np); in nfs_advlock()
3424 struct nfsnode *np = VTONFS(vp); in nfs_print() local
3426 printf("\tfileid %jd fsid 0x%jx", (uintmax_t)np->n_vattr.na_fileid, in nfs_print()
3427 (uintmax_t)np->n_vattr.na_fsid); in nfs_print()
3480 struct nfsnode *np = VTONFS(ap->a_vp); in nfsfifo_read() local
3486 NFSLOCKNODE(np); in nfsfifo_read()
3487 np->n_flag |= NACC; in nfsfifo_read()
3488 vfs_timestamp(&np->n_atim); in nfsfifo_read()
3489 NFSUNLOCKNODE(np); in nfsfifo_read()
3500 struct nfsnode *np = VTONFS(ap->a_vp); in nfsfifo_write() local
3505 NFSLOCKNODE(np); in nfsfifo_write()
3506 np->n_flag |= NUPD; in nfsfifo_write()
3507 vfs_timestamp(&np->n_mtim); in nfsfifo_write()
3508 NFSUNLOCKNODE(np); in nfsfifo_write()
3521 struct nfsnode *np = VTONFS(vp); in nfsfifo_close() local
3525 NFSLOCKNODE(np); in nfsfifo_close()
3526 if (np->n_flag & (NACC | NUPD)) { in nfsfifo_close()
3528 if (np->n_flag & NACC) in nfsfifo_close()
3529 np->n_atim = ts; in nfsfifo_close()
3530 if (np->n_flag & NUPD) in nfsfifo_close()
3531 np->n_mtim = ts; in nfsfifo_close()
3532 np->n_flag |= NCHG; in nfsfifo_close()
3536 if (np->n_flag & NACC) in nfsfifo_close()
3537 vattr.va_atime = np->n_atim; in nfsfifo_close()
3538 if (np->n_flag & NUPD) in nfsfifo_close()
3539 vattr.va_mtime = np->n_mtim; in nfsfifo_close()
3540 NFSUNLOCKNODE(np); in nfsfifo_close()
3545 NFSUNLOCKNODE(np); in nfsfifo_close()
3635 struct nfsnode *np; in nfs_allocate() local
3643 np = VTONFS(vp); in nfs_allocate()
3672 NFSLOCKNODE(np); in nfs_allocate()
3673 np->n_localmodtime = ts; in nfs_allocate()
3674 NFSUNLOCKNODE(np); in nfs_allocate()
3705 struct nfsnode *np; in nfs_deallocate() local
3714 np = VTONFS(vp); in nfs_deallocate()
3731 if ((uint64_t)*ap->a_offset < np->n_size) { in nfs_deallocate()
3733 mlen = omin((off_t)np->n_size - *ap->a_offset, tlen); in nfs_deallocate()
3753 NFSLOCKNODE(np); in nfs_deallocate()
3754 np->n_localmodtime = ts; in nfs_deallocate()
3755 NFSUNLOCKNODE(np); in nfs_deallocate()