Changeset View
Changeset View
Standalone View
Standalone View
sys/fs/nfsserver/nfs_nfsdport.c
Show First 20 Lines • Show All 438 Lines • ▼ Show 20 Lines | if (vp->v_type == VREG && nfsrv_devidcnt > 0 && (attrbitp == NULL || | ||||
NFSISSET_ATTRBIT(attrbitp, NFSATTRBIT_SPACEUSED))) { | NFSISSET_ATTRBIT(attrbitp, NFSATTRBIT_SPACEUSED))) { | ||||
error = nfsrv_proxyds(vp, 0, 0, nd->nd_cred, p, | error = nfsrv_proxyds(vp, 0, 0, nd->nd_cred, p, | ||||
NFSPROC_GETATTR, NULL, NULL, NULL, &na, NULL, NULL, 0, | NFSPROC_GETATTR, NULL, NULL, NULL, &na, NULL, NULL, 0, | ||||
NULL); | NULL); | ||||
if (error == 0) | if (error == 0) | ||||
gotattr = 1; | gotattr = 1; | ||||
} | } | ||||
error = VOP_GETATTR(vp, &nvap->na_vattr, nd->nd_cred); | error = VOP_GETATTR(vp, 0, &nvap->na_vattr, nd->nd_cred); | ||||
if (lockedit != 0) | if (lockedit != 0) | ||||
NFSVOPUNLOCK(vp); | NFSVOPUNLOCK(vp); | ||||
/* | /* | ||||
* If we got the Change, Size and Modify Time from the DS, | * If we got the Change, Size and Modify Time from the DS, | ||||
* replace them. | * replace them. | ||||
*/ | */ | ||||
if (gotattr != 0) { | if (gotattr != 0) { | ||||
▲ Show 20 Lines • Show All 107 Lines • ▼ Show 20 Lines | nfsvno_accchk(struct vnode *vp, accmode_t accmode, struct ucred *cred, | ||||
* Allow certain operations for the owner (reads and writes | * Allow certain operations for the owner (reads and writes | ||||
* on files that are already open). | * on files that are already open). | ||||
*/ | */ | ||||
if (override != NFSACCCHK_NOOVERRIDE && | if (override != NFSACCCHK_NOOVERRIDE && | ||||
(error == EPERM || error == EACCES)) { | (error == EPERM || error == EACCES)) { | ||||
if (cred->cr_uid == 0 && (override & NFSACCCHK_ALLOWROOT)) | if (cred->cr_uid == 0 && (override & NFSACCCHK_ALLOWROOT)) | ||||
error = 0; | error = 0; | ||||
else if (override & NFSACCCHK_ALLOWOWNER) { | else if (override & NFSACCCHK_ALLOWOWNER) { | ||||
getret = VOP_GETATTR(vp, &vattr, cred); | getret = VOP_GETATTR(vp, 0, &vattr, cred); | ||||
if (getret == 0 && cred->cr_uid == vattr.va_uid) | if (getret == 0 && cred->cr_uid == vattr.va_uid) | ||||
error = 0; | error = 0; | ||||
} | } | ||||
} | } | ||||
if (vpislocked == 0) | if (vpislocked == 0) | ||||
NFSVOPUNLOCK(vp); | NFSVOPUNLOCK(vp); | ||||
out: | out: | ||||
▲ Show 20 Lines • Show All 2,627 Lines • ▼ Show 20 Lines | case NFSATTRBIT_MODESETMASKED: | ||||
*/ | */ | ||||
if (!nd->nd_repstat) { | if (!nd->nd_repstat) { | ||||
if ((nd->nd_flag & ND_NFSV41) == 0) | if ((nd->nd_flag & ND_NFSV41) == 0) | ||||
nd->nd_repstat = NFSERR_ATTRNOTSUPP; | nd->nd_repstat = NFSERR_ATTRNOTSUPP; | ||||
else if ((mode & ~07777) != 0 || | else if ((mode & ~07777) != 0 || | ||||
(mask & ~07777) != 0 || vp == NULL) | (mask & ~07777) != 0 || vp == NULL) | ||||
nd->nd_repstat = NFSERR_INVAL; | nd->nd_repstat = NFSERR_INVAL; | ||||
else if (moderet == 0) | else if (moderet == 0) | ||||
moderet = VOP_GETATTR(vp, &va, | moderet = VOP_GETATTR(vp, 0, &va, | ||||
nd->nd_cred); | nd->nd_cred); | ||||
if (moderet == 0) | if (moderet == 0) | ||||
nvap->na_mode = (mode & mask) | | nvap->na_mode = (mode & mask) | | ||||
(va.va_mode & ~mask); | (va.va_mode & ~mask); | ||||
else | else | ||||
nd->nd_repstat = moderet; | nd->nd_repstat = moderet; | ||||
} | } | ||||
attrsum += 2 * NFSX_UNSIGNED; | attrsum += 2 * NFSX_UNSIGNED; | ||||
▲ Show 20 Lines • Show All 1,134 Lines • ▼ Show 20 Lines | if (strcmp(nvp->v_mount->mnt_vfc->vfc_name, "nfs") | ||||
nvp->v_mount->mnt_vfc->vfc_name, | nvp->v_mount->mnt_vfc->vfc_name, | ||||
nmp->nm_nam->sa_len, np->n_fhp->nfh_len); | nmp->nm_nam->sa_len, np->n_fhp->nfh_len); | ||||
error = ENOENT; | error = ENOENT; | ||||
} | } | ||||
/* Set extattrs for the DS on the MDS file. */ | /* Set extattrs for the DS on the MDS file. */ | ||||
if (error == 0) { | if (error == 0) { | ||||
if (dsa != NULL) { | if (dsa != NULL) { | ||||
error = VOP_GETATTR(nvp, &va, tcred); | error = VOP_GETATTR(nvp, 0, &va, tcred); | ||||
if (error == 0) { | if (error == 0) { | ||||
dsa->dsa_filerev = va.va_filerev; | dsa->dsa_filerev = va.va_filerev; | ||||
dsa->dsa_size = va.va_size; | dsa->dsa_size = va.va_size; | ||||
dsa->dsa_atime = va.va_atime; | dsa->dsa_atime = va.va_atime; | ||||
dsa->dsa_mtime = va.va_mtime; | dsa->dsa_mtime = va.va_mtime; | ||||
dsa->dsa_bytes = va.va_bytes; | dsa->dsa_bytes = va.va_bytes; | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 108 Lines • ▼ Show 20 Lines | nfsrv_pnfscreate(struct vnode *vp, struct vattr *vap, struct ucred *cred, | ||||
if (mirrorcnt > 1) | if (mirrorcnt > 1) | ||||
tdsc = dsc = malloc(sizeof(*dsc) * (mirrorcnt - 1), M_TEMP, | tdsc = dsc = malloc(sizeof(*dsc) * (mirrorcnt - 1), M_TEMP, | ||||
M_WAITOK | M_ZERO); | M_WAITOK | M_ZERO); | ||||
tpf = pf = malloc(sizeof(*pf) * nfsrv_maxpnfsmirror, M_TEMP, M_WAITOK | | tpf = pf = malloc(sizeof(*pf) * nfsrv_maxpnfsmirror, M_TEMP, M_WAITOK | | ||||
M_ZERO); | M_ZERO); | ||||
error = nfsvno_getfh(vp, &fh, p); | error = nfsvno_getfh(vp, &fh, p); | ||||
if (error == 0) | if (error == 0) | ||||
error = VOP_GETATTR(vp, &va, cred); | error = VOP_GETATTR(vp, 0, &va, cred); | ||||
if (error == 0) { | if (error == 0) { | ||||
/* Set the attributes for "vp" to Setattr the DS vp. */ | /* Set the attributes for "vp" to Setattr the DS vp. */ | ||||
vauid = va.va_uid; | vauid = va.va_uid; | ||||
vagid = va.va_gid; | vagid = va.va_gid; | ||||
vamode = va.va_mode; | vamode = va.va_mode; | ||||
VATTR_NULL(&va); | VATTR_NULL(&va); | ||||
va.va_uid = vauid; | va.va_uid = vauid; | ||||
va.va_gid = vagid; | va.va_gid = vagid; | ||||
▲ Show 20 Lines • Show All 141 Lines • ▼ Show 20 Lines | nfsrv_pnfsremovesetup(struct vnode *vp, NFSPROC_T *p, struct vnode **dvpp, | ||||
dvpp[0] = NULL; | dvpp[0] = NULL; | ||||
/* If not an exported regular file or not a pNFS server, just return. */ | /* If not an exported regular file or not a pNFS server, just return. */ | ||||
if (vp->v_type != VREG || (vp->v_mount->mnt_flag & MNT_EXPORTED) == 0 || | if (vp->v_type != VREG || (vp->v_mount->mnt_flag & MNT_EXPORTED) == 0 || | ||||
nfsrv_devidcnt == 0) | nfsrv_devidcnt == 0) | ||||
return; | return; | ||||
/* Check to see if this is the last hard link. */ | /* Check to see if this is the last hard link. */ | ||||
tcred = newnfs_getcred(); | tcred = newnfs_getcred(); | ||||
error = VOP_GETATTR(vp, &va, tcred); | error = VOP_GETATTR(vp, 0, &va, tcred); | ||||
NFSFREECRED(tcred); | NFSFREECRED(tcred); | ||||
if (error != 0) { | if (error != 0) { | ||||
printf("pNFS: nfsrv_pnfsremovesetup getattr=%d\n", error); | printf("pNFS: nfsrv_pnfsremovesetup getattr=%d\n", error); | ||||
return; | return; | ||||
} | } | ||||
if (va.va_nlink > 1) | if (va.va_nlink > 1) | ||||
return; | return; | ||||
▲ Show 20 Lines • Show All 2,277 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
static void | static void | ||||
nfsvno_updateds(struct vnode *vp, struct ucred *cred, NFSPROC_T *p) | nfsvno_updateds(struct vnode *vp, struct ucred *cred, NFSPROC_T *p) | ||||
{ | { | ||||
struct nfsvattr nva; | struct nfsvattr nva; | ||||
int ret; | int ret; | ||||
u_short tmode; | u_short tmode; | ||||
ret = VOP_GETATTR(vp, &nva.na_vattr, cred); | ret = VOP_GETATTR(vp, 0, &nva.na_vattr, cred); | ||||
if (ret == 0) { | if (ret == 0) { | ||||
tmode = nva.na_mode; | tmode = nva.na_mode; | ||||
NFSVNO_ATTRINIT(&nva); | NFSVNO_ATTRINIT(&nva); | ||||
tmode ^= S_ISGID; | tmode ^= S_ISGID; | ||||
NFSVNO_SETATTRVAL(&nva, mode, tmode); | NFSVNO_SETATTRVAL(&nva, mode, tmode); | ||||
ret = nfsrv_proxyds(vp, 0, 0, cred, p, | ret = nfsrv_proxyds(vp, 0, 0, cred, p, | ||||
NFSPROC_SETATTR, NULL, NULL, NULL, &nva, | NFSPROC_SETATTR, NULL, NULL, NULL, &nva, | ||||
NULL, NULL, 0, NULL); | NULL, NULL, 0, NULL); | ||||
▲ Show 20 Lines • Show All 377 Lines • Show Last 20 Lines |