Lines Matching refs:cs
200 struct svc_req *req, struct compound_state *cs);
268 struct compound_state *cs, struct nfs4_svgetit_arg *sargp,
593 rfs4_init_compound_state(struct compound_state *cs)
595 bzero(cs, sizeof (*cs));
596 cs->cont = TRUE;
597 cs->access = CS_ACCESS_DENIED;
598 cs->deleg = FALSE;
599 cs->mandlock = FALSE;
600 cs->fh.nfs_fh4_val = cs->fhbuf;
844 struct compound_state *cs)
846 *cs->statusp = *((nfsstat4 *)&(resop)->nfs_resop4_u) = NFS4ERR_INVAL;
870 do_rfs4_op_secinfo(struct compound_state *cs, char *nm, SECINFO4res *resp)
883 dvp = cs->vp;
897 if (cs->vp->v_flag & VROOT) {
909 dvp = untraverse(cs->vp);
923 different_export = nfs_exported(cs->exi, cs->vp);
930 error = VOP_LOOKUP(dvp, nm, &vp, NULL, 0, NULL, cs->cr,
942 (PSEUDO(cs->exi) || ! is_exported_sec(cs->nfsflavor, cs->exi) ||
943 cs->access & CS_ACCESS_LIMITED)) {
944 if (! nfs_visible(cs->exi, vp, &different_export)) {
987 exi = nfs_vptoexi(NULL, vp, cs->cr, &walk, NULL, TRUE);
1000 exi = cs->exi;
1007 exi = cs->exi;
1064 access = nfsauth4_secinfo_access(exi, cs->req,
1065 flavor, perm, cs->basecr);
1126 struct compound_state *cs)
1137 DTRACE_NFSV4_2(op__secinfo__start, struct compound_state *, cs,
1144 if (cs->vp == NULL) {
1145 *cs->statusp = resp->status = NFS4ERR_NOFILEHANDLE;
1149 if (cs->vp->v_type != VDIR) {
1150 *cs->statusp = resp->status = NFS4ERR_NOTDIR;
1164 *cs->statusp = resp->status = status;
1171 *cs->statusp = resp->status = NFS4ERR_INVAL;
1176 *cs->statusp = resp->status = NFS4ERR_NAMETOOLONG;
1182 name = nfscmd_convname(ca, cs->exi, nm, NFSCMD_CONV_INBOUND,
1186 *cs->statusp = resp->status = NFS4ERR_INVAL;
1192 *cs->statusp = resp->status = do_rfs4_op_secinfo(cs, name, resp);
1199 DTRACE_NFSV4_2(op__secinfo__done, struct compound_state *, cs,
1239 struct compound_state *cs)
1247 cred_t *cr = cs->cr;
1252 DTRACE_NFSV4_2(op__access__start, struct compound_state *, cs,
1255 #if 0 /* XXX allow access even if !cs->access. Eventually only pseudo fs */
1256 if (cs->access == CS_ACCESS_DENIED) {
1257 *cs->statusp = resp->status = NFS4ERR_ACCESS;
1261 if (cs->vp == NULL) {
1262 *cs->statusp = resp->status = NFS4ERR_NOFILEHANDLE;
1268 vp = cs->vp;
1276 if (rdonly4(req, cs) &&
1292 *cs->statusp = resp->status = puterrno4(error);
1305 if ((tslabel = nfs_getflabel(vp, cs->exi)) == NULL) {
1306 *cs->statusp = resp->status = puterrno4(EACCES);
1366 *cs->statusp = resp->status = NFS4_OK;
1368 DTRACE_NFSV4_2(op__access__done, struct compound_state *, cs,
1375 struct compound_state *cs)
1380 vnode_t *vp = cs->vp;
1381 cred_t *cr = cs->cr;
1384 DTRACE_NFSV4_2(op__commit__start, struct compound_state *, cs,
1388 *cs->statusp = resp->status = NFS4ERR_NOFILEHANDLE;
1391 if (cs->access == CS_ACCESS_DENIED) {
1392 *cs->statusp = resp->status = NFS4ERR_ACCESS;
1397 *cs->statusp = resp->status = NFS4ERR_INVAL;
1409 *cs->statusp = resp->status = puterrno4(error);
1412 if (rdonly4(req, cs)) {
1413 *cs->statusp = resp->status = NFS4ERR_ROFS;
1422 *cs->statusp = resp->status;
1427 (error = VOP_ACCESS(vp, VWRITE, 0, cs->cr, NULL))) {
1428 *cs->statusp = resp->status = puterrno4(error);
1435 *cs->statusp = resp->status = puterrno4(error);
1439 *cs->statusp = resp->status = NFS4_OK;
1442 DTRACE_NFSV4_2(op__commit__done, struct compound_state *, cs,
1453 struct compound_state *cs, vattr_t *vap, char *nm)
1456 cred_t *cr = cs->cr;
1457 vnode_t *dvp = cs->vp;
1466 *cs->statusp = resp->status = NFS4ERR_PERM;
1484 *cs->statusp = resp->status = NFS4ERR_BADTYPE;
1492 *cs->statusp = resp->status = NFS4ERR_INVAL;
1502 *cs->statusp = resp->status = puterrno4(error);
1515 struct compound_state *cs)
1521 cred_t *cr = cs->cr;
1522 vnode_t *dvp = cs->vp;
1536 DTRACE_NFSV4_2(op__create__start, struct compound_state *, cs,
1542 *cs->statusp = resp->status = NFS4ERR_NOFILEHANDLE;
1551 *cs->statusp = resp->status = NFS4ERR_ACCESS;
1565 *cs->statusp = resp->status = NFS4ERR_BADTYPE;
1569 if (cs->access == CS_ACCESS_DENIED) {
1570 *cs->statusp = resp->status = NFS4ERR_ACCESS;
1574 *cs->statusp = resp->status = NFS4ERR_NOTDIR;
1579 *cs->statusp = resp->status = status;
1583 if (rdonly4(req, cs)) {
1584 *cs->statusp = resp->status = NFS4ERR_ROFS;
1593 *cs->statusp = resp->status = NFS4ERR_INVAL;
1598 *cs->statusp = resp->status = NFS4ERR_NAMETOOLONG;
1604 name = nfscmd_convname(ca, cs->exi, nm, NFSCMD_CONV_INBOUND,
1608 *cs->statusp = resp->status = NFS4ERR_INVAL;
1620 &args->createattrs, cs, &sarg, &ntov, NFS4ATTR_SETIT);
1626 *cs->statusp = resp->status = status;
1639 *cs->statusp = resp->status = puterrno4(error);
1682 if (VOP_GETATTR(dvp, &iva, 0, cs->cr, NULL))
1699 *cs->statusp = resp->status = NFS4ERR_INVAL;
1709 *cs->statusp = resp->status = NFS4ERR_NAMETOOLONG;
1719 lname = nfscmd_convname(ca, cs->exi, lnm,
1723 *cs->statusp = resp->status = NFS4ERR_SERVERFAULT;
1745 if (VOP_GETATTR(dvp, &iva, 0, cs->cr, NULL))
1758 if (VOP_GETATTR(dvp, &iva2, 0, cs->cr, NULL) ||
1774 vp = do_rfs4_op_mknod(args, resp, req, cs, vap, name);
1790 if (VOP_GETATTR(dvp, &iva, 0, cs->cr, NULL))
1800 *cs->statusp = resp->status = puterrno4(error);
1851 error = makefh4(&cs->fh, vp, cs->exi);
1853 *cs->statusp = resp->status = puterrno4(error);
1882 if (cs->vp)
1883 VN_RELE(cs->vp);
1885 cs->vp = vp;
1886 *cs->statusp = resp->status = NFS4_OK;
1888 DTRACE_NFSV4_2(op__create__done, struct compound_state *, cs,
1895 struct compound_state *cs)
1897 DTRACE_NFSV4_2(op__delegpurge__start, struct compound_state *, cs,
1900 rfs4_op_inval(argop, resop, req, cs);
1902 DTRACE_NFSV4_2(op__delegpurge__done, struct compound_state *, cs,
1909 struct compound_state *cs)
1916 DTRACE_NFSV4_2(op__delegreturn__start, struct compound_state *, cs,
1920 resp->status = *cs->statusp = status;
1925 if (cs->vp != dsp->rds_finfo->rf_vp) {
1926 resp->status = *cs->statusp = NFS4ERR_BAD_STATEID;
1934 DTRACE_NFSV4_2(op__delegreturn__done, struct compound_state *, cs,
1977 secinfo_match_or_authnone(struct compound_state *cs)
1983 * Check cs->nfsflavor (from the request) against
1984 * the current export data in cs->exi.
1986 sp = cs->exi->exi_export.ex_secinfo;
1987 for (i = 0; i < cs->exi->exi_export.ex_seccnt; i++) {
1988 if (cs->nfsflavor == sp[i].s_secinfo.sc_nfsnum ||
2000 call_checkauth4(struct compound_state *cs, struct svc_req *req)
2008 if (!secinfo_match_or_authnone(cs)) {
2009 *cs->statusp = NFS4ERR_WRONGSEC;
2010 return (*cs->statusp);
2013 authres = checkauth4(cs, req);
2016 *cs->statusp = NFS4_OK;
2017 if (! (cs->access & CS_ACCESS_LIMITED))
2018 cs->access = CS_ACCESS_OK;
2020 *cs->statusp = NFS4ERR_ACCESS;
2022 *cs->statusp = NFS4ERR_WRONGSEC;
2024 *cs->statusp = NFS4ERR_DELAY;
2026 return (*cs->statusp);
2046 if (sargp->cs->vp)
2047 sargp->xattr = get_fh4_flag(&sargp->cs->fh,
2112 struct compound_state *cs = sargp->cs;
2113 vnode_t *vp = cs->vp;
2122 return (rfs4_vop_getattr(vp, sargp->vap, 0, cs->cr));
2304 struct compound_state *cs)
2312 DTRACE_NFSV4_2(op__getattr__start, struct compound_state *, cs,
2315 if (cs->vp == NULL) {
2316 *cs->statusp = resp->status = NFS4ERR_NOFILEHANDLE;
2320 if (cs->access == CS_ACCESS_DENIED) {
2321 *cs->statusp = resp->status = NFS4ERR_ACCESS;
2326 sarg.cs = cs;
2336 if (vn_is_nfs_reparse(cs->vp, cs->cr)) {
2348 *cs->statusp = resp->status = status;
2350 DTRACE_NFSV4_2(op__getattr__done, struct compound_state *, cs,
2365 struct compound_state *cs)
2369 DTRACE_NFSV4_1(op__getfh__start, struct compound_state *, cs);
2371 if (cs->vp == NULL) {
2372 *cs->statusp = resp->status = NFS4ERR_NOFILEHANDLE;
2375 if (cs->access == CS_ACCESS_DENIED) {
2376 *cs->statusp = resp->status = NFS4ERR_ACCESS;
2381 if (cs->exi->exi_moved || vn_is_nfs_reparse(cs->exi->exi_vp, cs->cr)) {
2383 cs->exi->exi_moved = 1;
2384 *cs->statusp = resp->status = NFS4ERR_MOVED;
2386 vnode_t *, cs->vp, char *, "rfs4_op_getfh");
2391 if (vn_is_nfs_reparse(cs->vp, cs->cr) && !client_is_downrev(req)) {
2393 *cs->statusp = resp->status = NFS4ERR_MOVED;
2395 vnode_t *, cs->vp, char *, "rfs4_op_getfh");
2400 kmem_alloc(cs->fh.nfs_fh4_len, KM_SLEEP);
2401 nfs_fh4_copy(&cs->fh, &resp->object);
2402 *cs->statusp = resp->status = NFS4_OK;
2404 DTRACE_NFSV4_2(op__getfh__done, struct compound_state *, cs,
2428 struct svc_req *req, struct compound_state *cs)
2433 *cs->statusp = resp->status = NFS4ERR_OP_ILLEGAL;
2443 struct compound_state *cs)
2457 DTRACE_NFSV4_2(op__link__start, struct compound_state *, cs,
2461 vp = cs->saved_vp;
2463 *cs->statusp = resp->status = NFS4ERR_NOFILEHANDLE;
2468 dvp = cs->vp;
2470 *cs->statusp = resp->status = NFS4ERR_NOFILEHANDLE;
2479 *cs->statusp = resp->status = NFS4ERR_ACCESS;
2483 if (cs->access == CS_ACCESS_DENIED) {
2484 *cs->statusp = resp->status = NFS4ERR_ACCESS;
2490 *cs->statusp = resp->status = NFS4ERR_ISDIR;
2496 *cs->statusp = resp->status = NFS4ERR_NOTDIR;
2500 if (cs->saved_exi != cs->exi) {
2501 *cs->statusp = resp->status = NFS4ERR_XDEV;
2507 *cs->statusp = resp->status = status;
2513 *cs->statusp = resp->status = NFS4ERR_INVAL;
2518 *cs->statusp = resp->status = NFS4ERR_NAMETOOLONG;
2523 if (rdonly4(req, cs)) {
2524 *cs->statusp = resp->status = NFS4ERR_ROFS;
2531 error = VOP_GETATTR(dvp, &bdva, 0, cs->cr, NULL);
2533 *cs->statusp = resp->status = puterrno4(error);
2539 name = nfscmd_convname(ca, cs->exi, nm, NFSCMD_CONV_INBOUND,
2543 *cs->statusp = resp->status = NFS4ERR_INVAL;
2550 error = VOP_LINK(dvp, vp, name, cs->cr, NULL, 0);
2560 if (VOP_GETATTR(dvp, &idva, 0, cs->cr, NULL))
2566 (void) VOP_FSYNC(vp, FNODSYNC, cs->cr, NULL);
2567 (void) VOP_FSYNC(dvp, 0, cs->cr, NULL);
2570 *cs->statusp = resp->status = puterrno4(error);
2579 if (VOP_GETATTR(dvp, &adva, 0, cs->cr, NULL)) {
2597 *cs->statusp = resp->status = NFS4_OK;
2599 DTRACE_NFSV4_2(op__link__done, struct compound_state *, cs,
2609 do_rfs4_op_lookup(char *nm, struct svc_req *req, struct compound_state *cs)
2620 if (cs->vp->v_flag & V_XATTRDIR) {
2622 ASSERT(get_fh4_flag(&cs->fh, FH4_ATTRDIR));
2625 ASSERT(! get_fh4_flag(&cs->fh, FH4_ATTRDIR));
2642 if (cs->vp->v_flag & VROOT) {
2648 if (VN_CMP(cs->vp, rootdir))
2654 cs->vp = untraverse(cs->vp);
2668 different_export = nfs_exported(cs->exi, cs->vp);
2672 error = VOP_LOOKUP(cs->vp, nm, &vp, NULL, 0, NULL, cs->cr,
2691 (PSEUDO(cs->exi) || ! is_exported_sec(cs->nfsflavor, cs->exi) ||
2692 cs->access & CS_ACCESS_LIMITED)) {
2693 if (! nfs_visible(cs->exi, vp, &different_export)) {
2703 pre_exi = cs->exi; /* save pre-traversed exportinfo */
2717 } else if (vp->v_vfsp != cs->vp->v_vfsp) {
2742 exi = nfs_vptoexi(NULL, vp, cs->cr, &walk, NULL, TRUE);
2767 cs->exi = exi;
2780 crfree(cs->cr);
2781 cs->cr = crdup(cs->basecr);
2783 oldvp = cs->vp;
2784 cs->vp = vp;
2787 stat = call_checkauth4(cs, req);
2789 VN_RELE(cs->vp);
2790 cs->vp = oldvp;
2814 cs->exi)) {
2852 error = makefh4(&cs->fh, vp, cs->exi);
2857 VN_RELE(cs->vp);
2858 cs->vp = oldvp;
2865 if (cs->vp)
2866 VN_RELE(cs->vp);
2867 cs->vp = vp;
2876 set_fh4_flag(&cs->fh, FH4_NAMEDATTR);
2879 cs->mandlock = FALSE;
2887 struct compound_state *cs)
2897 DTRACE_NFSV4_2(op__lookup__start, struct compound_state *, cs,
2900 if (cs->vp == NULL) {
2901 *cs->statusp = resp->status = NFS4ERR_NOFILEHANDLE;
2905 if (cs->vp->v_type == VLNK) {
2906 *cs->statusp = resp->status = NFS4ERR_SYMLINK;
2910 if (cs->vp->v_type != VDIR) {
2911 *cs->statusp = resp->status = NFS4ERR_NOTDIR;
2917 *cs->statusp = resp->status = status;
2923 *cs->statusp = resp->status = NFS4ERR_INVAL;
2928 *cs->statusp = resp->status = NFS4ERR_NAMETOOLONG;
2934 name = nfscmd_convname(ca, cs->exi, nm, NFSCMD_CONV_INBOUND,
2938 *cs->statusp = resp->status = NFS4ERR_INVAL;
2943 *cs->statusp = resp->status = do_rfs4_op_lookup(name, req, cs);
2950 DTRACE_NFSV4_2(op__lookup__done, struct compound_state *, cs,
2957 struct compound_state *cs)
2961 DTRACE_NFSV4_1(op__lookupp__start, struct compound_state *, cs);
2963 if (cs->vp == NULL) {
2964 *cs->statusp = resp->status = NFS4ERR_NOFILEHANDLE;
2968 if (cs->vp->v_type != VDIR) {
2969 *cs->statusp = resp->status = NFS4ERR_NOTDIR;
2973 *cs->statusp = resp->status = do_rfs4_op_lookup("..", req, cs);
2980 *cs->statusp = resp->status = NFS4_OK;
2984 DTRACE_NFSV4_2(op__lookupp__done, struct compound_state *, cs,
2992 struct compound_state *cs)
3000 DTRACE_NFSV4_2(op__openattr__start, struct compound_state *, cs,
3003 if (cs->vp == NULL) {
3004 *cs->statusp = resp->status = NFS4ERR_NOFILEHANDLE;
3008 if ((cs->vp->v_vfsp->vfs_flag & VFS_XATTR) == 0 &&
3009 !vfs_has_feature(cs->vp->v_vfsp, VFSFT_SYSATTR_VIEWS)) {
3010 *cs->statusp = resp->status = puterrno4(ENOTSUP);
3019 if (vfs_has_feature(cs->vp->v_vfsp, VFSFT_ACEMASKONACCESS))
3020 error = VOP_ACCESS(cs->vp, ACE_READ_NAMED_ATTRS,
3021 V_ACE_MASK, cs->cr, NULL);
3023 error = ((VOP_ACCESS(cs->vp, VREAD, 0, cs->cr, NULL) != 0) &&
3024 (VOP_ACCESS(cs->vp, VWRITE, 0, cs->cr, NULL) != 0) &&
3025 (VOP_ACCESS(cs->vp, VEXEC, 0, cs->cr, NULL) != 0));
3028 *cs->statusp = resp->status = puterrno4(EACCES);
3046 if (args->createdir && ! (exp_ro = rdonly4(req, cs)))
3049 error = VOP_LOOKUP(cs->vp, "", &avp, NULL, lookup_flags, NULL, cs->cr,
3054 *cs->statusp = resp->status = puterrno4(EROFS);
3056 *cs->statusp = resp->status = puterrno4(ENOTSUP);
3058 *cs->statusp = resp->status = puterrno4(error);
3064 error = makefh4(&cs->fh, avp, cs->exi);
3068 *cs->statusp = resp->status = puterrno4(error);
3072 VN_RELE(cs->vp);
3073 cs->vp = avp;
3081 set_fh4_flag(&cs->fh, FH4_ATTRDIR);
3082 *cs->statusp = resp->status = NFS4_OK;
3085 DTRACE_NFSV4_2(op__openattr__done, struct compound_state *, cs,
3133 struct compound_state *cs)
3145 bool_t *deleg = &cs->deleg;
3155 DTRACE_NFSV4_2(op__read__start, struct compound_state *, cs,
3158 vp = cs->vp;
3160 *cs->statusp = resp->status = NFS4ERR_NOFILEHANDLE;
3163 if (cs->access == CS_ACCESS_DENIED) {
3164 *cs->statusp = resp->status = NFS4ERR_ACCESS;
3170 *cs->statusp = resp->status = stat;
3183 *cs->statusp = resp->status = NFS4ERR_LOCKED;
3190 *cs->statusp = resp->status = NFS4ERR_INVAL;
3200 verror = VOP_GETATTR(vp, &va, 0, cs->cr, &ct);
3207 *cs->statusp = resp->status = puterrno4(verror);
3212 *cs->statusp = resp->status =
3217 if (crgetuid(cs->cr) != va.va_uid &&
3218 (error = VOP_ACCESS(vp, VREAD, 0, cs->cr, &ct)) &&
3219 (error = VOP_ACCESS(vp, VEXEC, 0, cs->cr, &ct))) {
3220 *cs->statusp = resp->status = puterrno4(error);
3225 *cs->statusp = resp->status = NFS4ERR_ACCESS;
3231 *cs->statusp = resp->status = NFS4_OK;
3239 *cs->statusp = resp->status = NFS4_OK;
3246 *cs->statusp = resp->status = NFS4_OK;
3274 if (!VOP_REQZCBUF(vp, UIO_READ, (xuio_t *)uiop, cs->cr, &ct)) {
3321 error = do_io(FREAD, vp, uiop, 0, cs->cr, &ct);
3324 verror = VOP_GETATTR(vp, &va, 0, cs->cr, &ct);
3329 *cs->statusp = resp->status = puterrno4(error);
3339 *cs->statusp = resp->status = NFS4_OK;
3359 *cs->statusp = resp->status = NFS4ERR_INVAL;
3372 DTRACE_NFSV4_2(op__read__done, struct compound_state *, cs,
3405 struct compound_state *cs)
3413 DTRACE_NFSV4_1(op__putpubfh__start, struct compound_state *, cs);
3415 if (cs->vp) {
3416 VN_RELE(cs->vp);
3417 cs->vp = NULL;
3420 if (cs->cr)
3421 crfree(cs->cr);
3423 cs->cr = crdup(cs->basecr);
3427 *cs->statusp = resp->status = NFS4ERR_SERVERFAULT;
3431 error = makefh4(&cs->fh, vp, exi_public);
3433 *cs->statusp = resp->status = puterrno4(error);
3436 sav_exi = cs->exi;
3443 fh_fmtp = (nfs_fh4_fmt_t *)cs->fh.nfs_fh4_val;
3452 cs->exi = ((exi != NULL) ? exi : exi_public);
3457 cs->exi = exi_public;
3470 cs->exi)) {
3471 *cs->statusp = resp->status =
3479 cs->vp = vp;
3481 if ((resp->status = call_checkauth4(cs, req)) != NFS4_OK) {
3482 VN_RELE(cs->vp);
3483 cs->vp = NULL;
3484 cs->exi = sav_exi;
3488 *cs->statusp = resp->status = NFS4_OK;
3490 DTRACE_NFSV4_2(op__putpubfh__done, struct compound_state *, cs,
3513 struct compound_state *cs)
3519 DTRACE_NFSV4_2(op__putfh__start, struct compound_state *, cs,
3522 if (cs->vp) {
3523 VN_RELE(cs->vp);
3524 cs->vp = NULL;
3527 if (cs->cr) {
3528 crfree(cs->cr);
3529 cs->cr = NULL;
3534 *cs->statusp = resp->status = NFS4ERR_BADHANDLE;
3539 cs->exi = checkexport4(&fh_fmtp->fh4_fsid, (fid_t *)&fh_fmtp->fh4_xlen,
3542 if (cs->exi == NULL) {
3543 *cs->statusp = resp->status = NFS4ERR_STALE;
3547 cs->cr = crdup(cs->basecr);
3549 ASSERT(cs->cr != NULL);
3551 if (! (cs->vp = nfs4_fhtovp(&args->object, cs->exi, &resp->status))) {
3552 *cs->statusp = resp->status;
3556 if ((resp->status = call_checkauth4(cs, req)) != NFS4_OK) {
3557 VN_RELE(cs->vp);
3558 cs->vp = NULL;
3562 nfs_fh4_copy(&args->object, &cs->fh);
3563 *cs->statusp = resp->status = NFS4_OK;
3564 cs->deleg = FALSE;
3567 DTRACE_NFSV4_2(op__putfh__done, struct compound_state *, cs,
3574 struct compound_state *cs)
3581 DTRACE_NFSV4_1(op__putrootfh__start, struct compound_state *, cs);
3583 if (cs->vp) {
3584 VN_RELE(cs->vp);
3585 cs->vp = NULL;
3588 if (cs->cr)
3589 crfree(cs->cr);
3591 cs->cr = crdup(cs->basecr);
3601 *cs->statusp = resp->status = puterrno4(error);
3617 *cs->statusp = resp->status = NFS4ERR_SERVERFAULT;
3625 error = makefh4(&cs->fh, rootdir, exi);
3627 *cs->statusp = resp->status = puterrno4(error);
3631 sav_exi = cs->exi;
3632 cs->exi = exi;
3635 cs->vp = rootdir;
3637 if ((resp->status = call_checkauth4(cs, req)) != NFS4_OK) {
3639 cs->vp = NULL;
3640 cs->exi = sav_exi;
3644 *cs->statusp = resp->status = NFS4_OK;
3645 cs->deleg = FALSE;
3647 DTRACE_NFSV4_2(op__putrootfh__done, struct compound_state *, cs,
3734 struct compound_state *cs)
3747 DTRACE_NFSV4_1(op__readlink__start, struct compound_state *, cs);
3750 vp = cs->vp;
3752 *cs->statusp = resp->status = NFS4ERR_NOFILEHANDLE;
3756 if (cs->access == CS_ACCESS_DENIED) {
3757 *cs->statusp = resp->status = NFS4ERR_ACCESS;
3762 if (vn_is_nfs_reparse(vp, cs->cr) && client_is_downrev(req)) {
3771 *cs->statusp = resp->status = NFS4ERR_ISDIR;
3776 *cs->statusp = resp->status = NFS4ERR_INVAL;
3783 error = VOP_GETATTR(vp, &va, 0, cs->cr, NULL);
3785 *cs->statusp = resp->status = puterrno4(error);
3790 *cs->statusp = resp->status = NFS4ERR_ACCESS;
3801 s = build_symlink(vp, cs->cr, &strsz);
3824 error = VOP_READLINK(vp, &uio, cs->cr, NULL);
3832 *cs->statusp = resp->status = puterrno4(error);
3837 name = nfscmd_convname(ca, cs->exi, data, NFSCMD_CONV_OUTBOUND,
3856 *cs->statusp = resp->status = NFS4_OK;
3859 DTRACE_NFSV4_2(op__readlink__done, struct compound_state *, cs,
3888 struct svc_req *req, struct compound_state *cs)
3902 cs, RELEASE_LOCKOWNER4args *, ap);
3908 *cs->statusp = resp->status =
3916 *cs->statusp = resp->status = NFS4_OK;
3927 *cs->statusp = resp->status = NFS4ERR_EXPIRED;
3960 *cs->statusp = resp->status = NFS4ERR_LOCKS_HELD;
4014 *cs->statusp = resp->status = NFS4_OK;
4018 cs, RELEASE_LOCKOWNER4res *, resp);
4060 struct compound_state *cs)
4076 DTRACE_NFSV4_2(op__remove__start, struct compound_state *, cs,
4080 dvp = cs->vp;
4082 *cs->statusp = resp->status = NFS4ERR_NOFILEHANDLE;
4086 if (cs->access == CS_ACCESS_DENIED) {
4087 *cs->statusp = resp->status = NFS4ERR_ACCESS;
4096 *cs->statusp = resp->status = NFS4ERR_ACCESS;
4101 *cs->statusp = resp->status = NFS4ERR_NOTDIR;
4107 *cs->statusp = resp->status = status;
4116 *cs->statusp = resp->status = NFS4ERR_INVAL;
4121 *cs->statusp = resp->status = NFS4ERR_NAMETOOLONG;
4126 if (rdonly4(req, cs)) {
4127 *cs->statusp = resp->status = NFS4ERR_ROFS;
4133 name = nfscmd_convname(ca, cs->exi, nm, NFSCMD_CONV_INBOUND,
4137 *cs->statusp = resp->status = NFS4ERR_INVAL;
4149 if (fp = rfs4_lookup_and_findfile(dvp, name, &vp, &error, cs->cr)) {
4154 *cs->statusp = resp->status = NFS4ERR_DELAY;
4164 *cs->statusp = resp->status = error;
4175 *cs->statusp = resp->status = NFS4ERR_FILE_OPEN;
4198 cs->exi)) {
4199 *cs->statusp = resp->status = NFS4ERR_ACCESS;
4217 error = VOP_GETATTR(dvp, &bdva, 0, cs->cr, NULL);
4219 *cs->statusp = resp->status = puterrno4(error);
4249 if ((error = VOP_RMDIR(dvp, name, rootdir, cs->cr,
4254 if ((error = VOP_REMOVE(dvp, name, cs->cr, NULL, 0)) == 0 &&
4271 if (!VOP_GETATTR(tvp, &va, 0, cs->cr, NULL) &&
4298 *cs->statusp = resp->status = puterrno4(error);
4306 if (VOP_GETATTR(dvp, &idva, 0, cs->cr, NULL))
4312 (void) VOP_FSYNC(dvp, 0, cs->cr, NULL);
4319 if (VOP_GETATTR(dvp, &adva, 0, cs->cr, NULL)) {
4338 *cs->statusp = resp->status = NFS4_OK;
4341 DTRACE_NFSV4_2(op__remove__done, struct compound_state *, cs,
4354 struct compound_state *cs)
4375 DTRACE_NFSV4_2(op__rename__start, struct compound_state *, cs,
4384 ndvp = cs->vp;
4386 *cs->statusp = resp->status = NFS4ERR_NOFILEHANDLE;
4391 odvp = cs->saved_vp;
4393 *cs->statusp = resp->status = NFS4ERR_NOFILEHANDLE;
4397 if (cs->access == CS_ACCESS_DENIED) {
4398 *cs->statusp = resp->status = NFS4ERR_ACCESS;
4407 *cs->statusp = resp->status = NFS4ERR_ACCESS;
4416 *cs->statusp = resp->status = NFS4ERR_ACCESS;
4421 *cs->statusp = resp->status = NFS4ERR_NOTDIR;
4425 if (cs->saved_exi != cs->exi) {
4426 *cs->statusp = resp->status = NFS4ERR_XDEV;
4432 *cs->statusp = resp->status = status;
4438 *cs->statusp = resp->status = status;
4444 *cs->statusp = resp->status = NFS4ERR_INVAL;
4449 converted_onm = nfscmd_convname(ca, cs->exi, onm, NFSCMD_CONV_INBOUND,
4453 *cs->statusp = resp->status = NFS4ERR_INVAL;
4460 *cs->statusp = resp->status = NFS4ERR_INVAL;
4466 converted_nnm = nfscmd_convname(ca, cs->exi, nnm, NFSCMD_CONV_INBOUND,
4470 *cs->statusp = resp->status = NFS4ERR_INVAL;
4481 *cs->statusp = resp->status = NFS4ERR_NAMETOOLONG;
4488 if (rdonly4(req, cs)) {
4489 *cs->statusp = resp->status = NFS4ERR_ROFS;
4508 EQUALITY_CHECK, cs->exi)) {
4509 *cs->statusp = resp->status = NFS4ERR_ACCESS;
4522 &error, cs->cr)) {
4525 *cs->statusp = resp->status = NFS4ERR_DELAY;
4531 *cs->statusp = resp->status = puterrno4(error);
4545 NULL, cs->cr)) {
4548 *cs->statusp = resp->status = NFS4ERR_DELAY;
4560 *cs->statusp = resp->status = NFS4ERR_FILE_OPEN;
4569 *cs->statusp = resp->status = NFS4ERR_FILE_OPEN;
4576 error = VOP_GETATTR(odvp, &obdva, 0, cs->cr, NULL);
4579 error = VOP_GETATTR(ndvp, &nbdva, 0, cs->cr, NULL);
4582 *cs->statusp = resp->status = puterrno4(error);
4590 cs->cr, NULL, 0)) == 0 && fp != NULL) {
4602 if (!VOP_GETATTR(tvp, &va, 0, cs->cr, NULL) &&
4646 if (VOP_GETATTR(odvp, &oidva, 0, cs->cr, NULL))
4650 if (VOP_GETATTR(ndvp, &nidva, 0, cs->cr, NULL))
4656 (void) VOP_FSYNC(odvp, 0, cs->cr, NULL);
4657 (void) VOP_FSYNC(ndvp, 0, cs->cr, NULL);
4660 *cs->statusp = resp->status = puterrno4(error);
4669 if (VOP_GETATTR(odvp, &oadva, 0, cs->cr, NULL)) {
4675 if (VOP_GETATTR(odvp, &nadva, 0, cs->cr, NULL)) {
4707 if (cs->exi->exi_export.ex_flags & EX_VOLRNM) {
4715 error = VOP_LOOKUP(ndvp, nnm, &vp, NULL, 0, NULL, cs->cr,
4719 add_volrnm_fh(cs->exi, vp);
4726 *cs->statusp = resp->status = NFS4_OK;
4728 DTRACE_NFSV4_2(op__rename__done, struct compound_state *, cs,
4755 DTRACE_NFSV4_2(op__rename__done, struct compound_state *, cs,
4762 struct compound_state *cs)
4768 DTRACE_NFSV4_2(op__renew__start, struct compound_state *, cs,
4772 *cs->statusp = resp->status =
4779 *cs->statusp = resp->status = NFS4ERR_EXPIRED;
4788 *cs->statusp = resp->status = NFS4ERR_CB_PATH_DOWN;
4790 *cs->statusp = resp->status = NFS4_OK;
4797 DTRACE_NFSV4_2(op__renew__done, struct compound_state *, cs,
4804 struct compound_state *cs)
4808 DTRACE_NFSV4_1(op__restorefh__start, struct compound_state *, cs);
4810 /* No need to check cs->access - we are not accessing any object */
4811 if ((cs->saved_vp == NULL) || (cs->saved_fh.nfs_fh4_val == NULL)) {
4812 *cs->statusp = resp->status = NFS4ERR_RESTOREFH;
4815 if (cs->vp != NULL) {
4816 VN_RELE(cs->vp);
4818 cs->vp = cs->saved_vp;
4819 cs->saved_vp = NULL;
4820 cs->exi = cs->saved_exi;
4821 nfs_fh4_copy(&cs->saved_fh, &cs->fh);
4822 *cs->statusp = resp->status = NFS4_OK;
4823 cs->deleg = FALSE;
4826 DTRACE_NFSV4_2(op__restorefh__done, struct compound_state *, cs,
4833 struct compound_state *cs)
4837 DTRACE_NFSV4_1(op__savefh__start, struct compound_state *, cs);
4839 /* No need to check cs->access - we are not accessing any object */
4840 if (cs->vp == NULL) {
4841 *cs->statusp = resp->status = NFS4ERR_NOFILEHANDLE;
4844 if (cs->saved_vp != NULL) {
4845 VN_RELE(cs->saved_vp);
4847 cs->saved_vp = cs->vp;
4848 VN_HOLD(cs->saved_vp);
4849 cs->saved_exi = cs->exi;
4854 if (cs->saved_fh.nfs_fh4_val == NULL) {
4855 cs->saved_fh.nfs_fh4_val = kmem_alloc(NFS4_FHSIZE, KM_SLEEP);
4857 nfs_fh4_copy(&cs->fh, &cs->saved_fh);
4858 *cs->statusp = resp->status = NFS4_OK;
4861 DTRACE_NFSV4_2(op__savefh__done, struct compound_state *, cs,
4898 ret_error = VOP_GETATTR(sargp->cs->vp, sargp->vap, 0,
4899 sargp->cs->cr, NULL);
4923 ret_error = VFS_STATVFS(sargp->cs->vp->v_vfsp, sargp->sbp);
5032 do_rfs4_set_attrs(bitmap4 *resp, fattr4 *fattrp, struct compound_state *cs,
5042 vnode_t *vp = cs->vp;
5059 if (cs->access == CS_ACCESS_DENIED) {
5066 sargp->cs = cs;
5126 do_rfs4_op_setattr(bitmap4 *resp, fattr4 *fattrp, struct compound_state *cs,
5134 cred_t *cr = cs->cr;
5135 vnode_t *vp = cs->vp;
5148 status = do_rfs4_set_attrs(resp, fattrp, cs, &sarg, &ntov,
5175 error = VOP_GETATTR(vp, &va, 0, cs->cr, NULL);
5190 status = rfs4_check_stateid(FWRITE, cs->vp, stateid,
5191 trunc, &cs->deleg, sarg.vap->va_mask & AT_SIZE, &ct);
5358 struct compound_state *cs)
5364 DTRACE_NFSV4_2(op__setattr__start, struct compound_state *, cs,
5367 if (cs->vp == NULL) {
5368 *cs->statusp = resp->status = NFS4ERR_NOFILEHANDLE;
5376 if (vn_ismntpt(cs->vp)) {
5377 *cs->statusp = resp->status = NFS4ERR_ACCESS;
5383 if (rdonly4(req, cs)) {
5384 *cs->statusp = resp->status = NFS4ERR_ROFS;
5396 if (!do_rfs_label_check(clabel, cs->vp,
5397 EQUALITY_CHECK, cs->exi)) {
5398 *cs->statusp = resp->status = NFS4ERR_ACCESS;
5404 *cs->statusp = resp->status =
5405 do_rfs4_op_setattr(&resp->attrsset, &args->obj_attributes, cs,
5409 DTRACE_NFSV4_2(op__setattr__done, struct compound_state *, cs,
5416 struct compound_state *cs)
5432 DTRACE_NFSV4_2(op__verify__start, struct compound_state *, cs,
5435 if (cs->vp == NULL) {
5436 *cs->statusp = resp->status = NFS4ERR_NOFILEHANDLE;
5443 resp->status = do_rfs4_set_attrs(NULL, &args->obj_attributes, cs,
5467 *cs->statusp = resp->status;
5470 DTRACE_NFSV4_2(op__verify__done, struct compound_state *, cs,
5477 struct compound_state *cs)
5493 DTRACE_NFSV4_2(op__nverify__start, struct compound_state *, cs,
5496 if (cs->vp == NULL) {
5497 *cs->statusp = resp->status = NFS4ERR_NOFILEHANDLE;
5498 DTRACE_NFSV4_2(op__nverify__done, struct compound_state *, cs,
5505 resp->status = do_rfs4_set_attrs(NULL, &args->obj_attributes, cs,
5529 *cs->statusp = resp->status;
5532 DTRACE_NFSV4_2(op__nverify__done, struct compound_state *, cs,
5544 struct compound_state *cs)
5558 bool_t *deleg = &cs->deleg;
5563 DTRACE_NFSV4_2(op__write__start, struct compound_state *, cs,
5566 vp = cs->vp;
5568 *cs->statusp = resp->status = NFS4ERR_NOFILEHANDLE;
5571 if (cs->access == CS_ACCESS_DENIED) {
5572 *cs->statusp = resp->status = NFS4ERR_ACCESS;
5576 cr = cs->cr;
5580 *cs->statusp = resp->status = stat;
5593 *cs->statusp = resp->status = NFS4ERR_LOCKED;
5606 *cs->statusp = resp->status = puterrno4(error);
5610 if (rdonly4(req, cs)) {
5611 *cs->statusp = resp->status = NFS4ERR_ROFS;
5616 *cs->statusp = resp->status =
5623 *cs->statusp = resp->status = puterrno4(error);
5628 *cs->statusp = resp->status = NFS4ERR_ACCESS;
5633 *cs->statusp = resp->status = NFS4_OK;
5702 *cs->statusp = resp->status = NFS4ERR_INVAL;
5720 *cs->statusp = resp->status = puterrno4(error);
5724 *cs->statusp = resp->status = NFS4_OK;
5738 DTRACE_NFSV4_2(op__write__done, struct compound_state *, cs,
5751 struct compound_state cs;
5755 rfs4_init_compound_state(&cs);
5765 cs.statusp = &resp->status;
5766 cs.req = req;
5775 &cs, COMPOUND4args *, args);
5778 &cs, COMPOUND4res *, resp);
5793 if (sec_svc_getcred(req, cr, &cs.principal, &cs.nfsflavor) == 0) {
5795 &cs, COMPOUND4args *, args);
5798 &cs, COMPOUND4res *, resp);
5808 cs.basecr = cr;
5810 DTRACE_NFSV4_2(compound__start, struct compound_state *, &cs,
5839 for (i = 0; i < args->array_len && cs.cont; i++) {
5858 (*rfsv4disptab[op].dis_proc)(argop, resop, req, &cs);
5860 rfs4_op_string[op], *cs.statusp));
5861 if (*cs.statusp != NFS4_OK)
5862 cs.cont = FALSE;
5873 rfs4_op_illegal(argop, resop, req, &cs);
5874 cs.cont = FALSE;
5881 if ((i + 1) < args->array_len && !cs.cont) {
5896 DTRACE_NFSV4_2(compound__done, struct compound_state *, &cs,
5899 if (cs.vp)
5900 VN_RELE(cs.vp);
5901 if (cs.saved_vp)
5902 VN_RELE(cs.saved_vp);
5903 if (cs.saved_fh.nfs_fh4_val)
5904 kmem_free(cs.saved_fh.nfs_fh4_val, NFS4_FHSIZE);
5906 if (cs.basecr)
5907 crfree(cs.basecr);
5908 if (cs.cr)
5909 crfree(cs.cr);
6035 creds_ok(cred_set_t cr_set, struct svc_req *req, struct compound_state *cs)
6041 * Look up the pathname using the vp in cs as the directory vnode.
6042 * cs->vp will be the vnode for the file on success
6047 struct compound_state *cs)
6055 if (cs->vp == NULL) {
6058 if (cs->vp->v_type != VDIR) {
6077 name = nfscmd_convname(ca, cs->exi, nm, NFSCMD_CONV_INBOUND,
6085 status = do_rfs4_op_lookup(name, req, cs);
6097 struct compound_state *cs, uint32_t access, change_info4 *cinfo)
6100 vnode_t *dvp = cs->vp;
6106 error = VOP_GETATTR(dvp, &bva, 0, cs->cr, NULL);
6113 status = rfs4_lookup(component, req, cs);
6124 if (VOP_GETATTR(dvp, &ava, 0, cs->cr, NULL)) {
6134 error = VOP_GETATTR(cs->vp, &fva, 0, cs->cr, NULL);
6160 cs->mandlock = MANDLOCK(cs->vp, fva.va_mode);
6161 return (check_open_access(access, cs, req));
6258 check_open_access(uint32_t access, struct compound_state *cs,
6264 cred_t *cr = cs->cr;
6267 if (cs->access == CS_ACCESS_DENIED || cs->mandlock) {
6271 vp = cs->vp;
6279 readonly = rdonly4(req, cs);
6301 rfs4_createfile(OPEN4args *args, struct svc_req *req, struct compound_state *cs,
6330 dvp = cs->vp;
6333 if (rdonly4(req, cs))
6345 cs->exi)) {
6352 * Get the last component of path name in nm. cs will reference
6371 error = VOP_GETATTR(dvp, &bva, 0, cs->cr, NULL);
6394 cs, &sarg, &ntov, NFS4ATTR_SETIT);
6467 name = nfscmd_convname(ca, cs->exi, nm, NFSCMD_CONV_INBOUND,
6476 cs->cr, &vp, &created);
6535 if (VOP_GETATTR(dvp, &iva, 0, cs->cr, NULL)) {
6559 (void) VOP_FSYNC(dvp, 0, cs->cr, NULL);
6566 if (VOP_GETATTR(dvp, &ava, 0, cs->cr, NULL)) {
6592 cs->mandlock = TRUE;
6594 if (VOP_GETATTR(vp, &cva, 0, cs->cr, NULL) == 0) {
6595 cs->mandlock = MANDLOCK(cs->vp, cva.va_mode);
6647 (void) VOP_SETATTR(vp, &cva, 0, cs->cr, &ct);
6653 error = makefh4(&cs->fh, vp, cs->exi);
6658 (void) VOP_FSYNC(vp, FNODSYNC, cs->cr, NULL);
6668 set_fh4_flag(&cs->fh, FH4_NAMEDATTR);
6670 if (cs->vp)
6671 VN_RELE(cs->vp);
6673 cs->vp = vp;
6683 status = check_open_access(args->share_access, cs, req);
6692 rfs4_do_open(struct compound_state *cs, struct svc_req *req,
6714 fp = rfs4_findfile_withlock(cs->vp, &cs->fh, &fcreate);
6737 rfs4_state_close(sp, FALSE, FALSE, cs->cr);
6785 rfs4_state_close(sp, FALSE, FALSE, cs->cr);
6812 rfs4_state_close(sp, FALSE, FALSE, cs->cr);
6830 rfs4_state_close(sp, FALSE, FALSE, cs->cr);
6854 err = VOP_OPEN(&cs->vp, fflags, cs->cr, &ct);
6864 rfs4_state_close(sp, FALSE, FALSE, cs->cr);
6883 vn_open_upgrade(cs->vp, fflags);
6909 cs->deleg = (fp->rf_dinfo.rd_dtype == OPEN_DELEGATE_WRITE);
6931 rfs4_do_opennull(struct compound_state *cs, struct svc_req *req,
6939 req, cs, args->share_access, cinfo);
6946 resp->status = rfs4_createfile(args, req, cs, cinfo, attrset,
6952 /* cs->vp cs->fh now reference the desired file */
6954 rfs4_do_open(cs, req, oo,
6967 *cs->statusp = resp->status;
6975 rfs4_do_openprev(struct compound_state *cs, struct svc_req *req,
6980 vtype_t v_type = cs->vp->v_type;
6995 error = VOP_GETATTR(cs->vp, &va, 0, cs->cr, NULL);
7001 cs->mandlock = MANDLOCK(cs->vp, va.va_mode);
7010 if (crgetuid(cs->cr) != va.va_uid) {
7011 resp->status = check_open_access(args->share_access, cs, req);
7024 rfs4_do_open(cs, req, oo,
7030 rfs4_do_opendelcur(struct compound_state *cs, struct svc_req *req,
7065 ASSERT(cs->vp != NULL);
7066 VN_RELE(cs->vp);
7068 cs->vp = dsp->rds_finfo->rf_vp;
7070 if (error = makefh4(&cs->fh, cs->vp, cs->exi)) {
7072 *cs->statusp = resp->status = puterrno4(error);
7079 rfs4_do_open(cs, req, oo, DELEG_NONE,
7085 rfs4_do_opendelprev(struct compound_state *cs, struct svc_req *req,
7107 req, cs, args->share_access, &resp->cinfo);
7114 fp = rfs4_findfile_withlock(cs->vp, NULL, &create);
7280 struct svc_req *req, struct compound_state *cs)
7292 DTRACE_NFSV4_2(op__open__start, struct compound_state *, cs,
7295 if (cs->vp == NULL) {
7296 *cs->statusp = resp->status = NFS4ERR_NOFILEHANDLE;
7306 *cs->statusp = resp->status =
7313 *cs->statusp = resp->status = NFS4ERR_EXPIRED;
7327 *cs->statusp = resp->status = NFS4ERR_RESOURCE;
7373 *cs->statusp = resp->status = NFS4ERR_GRACE;
7383 *cs->statusp = resp->status = NFS4ERR_NO_GRACE;
7392 *cs->statusp = resp->status = NFS4ERR_NO_GRACE;
7414 if (vn_ismntpt(cs->vp)) {
7415 *cs->statusp = resp->status = NFS4ERR_ACCESS;
7427 *cs->statusp = resp->status = NFS4ERR_INVAL;
7439 rfs4_do_opennull(cs, req, args, oo, resp);
7442 rfs4_do_openprev(cs, req, args, oo, resp);
7445 rfs4_do_opendelcur(cs, req, args, oo, resp);
7448 rfs4_do_opendelprev(cs, req, args, oo, resp);
7480 rfs4_update_open_resp(oo, resop, &cs->fh);
7499 cs->exi = checkexport4(&fh_fmtp->fh4_fsid,
7502 if (cs->exi == NULL) {
7507 VN_RELE(cs->vp);
7509 cs->vp = nfs4_fhtovp(&oo->ro_reply_fh, cs->exi,
7512 if (cs->vp == NULL)
7515 nfs_fh4_copy(&oo->ro_reply_fh, &cs->fh);
7551 *cs->statusp = resp->status;
7557 DTRACE_NFSV4_2(op__open__done, struct compound_state *, cs,
7564 struct svc_req *req, struct compound_state *cs)
7571 DTRACE_NFSV4_2(op__open__confirm__start, struct compound_state *, cs,
7574 if (cs->vp == NULL) {
7575 *cs->statusp = resp->status = NFS4ERR_NOFILEHANDLE;
7579 if (cs->vp->v_type != VREG) {
7580 *cs->statusp = resp->status =
7581 cs->vp->v_type == VDIR ? NFS4ERR_ISDIR : NFS4ERR_INVAL;
7587 *cs->statusp = resp->status = status;
7592 if (cs->vp != sp->rs_finfo->rf_vp) {
7594 *cs->statusp = resp->status = NFS4ERR_BAD_STATEID;
7605 *cs->statusp = resp->status = NFS4ERR_BAD_SEQID;
7614 *cs->statusp = resp->status = NFS4ERR_BAD_STATEID;
7617 *cs->statusp = resp->status = NFS4ERR_OLD_STATEID;
7620 *cs->statusp = resp->status = NFS4ERR_BAD_STATEID;
7623 *cs->statusp = resp->status = NFS4ERR_EXPIRED;
7626 *cs->statusp = resp->status = NFS4ERR_OLD_STATEID;
7638 *cs->statusp = resp->status = NFS4ERR_BAD_SEQID;
7645 *cs->statusp = resp->status;
7653 *cs->statusp = resp->status = NFS4ERR_BAD_SEQID;
7656 *cs->statusp = resp->status = NFS4_OK;
7667 *cs->statusp = resp->status = NFS4ERR_SERVERFAULT;
7674 DTRACE_NFSV4_2(op__open__confirm__done, struct compound_state *, cs,
7681 struct svc_req *req, struct compound_state *cs)
7692 DTRACE_NFSV4_2(op__open__downgrade__start, struct compound_state *, cs,
7695 if (cs->vp == NULL) {
7696 *cs->statusp = resp->status = NFS4ERR_NOFILEHANDLE;
7700 if (cs->vp->v_type != VREG) {
7701 *cs->statusp = resp->status = NFS4ERR_INVAL;
7707 *cs->statusp = resp->status = status;
7712 if (cs->vp != sp->rs_finfo->rf_vp) {
7714 *cs->statusp = resp->status = NFS4ERR_BAD_STATEID;
7725 *cs->statusp = resp->status = NFS4ERR_BAD_SEQID;
7730 *cs->statusp = resp->status = NFS4ERR_OLD_STATEID;
7733 *cs->statusp = resp->status = NFS4ERR_BAD_STATEID;
7736 *cs->statusp = resp->status = NFS4ERR_EXPIRED;
7739 *cs->statusp = resp->status = NFS4ERR_OLD_STATEID;
7742 *cs->statusp = resp->status = NFS4ERR_BAD_STATEID;
7755 *cs->statusp = resp->status = NFS4ERR_BAD_SEQID;
7762 *cs->statusp = resp->status;
7779 *cs->statusp = resp->status = NFS4ERR_INVAL;
7801 *cs->statusp = resp->status = NFS4ERR_INVAL;
7817 *cs->statusp = resp->status = NFS4ERR_SERVERFAULT;
7897 vn_open_downgrade(cs->vp, fflags);
7905 *cs->statusp = resp->status = NFS4_OK;
7916 DTRACE_NFSV4_2(op__open__downgrade__done, struct compound_state *, cs,
7944 struct svc_req *req, struct compound_state *cs)
7954 DTRACE_NFSV4_2(op__setclientid__start, struct compound_state *, cs,
7991 *cs->statusp = res->status = NFS4ERR_SERVERFAULT;
8002 *cs->statusp = res->status = NFS4_OK;
8036 if (!creds_ok(cp_confirmed->rc_cr_set, req, cs)) {
8044 *cs->statusp = res->status = NFS4ERR_CLID_INUSE;
8078 *cs->statusp = res->status = NFS4_OK;
8139 *cs->statusp = res->status = NFS4ERR_SERVERFAULT;
8155 *cs->statusp = res->status = NFS4_OK;
8167 DTRACE_NFSV4_2(op__setclientid__done, struct compound_state *, cs,
8174 struct svc_req *req, struct compound_state *cs)
8183 struct compound_state *, cs,
8186 *cs->statusp = res->status = NFS4_OK;
8191 *cs->statusp = res->status =
8196 if (!creds_ok(cp, req, cs)) {
8197 *cs->statusp = res->status = NFS4ERR_CLID_INUSE;
8204 *cs->statusp = res->status = NFS4ERR_STALE_CLIENTID;
8249 struct compound_state *, cs,
8257 struct svc_req *req, struct compound_state *cs)
8264 DTRACE_NFSV4_2(op__close__start, struct compound_state *, cs,
8267 if (cs->vp == NULL) {
8268 *cs->statusp = resp->status = NFS4ERR_NOFILEHANDLE;
8274 *cs->statusp = resp->status = status;
8279 if (cs->vp != sp->rs_finfo->rf_vp) {
8281 *cs->statusp = resp->status = NFS4ERR_BAD_STATEID;
8292 *cs->statusp = resp->status = NFS4ERR_BAD_SEQID;
8297 *cs->statusp = resp->status = NFS4ERR_OLD_STATEID;
8300 *cs->statusp = resp->status = NFS4ERR_BAD_STATEID;
8303 *cs->statusp = resp->status = NFS4ERR_EXPIRED;
8306 *cs->statusp = resp->status = NFS4ERR_OLD_STATEID;
8309 *cs->statusp = resp->status = NFS4ERR_BAD_STATEID;
8322 *cs->statusp = resp->status = NFS4ERR_BAD_SEQID;
8329 *cs->statusp = resp->status;
8351 rfs4_state_close(sp, FALSE, FALSE, cs->cr);
8353 *cs->statusp = resp->status = status;
8359 DTRACE_NFSV4_2(op__close__done, struct compound_state *, cs,
8792 struct svc_req *req, struct compound_state *cs)
8808 DTRACE_NFSV4_2(op__lock__start, struct compound_state *, cs,
8811 if (cs->vp == NULL) {
8812 *cs->statusp = resp->status = NFS4ERR_NOFILEHANDLE;
8814 cs, LOCK4res *, resp);
8829 *cs->statusp = resp->status = status;
8831 cs, LOCK4res *, resp);
8836 if (cs->vp != sp->rs_finfo->rf_vp) {
8838 *cs->statusp = resp->status = NFS4ERR_BAD_STATEID;
8840 cs, LOCK4res *, resp);
8849 *cs->statusp = resp->status = NFS4ERR_OLD_STATEID;
8852 *cs->statusp = resp->status = NFS4ERR_BAD_STATEID;
8855 *cs->statusp = resp->status = NFS4ERR_EXPIRED;
8858 *cs->statusp = resp->status = NFS4ERR_BAD_STATEID;
8861 *cs->statusp = resp->status = NFS4ERR_OLD_STATEID;
8877 *cs->statusp = resp->status = NFS4ERR_BAD_SEQID;
8898 *cs->statusp = resp->status = NFS4ERR_RESOURCE;
8915 *cs->statusp = resp->status = NFS4ERR_SERVERFAULT;
8933 *cs->statusp =
8961 *cs->statusp = resp->status = NFS4ERR_BAD_SEQID;
8969 *cs->statusp = resp->status;
9003 *cs->statusp = resp->status = status;
9005 cs, LOCK4res *, resp);
9011 if (cs->vp != lsp->rls_state->rs_finfo->rf_vp) {
9013 *cs->statusp = resp->status = NFS4ERR_BAD_STATEID;
9015 cs, LOCK4res *, resp);
9057 *cs->statusp = resp->status;
9068 *cs->statusp = resp->status = NFS4ERR_BAD_SEQID;
9076 *cs->statusp = resp->status = NFS4ERR_OLD_STATEID;
9079 *cs->statusp = resp->status = NFS4ERR_BAD_STATEID;
9082 *cs->statusp = resp->status = NFS4ERR_EXPIRED;
9085 *cs->statusp = resp->status = NFS4ERR_OLD_STATEID;
9098 *cs->statusp = resp->status = NFS4ERR_BAD_SEQID;
9102 *cs->statusp = status = resp->status;
9119 if (cs->vp->v_type != VREG) {
9120 if (cs->vp->v_type == VDIR)
9145 cs->deleg = TRUE;
9148 args->offset, args->length, cs->cr, resop);
9153 *cs->statusp = resp->status = status;
9186 DTRACE_NFSV4_2(op__lock__done, struct compound_state *, cs,
9216 struct svc_req *req, struct compound_state *cs)
9224 DTRACE_NFSV4_2(op__locku__start, struct compound_state *, cs,
9227 if (cs->vp == NULL) {
9228 *cs->statusp = resp->status = NFS4ERR_NOFILEHANDLE;
9229 DTRACE_NFSV4_2(op__locku__done, struct compound_state *, cs,
9235 *cs->statusp = resp->status = status;
9236 DTRACE_NFSV4_2(op__locku__done, struct compound_state *, cs,
9242 if (cs->vp != lsp->rls_state->rs_finfo->rf_vp) {
9244 *cs->statusp = resp->status = NFS4ERR_BAD_STATEID;
9245 DTRACE_NFSV4_2(op__locku__done, struct compound_state *, cs,
9257 *cs->statusp = resp->status = NFS4ERR_BAD_SEQID;
9262 *cs->statusp = resp->status = NFS4ERR_OLD_STATEID;
9265 *cs->statusp = resp->status = NFS4ERR_BAD_STATEID;
9268 *cs->statusp = resp->status = NFS4ERR_EXPIRED;
9271 *cs->statusp = resp->status = NFS4ERR_OLD_STATEID;
9282 *cs->statusp = resp->status = NFS4ERR_BAD_SEQID;
9286 *cs->statusp = status = resp->status;
9302 if (cs->vp->v_type != VREG) {
9303 if (cs->vp->v_type == VDIR)
9316 args->offset, args->length, cs->cr, resop);
9319 *cs->statusp = resp->status = status;
9330 DTRACE_NFSV4_2(op__locku__done, struct compound_state *, cs,
9343 struct svc_req *req, struct compound_state *cs)
9358 DTRACE_NFSV4_2(op__lockt__start, struct compound_state *, cs,
9361 if (cs->vp == NULL) {
9362 *cs->statusp = resp->status = NFS4ERR_NOFILEHANDLE;
9370 if (cs->vp->v_type != VREG) {
9371 if (cs->vp->v_type == VDIR)
9372 *cs->statusp = resp->status = NFS4ERR_ISDIR;
9374 *cs->statusp = resp->status = NFS4ERR_INVAL;
9384 *cs->statusp = resp->status =
9395 *cs->statusp = resp->status = NFS4ERR_STALE_CLIENTID;
9400 *cs->statusp = resp->status = NFS4ERR_GRACE;
9422 *cs->statusp = resp->status = NFS4ERR_INVAL;
9456 error = VOP_FRLOCK(cs->vp, F_GETLK, &flk, flag, (u_offset_t)0,
9457 NULL, cs->cr, NULL);
9489 *cs->statusp = resp->status;
9491 DTRACE_NFSV4_2(op__lockt__done, struct compound_state *, cs,