Changeset View
Changeset View
Standalone View
Standalone View
sys/fs/nfsserver/nfs_nfsdport.c
Show First 20 Lines • Show All 318 Lines • ▼ Show 20 Lines | nfsvno_getattr(struct vnode *vp, struct nfsvattr *nvap, | ||||
NFSEXITCODE(error); | NFSEXITCODE(error); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* Get a file handle for a vnode. | * Get a file handle for a vnode. | ||||
*/ | */ | ||||
int | int | ||||
nfsvno_getfh(struct vnode *vp, fhandle_t *fhp, struct thread *p) | nfsvno_getfh(struct vnode *vp, fhandle_t *fhp) | ||||
{ | { | ||||
int error; | int error; | ||||
NFSBZERO((caddr_t)fhp, sizeof(fhandle_t)); | NFSBZERO((caddr_t)fhp, sizeof(fhandle_t)); | ||||
fhp->fh_fsid = vp->v_mount->mnt_stat.f_fsid; | fhp->fh_fsid = vp->v_mount->mnt_stat.f_fsid; | ||||
error = VOP_VPTOFH(vp, &fhp->fh_fid); | error = VOP_VPTOFH(vp, &fhp->fh_fid); | ||||
NFSEXITCODE(error); | NFSEXITCODE(error); | ||||
▲ Show 20 Lines • Show All 2,100 Lines • ▼ Show 20 Lines | if (dp->d_fileno != 0 && dp->d_type != DT_WHT && | ||||
goto invalid; | goto invalid; | ||||
} | } | ||||
KASSERT(refp != NULL || nvp != NULL, | KASSERT(refp != NULL || nvp != NULL, | ||||
("%s: undetected lookup error", __func__)); | ("%s: undetected lookup error", __func__)); | ||||
if (refp == NULL && | if (refp == NULL && | ||||
((nd->nd_flag & ND_NFSV3) || | ((nd->nd_flag & ND_NFSV3) || | ||||
NFSNONZERO_ATTRBIT(&attrbits))) { | NFSNONZERO_ATTRBIT(&attrbits))) { | ||||
r = nfsvno_getfh(nvp, &nfh, p); | r = nfsvno_getfh(nvp, &nfh); | ||||
if (!r) | if (!r) | ||||
r = nfsvno_getattr(nvp, nvap, nd, p, | r = nfsvno_getattr(nvp, nvap, nd, p, | ||||
1, &attrbits); | 1, &attrbits); | ||||
if (r == 0 && is_zfs == 1 && | if (r == 0 && is_zfs == 1 && | ||||
nfsrv_enable_crossmntpt != 0 && | nfsrv_enable_crossmntpt != 0 && | ||||
(nd->nd_flag & ND_NFSV4) != 0 && | (nd->nd_flag & ND_NFSV4) != 0 && | ||||
nvp->v_type == VDIR && | nvp->v_type == VDIR && | ||||
vp->v_mount != nvp->v_mount) { | vp->v_mount != nvp->v_mount) { | ||||
▲ Show 20 Lines • Show All 729 Lines • ▼ Show 20 Lines | else if (error == 0) { | ||||
} | } | ||||
/* | /* | ||||
* If fspec != NULL, this is the v4root path. | * If fspec != NULL, this is the v4root path. | ||||
*/ | */ | ||||
NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, | NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, | ||||
nfsexargp->fspec, p); | nfsexargp->fspec, p); | ||||
if ((error = namei(&nd)) != 0) | if ((error = namei(&nd)) != 0) | ||||
goto out; | goto out; | ||||
error = nfsvno_getfh(nd.ni_vp, &fh, p); | error = nfsvno_getfh(nd.ni_vp, &fh); | ||||
vrele(nd.ni_vp); | vrele(nd.ni_vp); | ||||
if (!error) { | if (!error) { | ||||
nfs_rootfh.nfsrvfh_len = NFSX_MYFH; | nfs_rootfh.nfsrvfh_len = NFSX_MYFH; | ||||
NFSBCOPY((caddr_t)&fh, | NFSBCOPY((caddr_t)&fh, | ||||
nfs_rootfh.nfsrvfh_data, | nfs_rootfh.nfsrvfh_data, | ||||
sizeof (fhandle_t)); | sizeof (fhandle_t)); | ||||
nfs_rootfhset = 1; | nfs_rootfhset = 1; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 770 Lines • ▼ Show 20 Lines | nfsrv_pnfscreate(struct vnode *vp, struct vattr *vap, struct ucred *cred, | ||||
NFSDDSUNLOCK(); | NFSDDSUNLOCK(); | ||||
dsc = NULL; | dsc = NULL; | ||||
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); | ||||
if (error == 0) | if (error == 0) | ||||
error = VOP_GETATTR(vp, &va, cred); | error = VOP_GETATTR(vp, &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); | ||||
▲ Show 20 Lines • Show All 152 Lines • ▼ Show 20 Lines | nfsrv_pnfsremovesetup(struct vnode *vp, NFSPROC_T *p, struct vnode **dvpp, | ||||
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; | ||||
error = nfsvno_getfh(vp, fhp, p); | error = nfsvno_getfh(vp, fhp); | ||||
if (error != 0) { | if (error != 0) { | ||||
printf("pNFS: nfsrv_pnfsremovesetup getfh=%d\n", error); | printf("pNFS: nfsrv_pnfsremovesetup getfh=%d\n", error); | ||||
return; | return; | ||||
} | } | ||||
buflen = 1024; | buflen = 1024; | ||||
buf = malloc(buflen, M_TEMP, M_WAITOK); | buf = malloc(buflen, M_TEMP, M_WAITOK); | ||||
/* Get the directory vnode for the DS mount and the file handle. */ | /* Get the directory vnode for the DS mount and the file handle. */ | ||||
▲ Show 20 Lines • Show All 1,685 Lines • Show Last 20 Lines |