Deleted Added
full compact
nfs_nfsdport.c (217335) nfs_nfsdport.c (217432)
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 217335 2011-01-12 23:34:09Z zack $");
35__FBSDID("$FreeBSD: head/sys/fs/nfsserver/nfs_nfsdport.c 217432 2011-01-14 23:30:35Z rmacklem $");
36
37/*
38 * Functions that perform the vfs operations required by the routines in
39 * nfsd_serv.c. It is hoped that this change will make the server more
40 * portable.
41 */
42
43#include <fs/nfs/nfsport.h>

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

53extern struct nfsrv_stablefirst nfsrv_stablefirst;
54extern void (*nfsd_call_servertimer)(void);
55struct vfsoptlist nfsv4root_opt, nfsv4root_newopt;
56NFSDLOCKMUTEX;
57struct mtx nfs_cache_mutex;
58struct mtx nfs_v4root_mutex;
59struct nfsrvfh nfs_rootfh, nfs_pubfh;
60int nfs_pubfhset = 0, nfs_rootfhset = 0;
36
37/*
38 * Functions that perform the vfs operations required by the routines in
39 * nfsd_serv.c. It is hoped that this change will make the server more
40 * portable.
41 */
42
43#include <fs/nfs/nfsport.h>

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

53extern struct nfsrv_stablefirst nfsrv_stablefirst;
54extern void (*nfsd_call_servertimer)(void);
55struct vfsoptlist nfsv4root_opt, nfsv4root_newopt;
56NFSDLOCKMUTEX;
57struct mtx nfs_cache_mutex;
58struct mtx nfs_v4root_mutex;
59struct nfsrvfh nfs_rootfh, nfs_pubfh;
60int nfs_pubfhset = 0, nfs_rootfhset = 0;
61struct proc *nfsd_master_proc = NULL;
62static pid_t nfsd_master_pid = (pid_t)-1;
63static char nfsd_master_comm[MAXCOMLEN + 1];
64static struct timeval nfsd_master_start;
61static uint32_t nfsv4_sysid = 0;
62
63static int nfssvc_srvcall(struct thread *, struct nfssvc_args *,
64 struct ucred *);
65
66static int enable_crossmntpt = 1;
67static int nfs_commit_blks;
68static int nfs_commit_miss;

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

2900 struct nfsd_clid adminrevoke;
2901 struct nfsd_dumplist dumplist;
2902 struct nfsd_dumpclients *dumpclients;
2903 struct nfsd_dumplocklist dumplocklist;
2904 struct nfsd_dumplocks *dumplocks;
2905 struct nameidata nd;
2906 vnode_t vp;
2907 int error = EINVAL;
65static uint32_t nfsv4_sysid = 0;
66
67static int nfssvc_srvcall(struct thread *, struct nfssvc_args *,
68 struct ucred *);
69
70static int enable_crossmntpt = 1;
71static int nfs_commit_blks;
72static int nfs_commit_miss;

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

2904 struct nfsd_clid adminrevoke;
2905 struct nfsd_dumplist dumplist;
2906 struct nfsd_dumpclients *dumpclients;
2907 struct nfsd_dumplocklist dumplocklist;
2908 struct nfsd_dumplocks *dumplocks;
2909 struct nameidata nd;
2910 vnode_t vp;
2911 int error = EINVAL;
2912 struct proc *procp;
2908
2909 if (uap->flag & NFSSVC_PUBLICFH) {
2910 NFSBZERO((caddr_t)&nfs_pubfh.nfsrvfh_data,
2911 sizeof (fhandle_t));
2912 error = copyin(uap->argp,
2913 &nfs_pubfh.nfsrvfh_data, sizeof (fhandle_t));
2914 if (!error)
2915 nfs_pubfhset = 1;

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

2970 M_TEMP, M_WAITOK);
2971 nfsrv_dumplocks(nd.ni_vp, dumplocks,
2972 dumplocklist.ndllck_size, p);
2973 vput(nd.ni_vp);
2974 error = copyout(dumplocks,
2975 CAST_USER_ADDR_T(dumplocklist.ndllck_list), len);
2976 free((caddr_t)dumplocks, M_TEMP);
2977 }
2913
2914 if (uap->flag & NFSSVC_PUBLICFH) {
2915 NFSBZERO((caddr_t)&nfs_pubfh.nfsrvfh_data,
2916 sizeof (fhandle_t));
2917 error = copyin(uap->argp,
2918 &nfs_pubfh.nfsrvfh_data, sizeof (fhandle_t));
2919 if (!error)
2920 nfs_pubfhset = 1;

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

2975 M_TEMP, M_WAITOK);
2976 nfsrv_dumplocks(nd.ni_vp, dumplocks,
2977 dumplocklist.ndllck_size, p);
2978 vput(nd.ni_vp);
2979 error = copyout(dumplocks,
2980 CAST_USER_ADDR_T(dumplocklist.ndllck_list), len);
2981 free((caddr_t)dumplocks, M_TEMP);
2982 }
2983 } else if (uap->flag & NFSSVC_BACKUPSTABLE) {
2984 procp = p->td_proc;
2985 PROC_LOCK(procp);
2986 nfsd_master_pid = procp->p_pid;
2987 bcopy(procp->p_comm, nfsd_master_comm, MAXCOMLEN + 1);
2988 nfsd_master_start = procp->p_stats->p_start;
2989 nfsd_master_proc = procp;
2990 PROC_UNLOCK(procp);
2978 }
2979 return (error);
2980}
2981
2982/*
2983 * Check exports.
2984 * Returns 0 if ok, 1 otherwise.
2985 */

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

3025nfsrv_hashfh(fhandle_t *fhp)
3026{
3027 uint32_t hashval;
3028
3029 hashval = hash32_buf(&fhp->fh_fid, sizeof(struct fid), 0);
3030 return (hashval);
3031}
3032
2991 }
2992 return (error);
2993}
2994
2995/*
2996 * Check exports.
2997 * Returns 0 if ok, 1 otherwise.
2998 */

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

3038nfsrv_hashfh(fhandle_t *fhp)
3039{
3040 uint32_t hashval;
3041
3042 hashval = hash32_buf(&fhp->fh_fid, sizeof(struct fid), 0);
3043 return (hashval);
3044}
3045
3046/*
3047 * Signal the userland master nfsd to backup the stable restart file.
3048 */
3049void
3050nfsrv_backupstable(void)
3051{
3052 struct proc *procp;
3053
3054 if (nfsd_master_proc != NULL) {
3055 procp = pfind(nfsd_master_pid);
3056 /* Try to make sure it is the correct process. */
3057 if (procp == nfsd_master_proc &&
3058 procp->p_stats->p_start.tv_sec ==
3059 nfsd_master_start.tv_sec &&
3060 procp->p_stats->p_start.tv_usec ==
3061 nfsd_master_start.tv_usec &&
3062 strcmp(procp->p_comm, nfsd_master_comm) == 0)
3063 psignal(procp, SIGUSR2);
3064 else
3065 nfsd_master_proc = NULL;
3066
3067 if (procp != NULL)
3068 PROC_UNLOCK(procp);
3069 }
3070}
3071
3033extern int (*nfsd_call_nfsd)(struct thread *, struct nfssvc_args *);
3034
3035/*
3036 * Called once to initialize data structures...
3037 */
3038static int
3039nfsd_modevent(module_t mod, int type, void *data)
3040{

--- 72 unchanged lines hidden ---
3072extern int (*nfsd_call_nfsd)(struct thread *, struct nfssvc_args *);
3073
3074/*
3075 * Called once to initialize data structures...
3076 */
3077static int
3078nfsd_modevent(module_t mod, int type, void *data)
3079{

--- 72 unchanged lines hidden ---