usr/src/uts/common/nfs/nfs4.h
changeset 2035 a29bc457bcb9
parent 1610 3436e82414c8
child 4001 4d632d6bcf85
equal deleted inserted replaced
2034:495fa2236cf1 2035:a29bc457bcb9
    34 #include <rpc/rpc.h>
    34 #include <rpc/rpc.h>
    35 #include <nfs/nfs.h>
    35 #include <nfs/nfs.h>
    36 
    36 
    37 #ifdef _KERNEL
    37 #ifdef _KERNEL
    38 #include <nfs/nfs4_kprot.h>
    38 #include <nfs/nfs4_kprot.h>
       
    39 #include <sys/nvpair.h>
    39 #else
    40 #else
    40 #include <rpcsvc/nfs4_prot.h>
    41 #include <rpcsvc/nfs4_prot.h>
    41 #endif
    42 #endif
    42 #include <nfs/nfs4_attr.h>
    43 #include <nfs/nfs4_attr.h>
    43 #include <sys/acl.h>
    44 #include <sys/acl.h>
   322  * rfs4_client_t - with a given server instance, allowing us to treat clients
   323  * rfs4_client_t - with a given server instance, allowing us to treat clients
   323  * in the set differently to clients in other sets.
   324  * in the set differently to clients in other sets.
   324  *
   325  *
   325  * Currently used only for Sun Cluster HA-NFS support, to group clients
   326  * Currently used only for Sun Cluster HA-NFS support, to group clients
   326  * on NFS resource failover so each set of clients gets its own dedicated
   327  * on NFS resource failover so each set of clients gets its own dedicated
   327  * grace period.
   328  * grace period and distributed stable storage data.
   328  */
   329  */
   329 typedef struct rfs4_servinst {
   330 typedef struct rfs4_servinst {
       
   331 	int			dss_npaths;
   330 	krwlock_t		rwlock;
   332 	krwlock_t		rwlock;
       
   333 	krwlock_t		oldstate_lock;
   331 	time_t			start_time;
   334 	time_t			start_time;
   332 	time_t			grace_period;
   335 	time_t			grace_period;
       
   336 	rfs4_oldstate_t		*oldstate;
       
   337 	struct rfs4_dss_path	**dss_paths;
   333 	struct rfs4_servinst	*next;
   338 	struct rfs4_servinst	*next;
   334 	struct rfs4_servinst	*prev;
   339 	struct rfs4_servinst	*prev;
   335 } rfs4_servinst_t;
   340 } rfs4_servinst_t;
       
   341 
       
   342 /*
       
   343  * DSS: distributed stable storage
       
   344  */
       
   345 
       
   346 typedef struct rfs4_dss_path {
       
   347 	struct rfs4_dss_path	*next; /* for insque/remque */
       
   348 	struct rfs4_dss_path	*prev; /* for insque/remque */
       
   349 	char			*path;
       
   350 	struct rfs4_servinst	*sip;
       
   351 	unsigned		index; /* offset in servinst's array */
       
   352 } rfs4_dss_path_t;
       
   353 
       
   354 /* array of paths passed-in from nfsd command-line; stored in nvlist */
       
   355 char		**rfs4_dss_newpaths;
       
   356 uint_t		rfs4_dss_numnewpaths;
       
   357 
       
   358 /*
       
   359  * Circular doubly-linked list of paths for currently-served RGs.
       
   360  * No locking required: only changed on warmstart. Managed with insque/remque.
       
   361  */
       
   362 rfs4_dss_path_t	*rfs4_dss_pathlist;
       
   363 
       
   364 /* nvlists of all DSS paths: current, and before last warmstart */
       
   365 nvlist_t *rfs4_dss_paths, *rfs4_dss_oldpaths;
   336 
   366 
   337 /*
   367 /*
   338  * List declarations (suitable for insque/remque) used to link the
   368  * List declarations (suitable for insque/remque) used to link the
   339  * various datastructs listed below.
   369  * various datastructs listed below.
   340  */
   370  */
   710 	uint32_t	deny_read;
   740 	uint32_t	deny_read;
   711 	uint32_t	deny_write;
   741 	uint32_t	deny_write;
   712 	krwlock_t	file_rwlock;
   742 	krwlock_t	file_rwlock;
   713 } rfs4_file_t;
   743 } rfs4_file_t;
   714 
   744 
   715 extern int	rfs4_servinst_debug;
       
   716 extern int	rfs4_seen_first_compound;	/* set first time we see one */
   745 extern int	rfs4_seen_first_compound;	/* set first time we see one */
   717 
   746 
   718 extern rfs4_servinst_t	*rfs4_cur_servinst;	/* current server instance */
   747 extern rfs4_servinst_t	*rfs4_cur_servinst;	/* current server instance */
   719 extern kmutex_t		rfs4_servinst_lock;	/* protects linked list */
   748 extern kmutex_t		rfs4_servinst_lock;	/* protects linked list */
   720 extern void		rfs4_servinst_create(int);
   749 extern void		rfs4_servinst_create(int, int, char **);
   721 extern void		rfs4_servinst_destroy_all(void);
   750 extern void		rfs4_servinst_destroy_all(void);
   722 extern void		rfs4_servinst_assign(rfs4_client_t *,
   751 extern void		rfs4_servinst_assign(rfs4_client_t *,
   723 			    rfs4_servinst_t *);
   752 			    rfs4_servinst_t *);
   724 extern rfs4_servinst_t	*rfs4_servinst(rfs4_client_t *);
   753 extern rfs4_servinst_t	*rfs4_servinst(rfs4_client_t *);
   725 extern int		rfs4_clnt_in_grace(rfs4_client_t *);
   754 extern int		rfs4_clnt_in_grace(rfs4_client_t *);
   726 extern int		rfs4_servinst_in_grace(rfs4_servinst_t *);
   755 extern int		rfs4_servinst_in_grace(rfs4_servinst_t *);
   727 extern int		rfs4_servinst_grace_new(rfs4_servinst_t *);
   756 extern int		rfs4_servinst_grace_new(rfs4_servinst_t *);
   728 extern void		rfs4_grace_start(rfs4_servinst_t *);
   757 extern void		rfs4_grace_start(rfs4_servinst_t *);
   729 extern void		rfs4_grace_start_new(void);
   758 extern void		rfs4_grace_start_new(void);
   730 extern void		rfs4_grace_reset_all(void);
   759 extern void		rfs4_grace_reset_all(void);
       
   760 extern void		rfs4_ss_oldstate(rfs4_oldstate_t *, char *, char *);
       
   761 extern void		rfs4_dss_readstate(int, char **);
   731 
   762 
   732 /*
   763 /*
   733  * rfs4_deleg_policy is used to signify the server's global delegation
   764  * rfs4_deleg_policy is used to signify the server's global delegation
   734  * policy.  The default is to NEVER delegate files and the
   765  * policy.  The default is to NEVER delegate files and the
   735  * administrator must configure the server to enable delegations.
   766  * administrator must configure the server to enable delegations.