Lines Matching full:stp

145 static void nfsrv_freeopenowner(struct nfsstate *stp, int cansleep,
147 static void nfsrv_freeopen(struct nfsstate *stp, vnode_t vp, int cansleep,
149 static void nfsrv_freelockowner(struct nfsstate *stp, vnode_t vp, int cansleep,
151 static void nfsrv_freeallnfslocks(struct nfsstate *stp, vnode_t vp,
165 struct nfslock *insert_lop, struct nfsstate *stp, struct nfslockfile *lfp);
166 static void nfsrv_updatelock(struct nfsstate *stp, struct nfslock **new_lopp,
186 static int nfsrv_delegconflict(struct nfsstate *stp, int *haslockp,
193 static void nfsrv_delaydelegtimeout(struct nfsstate *stp);
195 struct nfsstate *stp, struct nfsrvcache *op);
196 static int nfsrv_nootherstate(struct nfsstate *stp);
305 struct nfsstate *stp, *tstp;
458 LIST_FOREACH(stp, &clp->lc_open, ls_list) {
459 if (!LIST_EMPTY(&stp->ls_open)) {
666 struct nfsstate *stp;
815 LIST_FOREACH(stp, &clp->lc_deleg, ls_list)
816 stp->ls_flags |= NFSLCK_OLDDELEG;
876 LIST_FOREACH(stp, &clp->lc_stateid[i], ls_hash) {
877 if ((stp->ls_flags & NFSLCK_OPEN) &&
878 stp->ls_uid == nd->nd_cred->cr_uid) {
1102 struct nfsstate *stp, *openstp, *lckownstp;
1138 LIST_FOREACH(stp, &clp->lc_open, ls_list) {
1140 LIST_FOREACH(openstp, &stp->ls_open, ls_list) {
1154 LIST_FOREACH(stp, &clp->lc_deleg, ls_list) {
1157 LIST_FOREACH(stp, &clp->lc_olddeleg, ls_list) {
1169 struct nfsstate *stp;
1206 stp = LIST_FIRST(&lfp->lf_open);
1207 while (stp != LIST_END(&lfp->lf_open) && cnt < maxcnt) {
1208 ldumpp[cnt].ndlck_flags = stp->ls_flags;
1209 ldumpp[cnt].ndlck_stateid.seqid = stp->ls_stateid.seqid;
1210 ldumpp[cnt].ndlck_stateid.other[0] = stp->ls_stateid.other[0];
1211 ldumpp[cnt].ndlck_stateid.other[1] = stp->ls_stateid.other[1];
1212 ldumpp[cnt].ndlck_stateid.other[2] = stp->ls_stateid.other[2];
1214 stp->ls_openowner->ls_ownerlen;
1215 NFSBCOPY(stp->ls_openowner->ls_owner,
1217 stp->ls_openowner->ls_ownerlen);
1218 ldumpp[cnt].ndlck_clid.nclid_idlen = stp->ls_clp->lc_idlen;
1219 NFSBCOPY(stp->ls_clp->lc_id, ldumpp[cnt].ndlck_clid.nclid_id,
1220 stp->ls_clp->lc_idlen);
1221 af = stp->ls_clp->lc_req.nr_nam->sa_family;
1226 rin = (struct sockaddr_in *)stp->ls_clp->lc_req.nr_nam;
1233 stp->ls_clp->lc_req.nr_nam;
1238 stp = LIST_NEXT(stp, ls_file);
1247 stp = lop->lo_stp;
1251 ldumpp[cnt].ndlck_stateid.seqid = stp->ls_stateid.seqid;
1252 ldumpp[cnt].ndlck_stateid.other[0] = stp->ls_stateid.other[0];
1253 ldumpp[cnt].ndlck_stateid.other[1] = stp->ls_stateid.other[1];
1254 ldumpp[cnt].ndlck_stateid.other[2] = stp->ls_stateid.other[2];
1255 ldumpp[cnt].ndlck_owner.nclid_idlen = stp->ls_ownerlen;
1256 NFSBCOPY(stp->ls_owner, ldumpp[cnt].ndlck_owner.nclid_id,
1257 stp->ls_ownerlen);
1258 ldumpp[cnt].ndlck_clid.nclid_idlen = stp->ls_clp->lc_idlen;
1259 NFSBCOPY(stp->ls_clp->lc_id, ldumpp[cnt].ndlck_clid.nclid_id,
1260 stp->ls_clp->lc_idlen);
1261 af = stp->ls_clp->lc_req.nr_nam->sa_family;
1266 rin = (struct sockaddr_in *)stp->ls_clp->lc_req.nr_nam;
1273 stp->ls_clp->lc_req.nr_nam;
1285 stp = LIST_FIRST(&lfp->lf_deleg);
1286 while (stp != LIST_END(&lfp->lf_deleg) && cnt < maxcnt) {
1287 ldumpp[cnt].ndlck_flags = stp->ls_flags;
1288 ldumpp[cnt].ndlck_stateid.seqid = stp->ls_stateid.seqid;
1289 ldumpp[cnt].ndlck_stateid.other[0] = stp->ls_stateid.other[0];
1290 ldumpp[cnt].ndlck_stateid.other[1] = stp->ls_stateid.other[1];
1291 ldumpp[cnt].ndlck_stateid.other[2] = stp->ls_stateid.other[2];
1293 ldumpp[cnt].ndlck_clid.nclid_idlen = stp->ls_clp->lc_idlen;
1294 NFSBCOPY(stp->ls_clp->lc_id, ldumpp[cnt].ndlck_clid.nclid_id,
1295 stp->ls_clp->lc_idlen);
1296 af = stp->ls_clp->lc_req.nr_nam->sa_family;
1301 rin = (struct sockaddr_in *)stp->ls_clp->lc_req.nr_nam;
1308 stp->ls_clp->lc_req.nr_nam;
1313 stp = LIST_NEXT(stp, ls_file);
1342 struct nfsstate *stp, *nstp;
1430 stp = LIST_FIRST(&clp->lc_open);
1431 while (stp != LIST_END(&clp->lc_open)) {
1432 nstp = LIST_NEXT(stp, ls_list);
1433 if (LIST_EMPTY(&stp->ls_open)) {
1434 stp->ls_noopens++;
1435 if (stp->ls_noopens > NFSNOOPEN ||
1441 stp->ls_noopens = 0;
1443 stp = nstp;
1468 struct nfsstate *stp, *nstp;
1471 LIST_FOREACH_SAFE(stp, &clp->lc_open, ls_list, nstp) {
1473 nfsrv_freeopenowner(stp, 0, p);
1475 nfsrv_freeopenowner(stp, 1, p);
1524 struct nfsstate *stp, *nstp;
1526 LIST_FOREACH_SAFE(stp, sthp, ls_list, nstp) {
1527 nfsrv_freedeleg(stp);
1536 nfsrv_freedeleg(struct nfsstate *stp)
1540 LIST_REMOVE(stp, ls_hash);
1541 LIST_REMOVE(stp, ls_list);
1542 LIST_REMOVE(stp, ls_file);
1543 if ((stp->ls_flags & NFSLCK_DELEGWRITE) != 0)
1545 lfp = stp->ls_lfp;
1552 free(stp, M_NFSDSTATE);
1562 nfsrv_freeopenowner(struct nfsstate *stp, int cansleep, NFSPROC_T *p)
1566 LIST_REMOVE(stp, ls_list);
1570 nstp = LIST_FIRST(&stp->ls_open);
1571 while (nstp != LIST_END(&stp->ls_open)) {
1576 if (stp->ls_op)
1577 nfsrvd_derefcache(stp->ls_op);
1578 free(stp, M_NFSDSTATE);
1590 nfsrv_freeopen(struct nfsstate *stp, vnode_t vp, int cansleep, NFSPROC_T *p)
1595 LIST_REMOVE(stp, ls_hash);
1596 LIST_REMOVE(stp, ls_list);
1597 LIST_REMOVE(stp, ls_file);
1599 lfp = stp->ls_lfp;
1605 LIST_FOREACH_SAFE(tstp, &stp->ls_open, ls_list, nstp)
1621 nfsrv_freeallnfslocks(stp, vp, cansleep, p);
1639 free(stp, M_NFSDSTATE);
1648 nfsrv_freelockowner(struct nfsstate *stp, vnode_t vp, int cansleep,
1652 LIST_REMOVE(stp, ls_hash);
1653 LIST_REMOVE(stp, ls_list);
1655 nfsrv_freeallnfslocks(stp, vp, cansleep, p);
1656 if (stp->ls_op)
1657 nfsrvd_derefcache(stp->ls_op);
1658 free(stp, M_NFSDSTATE);
1667 nfsrv_freeallnfslocks(struct nfsstate *stp, vnode_t vp, int cansleep,
1679 lop = LIST_FIRST(&stp->ls_lock);
1680 while (lop != LIST_END(&stp->ls_lock)) {
1760 struct nfsstate *stp;
1766 LIST_FOREACH(stp, hp, ls_hash) {
1767 if (!NFSBCMP(stp->ls_stateid.other, stateidp->other,
1775 if (stp == LIST_END(hp)) {
1779 *stpp = stp;
1793 struct nfsstate *stp;
1796 LIST_FOREACH(stp, hp, ls_list) {
1797 if (new_stp->ls_ownerlen == stp->ls_ownerlen &&
1798 !NFSBCMP(new_stp->ls_owner,stp->ls_owner,stp->ls_ownerlen)) {
1799 *stpp = stp;
1830 struct nfsstate *stp, *lckstp = NULL;
1963 new_stp->ls_flags, &stp);
1968 if (error == 0 && (stp->ls_flags & NFSLCK_OPEN) &&
1969 ((stp->ls_openowner->ls_flags & NFSLCK_NEEDSCONFIRM) ||
1970 (getlckret == 0 && stp->ls_lfp != lfp))){
1981 (stp->ls_flags & (NFSLCK_DELEGREAD | NFSLCK_DELEGWRITE)) &&
1982 getlckret == 0 && stp->ls_lfp != lfp)
1993 if (error == 0 && (stp->ls_flags &
1995 getlckret == 0 && stp->ls_lfp != lfp) {
2010 if (stp->ls_flags & NFSLCK_OPEN)
2012 stp->ls_openowner, new_stp->ls_op);
2017 nfsrv_getowner(&stp->ls_open, new_stp, &lckstp);
2038 if (stp->ls_flags & NFSLCK_OPEN)
2042 stp, new_stp->ls_op);
2044 lckstp = stp;
2046 lckstp = stp;
2059 if (!error && stp->ls_stateid.seqid!=new_stp->ls_stateid.seqid &&
2161 if (stp->ls_flags & (NFSLCK_DELEGREAD | NFSLCK_DELEGWRITE)) {
2163 mystp = stp;
2164 nfsrv_delaydelegtimeout(stp);
2165 } else if (stp->ls_flags & NFSLCK_OPEN) {
2166 mystp = stp;
2168 mystp = stp->ls_openstp;
2346 nfsrv_updatelock(stp, new_lopp, &other_lop, lfp);
2347 stateidp->seqid = ++(stp->ls_stateid.seqid);
2349 stateidp->seqid = stp->ls_stateid.seqid = 1;
2350 stateidp->other[0] = stp->ls_stateid.other[0];
2351 stateidp->other[1] = stp->ls_stateid.other[1];
2352 stateidp->other[2] = stp->ls_stateid.other[2];
2503 new_stp->ls_openstp = stp;
2509 LIST_INSERT_HEAD(&stp->ls_open, new_stp, ls_list);
2550 struct nfsstate *stp, *nstp;
2679 LIST_FOREACH(stp, &lfp->lf_deleg, ls_file) {
2680 if (!(stp->ls_flags & NFSLCK_OLDDELEG) &&
2683 stateidp->seqid == stp->ls_stateid.seqid) &&
2684 !NFSBCMP(stateidp->other, stp->ls_stateid.other,
2688 if (stp == LIST_END(&lfp->lf_deleg) ||
2690 (stp->ls_flags & NFSLCK_DELEGREAD))) {
2706 LIST_FOREACH(stp, &lfp->lf_open, ls_file) {
2709 ((stp->ls_flags>>NFSLCK_SHIFT) & NFSLCK_ACCESSBITS))||
2710 ((stp->ls_flags & NFSLCK_ACCESSBITS) &
2712 ret = nfsrv_clientconflict(stp->ls_clp,&haslock,vp,p);
2761 stp = LIST_FIRST(&lfp->lf_deleg);
2762 while (stp != LIST_END(&lfp->lf_deleg)) {
2763 nstp = LIST_NEXT(stp, ls_file);
2764 if ((readonly && stp->ls_clp != clp &&
2765 (stp->ls_flags & NFSLCK_DELEGWRITE) != 0) ||
2766 (!readonly && (stp->ls_clp != clp ||
2767 ((stp->ls_flags & NFSLCK_DELEGREAD) != 0 &&
2769 ret = nfsrv_delegconflict(stp, &haslock, p, vp);
2781 stp = nstp;
2806 struct nfsstate *stp, *nstp;
2944 LIST_FOREACH(stp, &lfp->lf_deleg, ls_file) {
2945 if (!(stp->ls_flags & NFSLCK_OLDDELEG) &&
2948 stateidp->seqid == stp->ls_stateid.seqid) &&
2949 !NFSBCMP(stateidp->other, stp->ls_stateid.other,
2953 if (stp == LIST_END(&lfp->lf_deleg) ||
2955 (stp->ls_flags & NFSLCK_DELEGREAD))) {
2974 nfsrv_delaydelegtimeout(stp);
2984 LIST_FOREACH(stp, &lfp->lf_open, ls_file) {
2985 if (ownerstp && stp->ls_openowner == ownerstp)
2986 openstp = stp;
2993 if (clp != stp->ls_clp) {
2994 if ((stp->ls_flags & NFSLCK_SHAREBITS) ==
3001 ((stp->ls_flags>>NFSLCK_SHIFT) & NFSLCK_ACCESSBITS))||
3002 ((stp->ls_flags & NFSLCK_ACCESSBITS) &
3004 ret = nfsrv_clientconflict(stp->ls_clp,&haslock,vp,p);
3057 stp = LIST_FIRST(&lfp->lf_deleg);
3058 while (stp != LIST_END(&lfp->lf_deleg)) {
3059 nstp = LIST_NEXT(stp, ls_file);
3060 if (stp->ls_clp != clp && (stp->ls_flags & NFSLCK_DELEGREAD))
3062 else if (stp->ls_clp != clp ||
3063 (stp->ls_flags & NFSLCK_DELEGWRITE) != 0 ||
3066 if ((readonly && stp->ls_clp != clp &&
3067 (stp->ls_flags & NFSLCK_DELEGWRITE) != 0) ||
3068 (!readonly && (stp->ls_clp != clp ||
3069 ((stp->ls_flags & NFSLCK_DELEGREAD) != 0 &&
3074 ret = nfsrv_delegconflict(stp, &haslock, p, vp);
3092 stp = nstp;
3110 LIST_FOREACH(stp, &clp->lc_olddeleg, ls_list) {
3111 if (stp->ls_lfp == lfp) {
3113 if (stp->ls_clp != clp)
3115 LIST_REMOVE(stp, ls_list);
3116 LIST_REMOVE(stp, ls_hash);
3117 stp->ls_flags &= ~NFSLCK_OLDDELEG;
3118 stp->ls_stateid.seqid = delegstateidp->seqid = 1;
3119 stp->ls_stateid.other[0] = delegstateidp->other[0] =
3121 stp->ls_stateid.other[1] = delegstateidp->other[1] =
3123 stp->ls_stateid.other[2] = delegstateidp->other[2] =
3125 stp->ls_compref = nd->nd_compref;
3126 LIST_INSERT_HEAD(&clp->lc_deleg, stp, ls_list);
3128 stp->ls_stateid), stp, ls_hash);
3129 if (stp->ls_flags & NFSLCK_DELEGWRITE)
3145 if (stp->ls_flags & NFSLCK_DELEGWRITE)
3182 if (stp == LIST_END(&clp->lc_olddeleg))
3191 LIST_FOREACH(stp, &lfp->lf_deleg, ls_file) {
3192 if (stp->ls_clp == clp)
3195 if (stp == LIST_END(&lfp->lf_deleg) && openstp == NULL) {
3297 stp = LIST_FIRST(&ownerstp->ls_open);
3298 stp->ls_flags = (new_stp->ls_flags & NFSLCK_SHAREBITS) |
3300 stp->ls_stateid.seqid = 1;
3301 stp->ls_uid = new_stp->ls_uid;
3302 if (lfp != stp->ls_lfp) {
3303 LIST_REMOVE(stp, ls_file);
3304 LIST_INSERT_HEAD(&lfp->lf_open, stp, ls_file);
3305 stp->ls_lfp = lfp;
3307 openstp = stp;
3448 struct nfsstate *stp;
3471 new_stp->ls_flags, &stp);
3476 if (!error && (!(stp->ls_flags & NFSLCK_OPEN) ||
3478 (stp->ls_openowner->ls_flags & NFSLCK_NEEDSCONFIRM)) ||
3480 (!(stp->ls_openowner->ls_flags & NFSLCK_NEEDSCONFIRM)))))
3485 stp->ls_openowner, new_stp->ls_op);
3486 if (!error && stp->ls_stateid.seqid != new_stp->ls_stateid.seqid &&
3508 nfsrv_nootherstate(stp))
3509 nfsrv_freeopenowner(stp->ls_openowner, 0, p);
3517 stateidp->seqid = stp->ls_stateid.seqid + 1;
3520 stateidp->other[0] = stp->ls_stateid.other[0];
3521 stateidp->other[1] = stp->ls_stateid.other[1];
3522 stateidp->other[2] = stp->ls_stateid.other[2];
3531 if (!(stp->ls_openowner->ls_flags & NFSLCK_NEEDSCONFIRM))
3533 stp->ls_openowner->ls_flags = 0;
3534 stp->ls_stateid.seqid++;
3536 stp->ls_stateid.seqid == 0)
3537 stp->ls_stateid.seqid = 1;
3546 if ((stp->ls_flags & NFSLCK_WRITEACCESS) != 0)
3551 if (nfsrv_dolocallocks != 0 && !LIST_EMPTY(&stp->ls_open)) {
3553 nfsrv_freeopen(stp, vp, 1, p);
3555 nfsrv_freeopen(stp, NULL, 0, p);
3563 if (~(stp->ls_flags) & bits) {
3568 stp->ls_flags = (bits | NFSLCK_OPEN);
3569 stp->ls_stateid.seqid++;
3571 stp->ls_stateid.seqid == 0)
3572 stp->ls_stateid.seqid = 1;
3599 struct nfsstate *stp;
3636 error = nfsrv_getstate(clp, stateidp, NFSLCK_DELEGRETURN, &stp);
3637 if (!error && stp->ls_stateid.seqid != stateidp->seqid &&
3656 if (NFSBCMP((caddr_t)&fh, (caddr_t)&stp->ls_lfp->lf_fh,
3663 if ((stp->ls_flags & NFSLCK_DELEGWRITE) != 0)
3668 nfsrv_freedeleg(stp);
3687 struct nfsstate *stp, *nstp, *openstp, *ownstp;
3711 stp = LIST_FIRST(&openstp->ls_open);
3712 while (stp != LIST_END(&openstp->ls_open)) {
3713 nstp = LIST_NEXT(stp, ls_list);
3718 if (stp->ls_ownerlen == new_stp->ls_ownerlen &&
3719 !NFSBCMP(stp->ls_owner, new_stp->ls_owner,
3720 stp->ls_ownerlen)){
3721 if (LIST_EMPTY(&stp->ls_lock)) {
3722 nfsrv_freelockowner(stp, NULL, 0, p);
3729 stp = nstp;
3831 struct nfsstate *stp, struct nfslockfile *lfp)
3835 new_lop->lo_stp = stp;
3838 if (stp != NULL) {
3858 * Insert after insert_lop, which is overloaded as stp or lfp for
3861 if (stp == NULL && (struct nfslockfile *)insert_lop == lfp)
3863 else if ((struct nfsstate *)insert_lop == stp)
3864 LIST_INSERT_HEAD(&stp->ls_lock, new_lop, lo_lckowner);
3867 if (stp != NULL) {
3881 nfsrv_updatelock(struct nfsstate *stp, struct nfslock **new_lopp,
3895 if (stp != NULL) {
3896 ilop = (struct nfslock *)stp;
3897 lop = LIST_FIRST(&stp->ls_lock);
3987 other_lop->lo_stp = stp;
3990 nfsrv_insertlock(other_lop, lop, stp, lfp);
4006 nfsrv_insertlock(new_lop, ilop, stp, lfp);
4017 struct nfsstate *stp, struct nfsrvcache *op)
4028 if (stp->ls_op && stp->ls_op->rc_refcnt <= 0) {
4029 printf("refcnt=%d\n", stp->ls_op->rc_refcnt);
4037 if ((stp->ls_seq + 1) == seqid) {
4038 if (stp->ls_op)
4039 nfsrvd_derefcache(stp->ls_op);
4040 stp->ls_op = op;
4042 stp->ls_seq = seqid;
4044 } else if (stp->ls_seq == seqid && stp->ls_op &&
4045 op->rc_xid == stp->ls_op->rc_xid &&
4047 op->rc_reqlen == stp->ls_op->rc_reqlen &&
4048 op->rc_cksum == stp->ls_op->rc_cksum) {
4049 if (stp->ls_op->rc_flag & RC_INPROG) {
4053 nd->nd_rp = stp->ls_op;
4760 struct nfsstate *stp;
4777 LIST_FOREACH(stp, &clp->lc_stateid[i], ls_hash) {
4778 if (stp->ls_stateid.other[2] > 0x80000000) {
4779 if (stp->ls_stateid.other[2] < max_index)
4780 max_index = stp->ls_stateid.other[2];
4782 if (stp->ls_stateid.other[2] > min_index)
4783 min_index = stp->ls_stateid.other[2];
4801 LIST_FOREACH(stp, &clp->lc_stateid[i], ls_hash) {
4802 if (stp->ls_stateid.other[2] == canuse) {
5268 nfsrv_delegconflict(struct nfsstate *stp, int *haslockp, NFSPROC_T *p,
5271 struct nfsclient *clp = stp->ls_clp;
5279 if (stp->ls_flags & NFSLCK_OLDDELEG) {
5284 nfsrv_freedeleg(stp);
5311 if ((stp->ls_flags & NFSLCK_DELEGRECALL) == 0 || (stp->ls_lastrecall <
5313 stp->ls_delegtime >= NFSD_MONOSEC)) {
5328 if ((stp->ls_flags & NFSLCK_DELEGRECALL) == 0) {
5329 stp->ls_delegtime = NFSD_MONOSEC + (2 * nfsrv_lease) +
5331 stp->ls_delegtimelimit = NFSD_MONOSEC + (6 *
5333 stp->ls_flags |= NFSLCK_DELEGRECALL;
5335 stp->ls_lastrecall = time_uptime + 1;
5343 * Since nfsrv_docallback will sleep, don't use stp after
5346 NFSBCOPY((caddr_t)&stp->ls_stateid, (caddr_t)&tstateid,
5348 NFSBCOPY((caddr_t)&stp->ls_lfp->lf_fh, (caddr_t)&tfh,
5369 stp->ls_delegtime >= NFSD_MONOSEC) {
5438 nfsrv_freedeleg(stp);
5459 struct nfsstate *stp;
5517 LIST_FOREACH(stp, &lfp->lf_open, ls_file) {
5518 if (stp->ls_flags & NFSLCK_WRITEDENY) {
5550 struct nfsstate *stp, *nstp;
5553 stp = LIST_FIRST(&lfp->lf_deleg);
5554 while (stp != LIST_END(&lfp->lf_deleg)) {
5555 nstp = LIST_NEXT(stp, ls_file);
5556 if (stp->ls_clp != clp) {
5557 ret = nfsrv_delegconflict(stp, haslockp, p, vp);
5566 stp = nstp;
5681 struct nfsstate st, *stp = &st;
5687 stp->ls_flags = (NFSLCK_CHECK | NFSLCK_WRITEACCESS);
5690 stp->ls_flags = 0;
5697 stp->ls_flags |= NFSLCK_SETATTR;
5698 if (stp->ls_flags == 0)
5702 stp->ls_ownerlen = 0;
5703 stp->ls_op = NULL;
5704 stp->ls_uid = nd->nd_cred->cr_uid;
5705 stp->ls_stateid.seqid = stateidp->seqid;
5706 clientid.lval[0] = stp->ls_stateid.other[0] = stateidp->other[0];
5707 clientid.lval[1] = stp->ls_stateid.other[1] = stateidp->other[1];
5708 stp->ls_stateid.other[2] = stateidp->other[2];
5709 error = nfsrv_lockctrl(vp, &stp, &lop, NULL, clientid,
5727 struct nfsstate *stp;
5760 LIST_FOREACH(stp, &lfp->lf_deleg, ls_file) {
5761 if (stp->ls_flags & NFSLCK_DELEGWRITE)
5764 if (stp == LIST_END(&lfp->lf_deleg)) {
5768 clp = stp->ls_clp;
5776 delegfilerev = stp->ls_filerev;
5787 if (nd->nd_compref == stp->ls_compref ||
5839 struct nfsstate *stp, *nstp;
5850 LIST_FOREACH_SAFE(stp, &clp->lc_open, ls_list, nstp) {
5851 if (LIST_EMPTY(&stp->ls_open) &&
5852 (stp->ls_noopens > NFSNOOPEN ||
5855 nfsrv_freeopenowner(stp, 0, p);
5925 nfsrv_delaydelegtimeout(struct nfsstate *stp)
5928 if ((stp->ls_flags & NFSLCK_DELEGRECALL) == 0)
5931 if ((stp->ls_delegtime + 15) > NFSD_MONOSEC &&
5932 stp->ls_delegtime < stp->ls_delegtimelimit) {
5933 stp->ls_delegtime += nfsrv_lease;
5934 if (stp->ls_delegtime > stp->ls_delegtimelimit)
5935 stp->ls_delegtime = stp->ls_delegtimelimit;
5945 nfsrv_nootherstate(struct nfsstate *stp)
5949 LIST_FOREACH(tstp, &stp->ls_openowner->ls_open, ls_list) {
5950 if (tstp != stp || !LIST_EMPTY(&tstp->ls_lock))
6624 struct nfsstate *stp;
6635 LIST_FOREACH(stp, &clp->lc_deleg, ls_list) {
6636 if (!NFSBCMP(stp->ls_stateid.other, stateidp->other,
6640 if (stp != NULL) {
6641 nfsrv_freedeleg(stp);
6648 error = nfsrv_getstate(clp, stateidp, 0, &stp);
6649 if (error == 0 && ((stp->ls_flags & (NFSLCK_OPEN | NFSLCK_DELEGREAD |
6650 NFSLCK_DELEGWRITE)) != 0 || (stp->ls_flags & NFSLCK_LOCK) == 0))
6653 if (error == 0 && !LIST_EMPTY(&stp->ls_lock))
6656 nfsrv_freelockowner(stp, NULL, 0, p);
6669 struct nfsstate *stp;
6679 error = nfsrv_getstate(clp, stateidp, 0, &stp);
6681 SEQ_LT(stateidp->seqid, stp->ls_stateid.seqid))
8176 struct nfsstate *stp;
8223 LIST_FOREACH(stp, &lfp->lf_deleg, ls_file) {
8224 if ((stp->ls_flags & NFSLCK_DELEGWRITE) != 0 &&
8225 nfsrv_fndclid(clid, stp->ls_clp->lc_clientid, clidcnt) != 0)
8228 if (stp != NULL) {
8235 LIST_FOREACH(stp, &lfp->lf_open, ls_file) {
8236 KASSERT((stp->ls_flags & NFSLCK_OPEN) != 0,
8238 if ((stp->ls_flags & NFSLCK_WRITEACCESS) != 0 &&
8239 nfsrv_fndclid(clid, stp->ls_clp->lc_clientid, clidcnt) != 0)
8243 if (stp != NULL)