Deleted Added
full compact
nfs_nfsdport.c (241561) nfs_nfsdport.c (241896)
1/*-
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Rick Macklem at The University of Guelph.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 18 unchanged lines hidden (view full) ---

27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 *
32 */
33
34#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Rick Macklem at The University of Guelph.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 18 unchanged lines hidden (view full) ---

27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 *
32 */
33
34#include <sys/cdefs.h>
35__FBSDID("$FreeBSD: head/sys/fs/nfsserver/nfs_nfsdport.c 241561 2012-10-14 22:33:17Z rmacklem $");
35__FBSDID("$FreeBSD: head/sys/fs/nfsserver/nfs_nfsdport.c 241896 2012-10-22 17:50:54Z kib $");
36
37#include <sys/capability.h>
38
39/*
40 * Functions that perform the vfs operations required by the routines in
41 * nfsd_serv.c. It is hoped that this change will make the server more
42 * portable.
43 */

--- 2011 unchanged lines hidden (view full) ---

2055 LK_RETRY;
2056 cn.cn_cred =
2057 nd->nd_cred;
2058 cn.cn_thread = p;
2059 }
2060 cn.cn_nameptr = dp->d_name;
2061 cn.cn_namelen = nlen;
2062 cn.cn_flags = ISLASTCN |
36
37#include <sys/capability.h>
38
39/*
40 * Functions that perform the vfs operations required by the routines in
41 * nfsd_serv.c. It is hoped that this change will make the server more
42 * portable.
43 */

--- 2011 unchanged lines hidden (view full) ---

2055 LK_RETRY;
2056 cn.cn_cred =
2057 nd->nd_cred;
2058 cn.cn_thread = p;
2059 }
2060 cn.cn_nameptr = dp->d_name;
2061 cn.cn_namelen = nlen;
2062 cn.cn_flags = ISLASTCN |
2063 NOFOLLOW | LOCKLEAF |
2064 MPSAFE;
2063 NOFOLLOW | LOCKLEAF;
2065 if (nlen == 2 &&
2066 dp->d_name[0] == '.' &&
2067 dp->d_name[1] == '.')
2068 cn.cn_flags |=
2069 ISDOTDOT;
2070 if (NFSVOPLOCK(vp, LK_SHARED)
2071 != 0) {
2072 nd->nd_repstat = EPERM;

--- 569 unchanged lines hidden (view full) ---

2642nfsvno_fhtovp(struct mount *mp, fhandle_t *fhp, struct sockaddr *nam,
2643 int lktype, struct vnode **vpp, struct nfsexstuff *exp,
2644 struct ucred **credp)
2645{
2646 int i, error, *secflavors;
2647
2648 *credp = NULL;
2649 exp->nes_numsecflavor = 0;
2064 if (nlen == 2 &&
2065 dp->d_name[0] == '.' &&
2066 dp->d_name[1] == '.')
2067 cn.cn_flags |=
2068 ISDOTDOT;
2069 if (NFSVOPLOCK(vp, LK_SHARED)
2070 != 0) {
2071 nd->nd_repstat = EPERM;

--- 569 unchanged lines hidden (view full) ---

2641nfsvno_fhtovp(struct mount *mp, fhandle_t *fhp, struct sockaddr *nam,
2642 int lktype, struct vnode **vpp, struct nfsexstuff *exp,
2643 struct ucred **credp)
2644{
2645 int i, error, *secflavors;
2646
2647 *credp = NULL;
2648 exp->nes_numsecflavor = 0;
2650 if (VFS_NEEDSGIANT(mp))
2651 error = ESTALE;
2652 else
2653 error = VFS_FHTOVP(mp, &fhp->fh_fid, lktype, vpp);
2649 error = VFS_FHTOVP(mp, &fhp->fh_fid, lktype, vpp);
2654 if (error != 0)
2655 /* Make sure the server replies ESTALE to the client. */
2656 error = ESTALE;
2657 if (nam && !error) {
2658 error = VFS_CHECKEXP(mp, nam, &exp->nes_exflag, credp,
2659 &exp->nes_numsecflavor, &secflavors);
2660 if (error) {
2661 if (nfs_rootfhset) {

--- 158 unchanged lines hidden (view full) ---

2820 else if (error == 0) {
2821 if (nfsexargp->fspec == NULL) {
2822 error = EPERM;
2823 goto out;
2824 }
2825 /*
2826 * If fspec != NULL, this is the v4root path.
2827 */
2650 if (error != 0)
2651 /* Make sure the server replies ESTALE to the client. */
2652 error = ESTALE;
2653 if (nam && !error) {
2654 error = VFS_CHECKEXP(mp, nam, &exp->nes_exflag, credp,
2655 &exp->nes_numsecflavor, &secflavors);
2656 if (error) {
2657 if (nfs_rootfhset) {

--- 158 unchanged lines hidden (view full) ---

2816 else if (error == 0) {
2817 if (nfsexargp->fspec == NULL) {
2818 error = EPERM;
2819 goto out;
2820 }
2821 /*
2822 * If fspec != NULL, this is the v4root path.
2823 */
2828 NDINIT(&nd, LOOKUP, FOLLOW | MPSAFE, UIO_USERSPACE,
2824 NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE,
2829 nfsexargp->fspec, p);
2830 if ((error = namei(&nd)) != 0)
2831 goto out;
2832 error = nfsvno_getfh(nd.ni_vp, &fh, p);
2833 vrele(nd.ni_vp);
2834 if (!error) {
2835 nfs_rootfh.nfsrvfh_len = NFSX_MYFH;
2836 NFSBCOPY((caddr_t)&fh,

--- 536 unchanged lines hidden ---
2825 nfsexargp->fspec, p);
2826 if ((error = namei(&nd)) != 0)
2827 goto out;
2828 error = nfsvno_getfh(nd.ni_vp, &fh, p);
2829 vrele(nd.ni_vp);
2830 if (!error) {
2831 nfs_rootfh.nfsrvfh_len = NFSX_MYFH;
2832 NFSBCOPY((caddr_t)&fh,

--- 536 unchanged lines hidden ---