diff options
Diffstat (limited to 'xlators/nfs/server')
-rw-r--r-- | xlators/nfs/server/src/acl3.h | 16 | ||||
-rw-r--r-- | xlators/nfs/server/src/auth-cache.h | 23 | ||||
-rw-r--r-- | xlators/nfs/server/src/exports.h | 68 | ||||
-rw-r--r-- | xlators/nfs/server/src/mount3-auth.h | 28 | ||||
-rw-r--r-- | xlators/nfs/server/src/mount3.h | 198 | ||||
-rw-r--r-- | xlators/nfs/server/src/netgroups.h | 25 | ||||
-rw-r--r-- | xlators/nfs/server/src/nfs-common.h | 43 | ||||
-rw-r--r-- | xlators/nfs/server/src/nfs-fops.h | 296 | ||||
-rw-r--r-- | xlators/nfs/server/src/nfs-generics.h | 144 | ||||
-rw-r--r-- | xlators/nfs/server/src/nfs-inodes.h | 51 | ||||
-rw-r--r-- | xlators/nfs/server/src/nfs-mem-types.h | 76 | ||||
-rw-r--r-- | xlators/nfs/server/src/nfs-messages.h | 281 | ||||
-rw-r--r-- | xlators/nfs/server/src/nfs.h | 167 | ||||
-rw-r--r-- | xlators/nfs/server/src/nfs3-fh.h | 99 | ||||
-rw-r--r-- | xlators/nfs/server/src/nfs3-helpers.h | 278 | ||||
-rw-r--r-- | xlators/nfs/server/src/nfs3.h | 376 | ||||
-rw-r--r-- | xlators/nfs/server/src/nlm4.h | 112 |
17 files changed, 1073 insertions, 1208 deletions
diff --git a/xlators/nfs/server/src/acl3.h b/xlators/nfs/server/src/acl3.h index 3ccc587bd59..500d2ef6ae5 100644 --- a/xlators/nfs/server/src/acl3.h +++ b/xlators/nfs/server/src/acl3.h @@ -18,23 +18,23 @@ #define ACL3_SETACL 2 #define ACL3_PROC_COUNT 3 -#define GF_ACL3_PORT 38469 -#define GF_ACL GF_NFS"-ACL" +#define GF_ACL3_PORT 38469 +#define GF_ACL GF_NFS "-ACL" /* Flags for the getacl/setacl mode */ -#define NFS_ACL 0x0001 -#define NFS_ACLCNT 0x0002 -#define NFS_DFACL 0x0004 -#define NFS_DFACLCNT 0x0008 +#define NFS_ACL 0x0001 +#define NFS_ACLCNT 0x0002 +#define NFS_DFACL 0x0004 +#define NFS_DFACLCNT 0x0008 /* * NFSv3, identifies the default ACL by NFS_ACL_DEFAULT. Gluster * NFS needs to mask it OFF before sending it up to POSIX layer * or File system layer. */ -#define NFS_ACL_DEFAULT 0x1000 +#define NFS_ACL_DEFAULT 0x1000 -#define NFS_ACL_MAX_ENTRIES 1024 +#define NFS_ACL_MAX_ENTRIES 1024 rpcsvc_program_t * acl3svc_init(xlator_t *nfsx); diff --git a/xlators/nfs/server/src/auth-cache.h b/xlators/nfs/server/src/auth-cache.h index fa0b5d89676..d48c6f64e43 100644 --- a/xlators/nfs/server/src/auth-cache.h +++ b/xlators/nfs/server/src/auth-cache.h @@ -21,33 +21,32 @@ #include "nfs3.h" struct auth_cache { - gf_lock_t lock; /* locking for the dict (and entries) */ - dict_t *cache_dict; /* Dict holding fh -> authcache_entry */ - time_t ttl_sec; /* TTL of the auth cache in seconds */ + gf_lock_t lock; /* locking for the dict (and entries) */ + dict_t *cache_dict; /* Dict holding fh -> authcache_entry */ + time_t ttl_sec; /* TTL of the auth cache in seconds */ }; - /* Initializes the cache */ struct auth_cache * -auth_cache_init (time_t ttl_sec); +auth_cache_init(time_t ttl_sec); /* Inserts FH into cache */ int -cache_nfs_fh (struct auth_cache *cache, struct nfs3_fh *fh, - const char *host_addr, struct export_item *export_item); +cache_nfs_fh(struct auth_cache *cache, struct nfs3_fh *fh, + const char *host_addr, struct export_item *export_item); /* Checks if the filehandle cached & writable */ gf_boolean_t -is_nfs_fh_cached_and_writeable (struct auth_cache *cache, struct nfs3_fh *fh, - const char *host_addr); +is_nfs_fh_cached_and_writeable(struct auth_cache *cache, struct nfs3_fh *fh, + const char *host_addr); /* Checks if the filehandle is cached */ gf_boolean_t -is_nfs_fh_cached (struct auth_cache *cache, struct nfs3_fh *fh, - const char *host_addr); +is_nfs_fh_cached(struct auth_cache *cache, struct nfs3_fh *fh, + const char *host_addr); /* Purge the cache */ void -auth_cache_purge (struct auth_cache *cache); +auth_cache_purge(struct auth_cache *cache); #endif /* _AUTH_CACHE_H_ */ diff --git a/xlators/nfs/server/src/exports.h b/xlators/nfs/server/src/exports.h index 87795dadaee..d44e32e3f74 100644 --- a/xlators/nfs/server/src/exports.h +++ b/xlators/nfs/server/src/exports.h @@ -19,19 +19,19 @@ #include "dict.h" #include "nfs.h" -#define GF_EXP GF_NFS"-exports" +#define GF_EXP GF_NFS "-exports" -#define NETGROUP_REGEX_PATTERN "(@([a-zA-Z0-9\\(=, .])+)())" -#define HOSTNAME_REGEX_PATTERN "[[:space:]]([a-zA-Z0-9.\\(=,*/:)-]+)" -#define OPTIONS_REGEX_PATTERN "([a-zA-Z0-9=\\.]+)" +#define NETGROUP_REGEX_PATTERN "(@([a-zA-Z0-9\\(=, .])+)())" +#define HOSTNAME_REGEX_PATTERN "[[:space:]]([a-zA-Z0-9.\\(=,*/:)-]+)" +#define OPTIONS_REGEX_PATTERN "([a-zA-Z0-9=\\.]+)" -#define NETGROUP_MAX_LEN 128 -#define FQDN_MAX_LEN 256 +#define NETGROUP_MAX_LEN 128 +#define FQDN_MAX_LEN 256 -#define SEC_OPTION_MAX 10 -#define UID_MAX_LEN 6 +#define SEC_OPTION_MAX 10 +#define UID_MAX_LEN 6 -#define DIR_MAX_LEN 1024 +#define DIR_MAX_LEN 1024 /* The following 2 definitions are in mount3.h * but we don't want to include it because mount3.h @@ -41,53 +41,53 @@ struct mount3_state; extern struct mnt3_export * -mnt3_mntpath_to_export (struct mount3_state *ms, const char *dirpath, - gf_boolean_t export_parsing_match); +mnt3_mntpath_to_export(struct mount3_state *ms, const char *dirpath, + gf_boolean_t export_parsing_match); struct export_options { - gf_boolean_t rw; /* Read-write option */ - gf_boolean_t nosuid; /* nosuid option */ - gf_boolean_t root; /* root option */ - char *anon_uid; /* anonuid option */ - char *sec_type; /* X, for sec=X */ + gf_boolean_t rw; /* Read-write option */ + gf_boolean_t nosuid; /* nosuid option */ + gf_boolean_t root; /* root option */ + char *anon_uid; /* anonuid option */ + char *sec_type; /* X, for sec=X */ }; struct export_item { - char *name; /* Name of the export item */ - struct export_options *opts; /* NFS Options */ - GF_REF_DECL; + char *name; /* Name of the export item */ + struct export_options *opts; /* NFS Options */ + GF_REF_DECL; }; struct export_dir { - char *dir_name; /* Directory */ - dict_t *netgroups; /* Dict of netgroups */ - dict_t *hosts; /* Dict of hosts */ + char *dir_name; /* Directory */ + dict_t *netgroups; /* Dict of netgroups */ + dict_t *hosts; /* Dict of hosts */ }; struct exports_file { - char *filename; /* Filename */ - dict_t *exports_dict; /* Dict of export_dir_t */ - dict_t *exports_map; /* Map of SuperFastHash(<export>) -> expdir */ + char *filename; /* Filename */ + dict_t *exports_dict; /* Dict of export_dir_t */ + dict_t *exports_map; /* Map of SuperFastHash(<export>) -> expdir */ }; void -exp_file_deinit (struct exports_file *expfile); +exp_file_deinit(struct exports_file *expfile); int -exp_file_parse (const char *filepath, struct exports_file **expfile, - struct mount3_state *ms); +exp_file_parse(const char *filepath, struct exports_file **expfile, + struct mount3_state *ms); struct export_dir * -exp_file_get_dir (const struct exports_file *file, const char *dir); +exp_file_get_dir(const struct exports_file *file, const char *dir); struct export_item * -exp_dir_get_host (const struct export_dir *expdir, const char *host); +exp_dir_get_host(const struct export_dir *expdir, const char *host); struct export_item * -exp_dir_get_netgroup (const struct export_dir *expdir, const char *netgroup); +exp_dir_get_netgroup(const struct export_dir *expdir, const char *netgroup); struct export_dir * -exp_file_dir_from_uuid (const struct exports_file *file, - const uuid_t export_uuid); +exp_file_dir_from_uuid(const struct exports_file *file, + const uuid_t export_uuid); -#endif /* _EXPORTS_H_ */ +#endif /* _EXPORTS_H_ */ diff --git a/xlators/nfs/server/src/mount3-auth.h b/xlators/nfs/server/src/mount3-auth.h index b25d4724fac..e50af5847d3 100644 --- a/xlators/nfs/server/src/mount3-auth.h +++ b/xlators/nfs/server/src/mount3-auth.h @@ -21,39 +21,39 @@ #include "mount3.h" #include "nfs.h" -#define GF_MNT_AUTH GF_NFS"-mount3-auth" +#define GF_MNT_AUTH GF_NFS "-mount3-auth" struct mnt3_auth_params { - struct netgroups_file *ngfile; /* The netgroup file to auth against */ - struct exports_file *expfile; /* The export file to auth against */ - struct mount3_state *ms; /* The mount state that owns this */ + struct netgroups_file *ngfile; /* The netgroup file to auth against */ + struct exports_file *expfile; /* The export file to auth against */ + struct mount3_state *ms; /* The mount state that owns this */ }; /* Initialize auth params struct */ struct mnt3_auth_params * -mnt3_auth_params_init (struct mount3_state *ms); +mnt3_auth_params_init(struct mount3_state *ms); /* Set the netgroups file to use in the auth */ int -mnt3_auth_set_netgroups_auth (struct mnt3_auth_params *aps, - const char *filename); +mnt3_auth_set_netgroups_auth(struct mnt3_auth_params *aps, + const char *filename); /* Set the exports file to use in the auth */ int -mnt3_auth_set_exports_auth (struct mnt3_auth_params *aps, const char *filename); +mnt3_auth_set_exports_auth(struct mnt3_auth_params *aps, const char *filename); /* Check if a host is authorized to perform a mount / nfs-fop */ int -mnt3_auth_host (const struct mnt3_auth_params *aps, const char *host, - struct nfs3_fh *fh, const char *dir, gf_boolean_t is_write_op, - struct export_item **save_item); +mnt3_auth_host(const struct mnt3_auth_params *aps, const char *host, + struct nfs3_fh *fh, const char *dir, gf_boolean_t is_write_op, + struct export_item **save_item); /* Free resources used by the auth params struct */ void -mnt3_auth_params_deinit (struct mnt3_auth_params *aps); +mnt3_auth_params_deinit(struct mnt3_auth_params *aps); int -mnt3_auth_fop_options_verify (const struct mnt3_auth_params *auth_params, - const char *host, const char *dir); +mnt3_auth_fop_options_verify(const struct mnt3_auth_params *auth_params, + const char *host, const char *dir); #endif /* _MOUNT3_AUTH */ diff --git a/xlators/nfs/server/src/mount3.h b/xlators/nfs/server/src/mount3.h index 8868aec787a..9b0f73e3af7 100644 --- a/xlators/nfs/server/src/mount3.h +++ b/xlators/nfs/server/src/mount3.h @@ -26,163 +26,163 @@ #include "auth-cache.h" /* Registered with portmap */ -#define GF_MOUNTV3_PORT 38465 -#define GF_MOUNTV3_IOB (2 * GF_UNIT_KB) -#define GF_MOUNTV3_IOBPOOL (GF_MOUNTV3_IOB * 50) +#define GF_MOUNTV3_PORT 38465 +#define GF_MOUNTV3_IOB (2 * GF_UNIT_KB) +#define GF_MOUNTV3_IOBPOOL (GF_MOUNTV3_IOB * 50) -#define GF_MOUNTV1_PORT 38466 -#define GF_MNT GF_NFS"-mount" +#define GF_MOUNTV1_PORT 38466 +#define GF_MNT GF_NFS "-mount" extern rpcsvc_program_t * -mnt3svc_init (xlator_t *nfsx); +mnt3svc_init(xlator_t *nfsx); extern rpcsvc_program_t * -mnt1svc_init (xlator_t *nfsx); +mnt1svc_init(xlator_t *nfsx); extern void -mnt3svc_deinit (xlator_t *nfsx); +mnt3svc_deinit(xlator_t *nfsx); extern int -mount_init_state (xlator_t *nfsx); +mount_init_state(xlator_t *nfsx); extern int -mount_reconfigure_state (xlator_t *nfsx, dict_t *options); +mount_reconfigure_state(xlator_t *nfsx, dict_t *options); void -mount_rewrite_rmtab (struct mount3_state *ms, char *new_rmtab); +mount_rewrite_rmtab(struct mount3_state *ms, char *new_rmtab); struct mnt3_export * -mnt3_mntpath_to_export (struct mount3_state *ms, const char *dirpath, - gf_boolean_t export_parsing_match); +mnt3_mntpath_to_export(struct mount3_state *ms, const char *dirpath, + gf_boolean_t export_parsing_match); extern int -mnt3svc_update_mountlist (struct mount3_state *ms, rpcsvc_request_t *req, - const char *expname, const char *fullpath); +mnt3svc_update_mountlist(struct mount3_state *ms, rpcsvc_request_t *req, + const char *expname, const char *fullpath); int -mnt3_authenticate_request (struct mount3_state *ms, rpcsvc_request_t *req, - struct nfs3_fh *fh, const char *volname, - const char *path, char **authorized_path, - char **authorized_host, gf_boolean_t is_write_op); +mnt3_authenticate_request(struct mount3_state *ms, rpcsvc_request_t *req, + struct nfs3_fh *fh, const char *volname, + const char *path, char **authorized_path, + char **authorized_host, gf_boolean_t is_write_op); /* Data structure used to store the list of mounts points currently * in use by NFS clients. */ struct mountentry { - /* Links to mount3_state->mountlist. */ - struct list_head mlist; + /* Links to mount3_state->mountlist. */ + struct list_head mlist; - /* The export name */ - char exname[MNTPATHLEN]; - char hostname[MNTPATHLEN]; - char fullpath[MNTPATHLEN]; + /* The export name */ + char exname[MNTPATHLEN]; + char hostname[MNTPATHLEN]; + char fullpath[MNTPATHLEN]; - gf_boolean_t has_full_path; + gf_boolean_t has_full_path; - /* Since this is stored in a dict, we want to be able - * to find easily get the key we used to store - * the struct in our dict - */ - char hashkey[MNTPATHLEN*2+2]; + /* Since this is stored in a dict, we want to be able + * to find easily get the key we used to store + * the struct in our dict + */ + char hashkey[MNTPATHLEN * 2 + 2]; }; -#define MNT3_EXPTYPE_VOLUME 1 -#define MNT3_EXPTYPE_DIR 2 +#define MNT3_EXPTYPE_VOLUME 1 +#define MNT3_EXPTYPE_DIR 2 /* Structure to hold export-dir AUTH parameter */ struct host_auth_spec { - char *host_addr; /* Allowed IP or host name */ - uint32_t netmask; /* Network mask (Big-Endian) */ - struct host_auth_spec *next; /* Pointer to next AUTH struct */ + char *host_addr; /* Allowed IP or host name */ + uint32_t netmask; /* Network mask (Big-Endian) */ + struct host_auth_spec *next; /* Pointer to next AUTH struct */ }; struct mnt3_export { - struct list_head explist; - - /* The string that may contain either the volume name if the full volume - * is exported or the subdirectory in the volume. - */ - char *expname; - /* - * IP address, hostname or subnets who are allowed to connect to expname - * subvolume or subdirectory - */ - struct host_auth_spec* hostspec; - xlator_t *vol; - int exptype; - - /* This holds the full path that the client requested including - * the volume name AND the subdirectory in the volume. - */ - char *fullpath; - - /* Extracted from nfs volume options if nfs.dynamicvolumes is on. - */ - uuid_t volumeid; - uuid_t mountid; + struct list_head explist; + + /* The string that may contain either the volume name if the full volume + * is exported or the subdirectory in the volume. + */ + char *expname; + /* + * IP address, hostname or subnets who are allowed to connect to expname + * subvolume or subdirectory + */ + struct host_auth_spec *hostspec; + xlator_t *vol; + int exptype; + + /* This holds the full path that the client requested including + * the volume name AND the subdirectory in the volume. + */ + char *fullpath; + + /* Extracted from nfs volume options if nfs.dynamicvolumes is on. + */ + uuid_t volumeid; + uuid_t mountid; }; struct mount3_state { - xlator_t *nfsx; + xlator_t *nfsx; - /* The NFS state that this belongs to */ - struct nfs_state *nfs; + /* The NFS state that this belongs to */ + struct nfs_state *nfs; - /* The buffers for all network IO are got from this pool. */ - struct iobuf_pool *iobpool; + /* The buffers for all network IO are got from this pool. */ + struct iobuf_pool *iobpool; - /* List of exports, can be volumes or directories in those volumes. */ - struct list_head exportlist; + /* List of exports, can be volumes or directories in those volumes. */ + struct list_head exportlist; - /* List of current mount points over all the exports from this - * server. - */ - struct list_head mountlist; + /* List of current mount points over all the exports from this + * server. + */ + struct list_head mountlist; - /* Dict of current mount points over all the exports from this - * server. Mirrors the mountlist above, but can be used for - * faster lookup in the event that there are several mounts. - * Currently, each NFSOP is validated against this dict: each - * op is checked to see if the host that operates on the path - * does in fact have an entry in the mount dict. - */ - dict_t *mountdict; + /* Dict of current mount points over all the exports from this + * server. Mirrors the mountlist above, but can be used for + * faster lookup in the event that there are several mounts. + * Currently, each NFSOP is validated against this dict: each + * op is checked to see if the host that operates on the path + * does in fact have an entry in the mount dict. + */ + dict_t *mountdict; - /* Used to protect the mountlist & the mount dict */ - gf_lock_t mountlock; + /* Used to protect the mountlist & the mount dict */ + gf_lock_t mountlock; - /* Used to insert additional authentication parameters */ - struct mnt3_auth_params *auth_params; + /* Used to insert additional authentication parameters */ + struct mnt3_auth_params *auth_params; - /* Set to 0 if exporting full volumes is disabled. On by default. */ - gf_boolean_t export_volumes; - gf_boolean_t export_dirs; + /* Set to 0 if exporting full volumes is disabled. On by default. */ + gf_boolean_t export_volumes; + gf_boolean_t export_dirs; - pthread_t auth_refresh_thread; - gf_boolean_t stop_refresh; + pthread_t auth_refresh_thread; + gf_boolean_t stop_refresh; - struct auth_cache *authcache; + struct auth_cache *authcache; }; -#define gf_mnt3_export_dirs(mst) ((mst)->export_dirs) +#define gf_mnt3_export_dirs(mst) ((mst)->export_dirs) struct mount3_resolve_state { - struct mnt3_export *exp; - struct mount3_state *mstate; - rpcsvc_request_t *req; + struct mnt3_export *exp; + struct mount3_state *mstate; + rpcsvc_request_t *req; - char remainingdir[MNTPATHLEN]; - loc_t resolveloc; - struct nfs3_fh parentfh; + char remainingdir[MNTPATHLEN]; + loc_t resolveloc; + struct nfs3_fh parentfh; }; typedef struct mount3_resolve_state mnt3_resolve_t; int -mnt3_parse_dir_exports (rpcsvc_request_t *req, struct mount3_state *ms, - char *subdir, gf_boolean_t send_reply); +mnt3_parse_dir_exports(rpcsvc_request_t *req, struct mount3_state *ms, + char *subdir, gf_boolean_t send_reply); -char* -mnt3_get_volume_subdir (char *path, char **volname); +char * +mnt3_get_volume_subdir(char *path, char **volname); #endif diff --git a/xlators/nfs/server/src/netgroups.h b/xlators/nfs/server/src/netgroups.h index 6044abfabb3..1bb666b9596 100644 --- a/xlators/nfs/server/src/netgroups.h +++ b/xlators/nfs/server/src/netgroups.h @@ -19,36 +19,35 @@ #include "dict.h" #include "nfs.h" -#define GF_NG GF_NFS"-netgroup" +#define GF_NG GF_NFS "-netgroup" #define NG_FILE_PARSE_REGEX "([a-zA-Z0-9.(,)-]+)" #define NG_HOST_PARSE_REGEX "([a-zA-Z0-9.-]+)" struct netgroup_host { - char *hostname; /* Hostname of entry */ - char *user; /* User field in the entry */ - char *domain; /* Domain field in the entry */ + char *hostname; /* Hostname of entry */ + char *user; /* User field in the entry */ + char *domain; /* Domain field in the entry */ }; struct netgroup_entry { - char *netgroup_name; /* Name of the netgroup */ - dict_t *netgroup_ngs; /* Dict of netgroups in this netgroup */ - dict_t *netgroup_hosts; /* Dict of hosts in this netgroup. */ + char *netgroup_name; /* Name of the netgroup */ + dict_t *netgroup_ngs; /* Dict of netgroups in this netgroup */ + dict_t *netgroup_hosts; /* Dict of hosts in this netgroup. */ }; struct netgroups_file { - char *filename; /* Filename on disk */ - dict_t *ng_file_dict; /* Dict of netgroup entries */ + char *filename; /* Filename on disk */ + dict_t *ng_file_dict; /* Dict of netgroup entries */ }; struct netgroups_file * -ng_file_parse (const char *filepath); +ng_file_parse(const char *filepath); struct netgroup_entry * -ng_file_get_netgroup (const struct netgroups_file *ngfile, - const char *netgroup); +ng_file_get_netgroup(const struct netgroups_file *ngfile, const char *netgroup); void -ng_file_deinit (struct netgroups_file *ngfile); +ng_file_deinit(struct netgroups_file *ngfile); #endif /* _NETGROUPS_H */ diff --git a/xlators/nfs/server/src/nfs-common.h b/xlators/nfs/server/src/nfs-common.h index 8c9a1e33457..46147757ef5 100644 --- a/xlators/nfs/server/src/nfs-common.h +++ b/xlators/nfs/server/src/nfs-common.h @@ -18,57 +18,56 @@ #include "iatt.h" #include "compat-uuid.h" -//NFS_PATH_MAX hard-coded to 4096 as a work around for bug 2476. -//nfs server crashes when path received is longer than PATH_MAX -#define NFS_PATH_MAX 4096 -#define NFS_NAME_MAX NAME_MAX +// NFS_PATH_MAX hard-coded to 4096 as a work around for bug 2476. +// nfs server crashes when path received is longer than PATH_MAX +#define NFS_PATH_MAX 4096 +#define NFS_NAME_MAX NAME_MAX #define NFS_DEFAULT_CREATE_MODE 0600 extern xlator_t * -nfs_xlid_to_xlator (xlator_list_t *cl, uint8_t xlid); +nfs_xlid_to_xlator(xlator_list_t *cl, uint8_t xlid); extern uint16_t -nfs_xlator_to_xlid (xlator_list_t *cl, xlator_t *xl); +nfs_xlator_to_xlid(xlator_list_t *cl, xlator_t *xl); extern xlator_t * -nfs_path_to_xlator (xlator_list_t *cl, char *path); +nfs_path_to_xlator(xlator_list_t *cl, char *path); extern xlator_t * -nfs_mntpath_to_xlator (xlator_list_t *cl, char *path); +nfs_mntpath_to_xlator(xlator_list_t *cl, char *path); extern void -nfs_loc_wipe (loc_t *loc); +nfs_loc_wipe(loc_t *loc); extern int -nfs_loc_copy (loc_t *dst, loc_t *src); +nfs_loc_copy(loc_t *dst, loc_t *src); extern int -nfs_loc_fill (loc_t *loc, inode_t *inode, inode_t *parent, char *path); +nfs_loc_fill(loc_t *loc, inode_t *inode, inode_t *parent, char *path); -#define NFS_RESOLVE_EXIST 1 -#define NFS_RESOLVE_CREATE 2 +#define NFS_RESOLVE_EXIST 1 +#define NFS_RESOLVE_CREATE 2 extern int -nfs_inode_loc_fill (inode_t *inode, loc_t *loc, int how); +nfs_inode_loc_fill(inode_t *inode, loc_t *loc, int how); extern int -nfs_ino_loc_fill (inode_table_t *itable, uuid_t gfid, loc_t *l); +nfs_ino_loc_fill(inode_table_t *itable, uuid_t gfid, loc_t *l); extern int -nfs_entry_loc_fill (xlator_t *this, inode_table_t *itable, uuid_t pargfid, - char *entry, loc_t *loc, int how, - gf_boolean_t *freshlookup); +nfs_entry_loc_fill(xlator_t *this, inode_table_t *itable, uuid_t pargfid, + char *entry, loc_t *loc, int how, gf_boolean_t *freshlookup); extern int -nfs_root_loc_fill (inode_table_t *itable, loc_t *loc); +nfs_root_loc_fill(inode_table_t *itable, loc_t *loc); extern uint32_t -nfs_hash_gfid (uuid_t gfid); +nfs_hash_gfid(uuid_t gfid); extern int -nfs_gfid_loc_fill (inode_table_t *itable, uuid_t gfid, loc_t *loc, int how); +nfs_gfid_loc_fill(inode_table_t *itable, uuid_t gfid, loc_t *loc, int how); void -nfs_fix_generation (xlator_t *this, inode_t *inode); +nfs_fix_generation(xlator_t *this, inode_t *inode); #endif diff --git a/xlators/nfs/server/src/nfs-fops.h b/xlators/nfs/server/src/nfs-fops.h index acf81e2ce12..1f7c3b2d1f9 100644 --- a/xlators/nfs/server/src/nfs-fops.h +++ b/xlators/nfs/server/src/nfs-fops.h @@ -38,207 +38,205 @@ * That is initiated in nfs_init_subvolumes in nfs.c. */ struct nfs_fop_local { - /* The local sent along by the user of the fop. */ - void *proglocal; - - /* The address of the callback supplied by the user. After our - * callback is executed this one is called. - * The exact cast destination of this pointer will depend on the - * fop that is being called. - */ - void *progcbk; - - /* Used only for write requests. */ - struct iobref *iobref; - - inode_t *parent; - inode_t *newparent; - inode_t *inode; - - /* Set to 1 by nfs-inodes layer, which uses this to decide whether to - * link the newly allocated inode into the itable, in case the fop was - * successful. - */ - int newinode; - - /* Used by nfs-fops layer in order to determine whether to funge the - * ino in a dir's stbuf. This funging of root ino is needed to ensure - * that the root ino remains 1 even when the NFS server has been - * restarted. Note that in distribute, a fresh lookup and a revalidate - * on the root inode returns two different inode numbers and this we - * need to handle by ourself. - */ - int rootinode; - - /* This member is used to determine whether the new parent of a file - * being renamed is the root directory. If yes, the ino is funged. - */ - int newrootinode; - int newrootparentinode; - - /* Determines whether to funge the ino in the post and pre parent - * stbufs for a file/dir where the parent directory could be the root - * dir. Needed here because of the same reason as above. - */ - int rootparentinode; - - char path[NFS_NAME_MAX + 1]; - char newpath[NFS_NAME_MAX + 1]; - xlator_t *nfsx; - dict_t *dictgfid; - - fd_t *fd; - int cmd; - struct gf_flock flock; + /* The local sent along by the user of the fop. */ + void *proglocal; + + /* The address of the callback supplied by the user. After our + * callback is executed this one is called. + * The exact cast destination of this pointer will depend on the + * fop that is being called. + */ + void *progcbk; + + /* Used only for write requests. */ + struct iobref *iobref; + + inode_t *parent; + inode_t *newparent; + inode_t *inode; + + /* Set to 1 by nfs-inodes layer, which uses this to decide whether to + * link the newly allocated inode into the itable, in case the fop was + * successful. + */ + int newinode; + + /* Used by nfs-fops layer in order to determine whether to funge the + * ino in a dir's stbuf. This funging of root ino is needed to ensure + * that the root ino remains 1 even when the NFS server has been + * restarted. Note that in distribute, a fresh lookup and a revalidate + * on the root inode returns two different inode numbers and this we + * need to handle by ourself. + */ + int rootinode; + + /* This member is used to determine whether the new parent of a file + * being renamed is the root directory. If yes, the ino is funged. + */ + int newrootinode; + int newrootparentinode; + + /* Determines whether to funge the ino in the post and pre parent + * stbufs for a file/dir where the parent directory could be the root + * dir. Needed here because of the same reason as above. + */ + int rootparentinode; + + char path[NFS_NAME_MAX + 1]; + char newpath[NFS_NAME_MAX + 1]; + xlator_t *nfsx; + dict_t *dictgfid; + + fd_t *fd; + int cmd; + struct gf_flock flock; }; extern struct nfs_fop_local * -nfs_fop_local_init (xlator_t *xl); +nfs_fop_local_init(xlator_t *xl); extern void -nfs_fop_local_wipe (xlator_t *xl, struct nfs_fop_local *l); - -#define nfs_state(nfsxl) (nfsxl)->private -#define nfs_fop_mempool(nfxl) (((struct nfs_state *)nfs_state(nfxl))->foppool) - -#define prog_data_to_nfl(nf,nflocal, fram, pcbk, plocal) \ - do { \ - nflocal = nfs_fop_local_init (nf); \ - if (nflocal) { \ - nflocal->proglocal = plocal; \ - nflocal->progcbk = *VOID(&pcbk); \ - nflocal->nfsx = nf; \ - if (fram) \ - ((call_frame_t *)fram)->local = nflocal;\ - } \ - } while (0) \ - - - -#define nfl_to_prog_data(nflocal, pcbk, fram) \ - do { \ - nflocal = fram->local; \ - fram->local = nflocal->proglocal; \ - pcbk = nflocal->progcbk; \ - } while (0) \ - -#define nfs_fop_handle_local_init(fram,nfx, nfloc, cbck,prgloc,retval,lab) \ - do { \ - prog_data_to_nfl (nfx, nfloc, fram, cbck, prgloc); \ - if (!nfloc) { \ - gf_msg (GF_NFS, GF_LOG_ERROR, ENOMEM, \ - NFS_MSG_NO_MEMORY, "Failed to init local"); \ - retval = -ENOMEM; \ - goto lab; \ - } \ - } while (0) \ - -extern int -nfs_fop_fstat (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, - fop_stat_cbk_t cbk, void *local); +nfs_fop_local_wipe(xlator_t *xl, struct nfs_fop_local *l); + +#define nfs_state(nfsxl) (nfsxl)->private +#define nfs_fop_mempool(nfxl) (((struct nfs_state *)nfs_state(nfxl))->foppool) + +#define prog_data_to_nfl(nf, nflocal, fram, pcbk, plocal) \ + do { \ + nflocal = nfs_fop_local_init(nf); \ + if (nflocal) { \ + nflocal->proglocal = plocal; \ + nflocal->progcbk = *VOID(&pcbk); \ + nflocal->nfsx = nf; \ + if (fram) \ + ((call_frame_t *)fram)->local = nflocal; \ + } \ + } while (0) + +#define nfl_to_prog_data(nflocal, pcbk, fram) \ + do { \ + nflocal = fram->local; \ + fram->local = nflocal->proglocal; \ + pcbk = nflocal->progcbk; \ + } while (0) + +#define nfs_fop_handle_local_init(fram, nfx, nfloc, cbck, prgloc, retval, lab) \ + do { \ + prog_data_to_nfl(nfx, nfloc, fram, cbck, prgloc); \ + if (!nfloc) { \ + gf_msg(GF_NFS, GF_LOG_ERROR, ENOMEM, NFS_MSG_NO_MEMORY, \ + "Failed to init local"); \ + retval = -ENOMEM; \ + goto lab; \ + } \ + } while (0) + +extern int +nfs_fop_fstat(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, + fop_stat_cbk_t cbk, void *local); extern int -nfs_fop_readdirp (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *dirfd, - size_t bufsize, off_t offset, fop_readdir_cbk_t cbk, - void *local); +nfs_fop_readdirp(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *dirfd, + size_t bufsize, off_t offset, fop_readdir_cbk_t cbk, + void *local); extern int -nfs_fop_lookup (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, - fop_lookup_cbk_t cbk, void *local); +nfs_fop_lookup(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, + fop_lookup_cbk_t cbk, void *local); extern int -nfs_fop_create (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - int flags, mode_t mode, fd_t *fd, fop_create_cbk_t cbk, - void *local); +nfs_fop_create(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + int flags, mode_t mode, fd_t *fd, fop_create_cbk_t cbk, + void *local); extern int -nfs_fop_flush (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, - fop_flush_cbk_t cbk, void *local); +nfs_fop_flush(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, + fop_flush_cbk_t cbk, void *local); extern int -nfs_fop_mkdir (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - mode_t mode, fop_mkdir_cbk_t cbk, void *local); +nfs_fop_mkdir(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + mode_t mode, fop_mkdir_cbk_t cbk, void *local); extern int -nfs_fop_truncate (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, - off_t offset, fop_truncate_cbk_t cbk, void *local); +nfs_fop_truncate(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, + off_t offset, fop_truncate_cbk_t cbk, void *local); extern int -nfs_fop_read (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, - size_t size, off_t offset, fop_readv_cbk_t cbk, void *local); +nfs_fop_read(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, + size_t size, off_t offset, fop_readv_cbk_t cbk, void *local); extern int -nfs_fop_fsync (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, - int32_t datasync, fop_fsync_cbk_t cbk, void *local); +nfs_fop_fsync(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, + int32_t datasync, fop_fsync_cbk_t cbk, void *local); extern int -nfs_fop_write (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, - struct iobref *srciobref, struct iovec *vector, int32_t count, - off_t offset, fop_writev_cbk_t cbk, void *local); +nfs_fop_write(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, + struct iobref *srciobref, struct iovec *vector, int32_t count, + off_t offset, fop_writev_cbk_t cbk, void *local); extern int -nfs_fop_open (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, - int32_t flags, fd_t *fd, fop_open_cbk_t cbk, - void *local); +nfs_fop_open(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, + int32_t flags, fd_t *fd, fop_open_cbk_t cbk, void *local); extern int -nfs_fop_rename (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc, - loc_t *newloc, fop_rename_cbk_t cbk, void *local); +nfs_fop_rename(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc, + loc_t *newloc, fop_rename_cbk_t cbk, void *local); extern int -nfs_fop_link (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc, - loc_t *newloc, fop_link_cbk_t cbk, void *local); +nfs_fop_link(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc, + loc_t *newloc, fop_link_cbk_t cbk, void *local); extern int -nfs_fop_unlink (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - fop_unlink_cbk_t cbk, void *local); +nfs_fop_unlink(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + fop_unlink_cbk_t cbk, void *local); extern int -nfs_fop_rmdir (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - fop_rmdir_cbk_t cbk, void *local); +nfs_fop_rmdir(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + fop_rmdir_cbk_t cbk, void *local); extern int -nfs_fop_mknod (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - mode_t mode, dev_t dev, fop_mknod_cbk_t cbk, void *local); +nfs_fop_mknod(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + mode_t mode, dev_t dev, fop_mknod_cbk_t cbk, void *local); extern int -nfs_fop_readlink (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - size_t size, fop_readlink_cbk_t cbk, void *local); +nfs_fop_readlink(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + size_t size, fop_readlink_cbk_t cbk, void *local); extern int -nfs_fop_symlink (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, char *target, - loc_t *pathloc, fop_symlink_cbk_t cbk, void *local); +nfs_fop_symlink(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, char *target, + loc_t *pathloc, fop_symlink_cbk_t cbk, void *local); extern int -nfs_fop_setattr (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - struct iatt *buf, int32_t valid, fop_setattr_cbk_t cbk, - void *local); +nfs_fop_setattr(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + struct iatt *buf, int32_t valid, fop_setattr_cbk_t cbk, + void *local); extern int -nfs_fop_statfs (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - fop_statfs_cbk_t cbk, void *local); +nfs_fop_statfs(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + fop_statfs_cbk_t cbk, void *local); extern int -nfs_fop_opendir (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - fd_t *dirfd, fop_opendir_cbk_t cbk, void *local); +nfs_fop_opendir(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + fd_t *dirfd, fop_opendir_cbk_t cbk, void *local); extern int -nfs_fop_stat (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, - fop_stat_cbk_t cbk, void *local); +nfs_fop_stat(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, + fop_stat_cbk_t cbk, void *local); extern int -nfs_fop_access (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, - int32_t accesstest, fop_access_cbk_t cbk, void *local); +nfs_fop_access(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, + int32_t accesstest, fop_access_cbk_t cbk, void *local); extern int -nfs_fop_lk (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, - int cmd, struct gf_flock *flock, fop_lk_cbk_t cbk, void *local); +nfs_fop_lk(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, int cmd, + struct gf_flock *flock, fop_lk_cbk_t cbk, void *local); extern int -nfs_fop_getxattr (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, - char *name, dict_t *xdata, fop_getxattr_cbk_t cbk, void *local); +nfs_fop_getxattr(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, + char *name, dict_t *xdata, fop_getxattr_cbk_t cbk, + void *local); extern int -nfs_fop_setxattr (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, - loc_t *loc, dict_t *dict, int32_t flags, dict_t *xdata, - fop_setxattr_cbk_t cbk, void *local); +nfs_fop_setxattr(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, + dict_t *dict, int32_t flags, dict_t *xdata, + fop_setxattr_cbk_t cbk, void *local); #endif diff --git a/xlators/nfs/server/src/nfs-generics.h b/xlators/nfs/server/src/nfs-generics.h index c3fb4fca339..f71b45a513d 100644 --- a/xlators/nfs/server/src/nfs-generics.h +++ b/xlators/nfs/server/src/nfs-generics.h @@ -17,12 +17,12 @@ #include "nfs-inodes.h" struct nfs_direntcache { - gf_dirent_t entries; /* Head of list of cached dirents. */ - gf_dirent_t *next; /* Pointer to the next entry that - * should be sent by readdir */ - uint64_t prev_off; /* Offset where the next read will - * happen. - */ + gf_dirent_t entries; /* Head of list of cached dirents. */ + gf_dirent_t *next; /* Pointer to the next entry that + * should be sent by readdir */ + uint64_t prev_off; /* Offset where the next read will + * happen. + */ }; /* WE're trying to abstract the fops interface from the NFS xlator so that @@ -32,132 +32,130 @@ struct nfs_direntcache { * state is requires in the fd. E.g. the dirent cache for a directory fd_t. */ typedef struct nfs_fop_fdcontext { - pthread_mutex_t lock; - size_t dirent_bufsize; - off_t offset; - struct nfs_direntcache *dcache; - xlator_t *dirvol; + pthread_mutex_t lock; + size_t dirent_bufsize; + off_t offset; + struct nfs_direntcache *dcache; + xlator_t *dirvol; } nfs_fdctx_t; extern int -nfs_fstat (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, - fop_stat_cbk_t cbk, void *local); +nfs_fstat(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, + fop_stat_cbk_t cbk, void *local); extern int -nfs_readdirp (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *dirfd, - size_t bufsize, off_t offset, fop_readdir_cbk_t cbk, void *local); - +nfs_readdirp(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *dirfd, + size_t bufsize, off_t offset, fop_readdir_cbk_t cbk, void *local); extern int -nfs_lookup (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - fop_lookup_cbk_t cbk, void *local); +nfs_lookup(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + fop_lookup_cbk_t cbk, void *local); extern int -nfs_create (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - int flags, mode_t mode, fop_create_cbk_t cbk, void *local); +nfs_create(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + int flags, mode_t mode, fop_create_cbk_t cbk, void *local); extern int -nfs_flush (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, - fop_flush_cbk_t cbk, void *local); +nfs_flush(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, + fop_flush_cbk_t cbk, void *local); extern int -nfs_mkdir (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - mode_t mode, fop_mkdir_cbk_t cbk, void *local); +nfs_mkdir(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + mode_t mode, fop_mkdir_cbk_t cbk, void *local); extern int -nfs_truncate (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - off_t offset, fop_truncate_cbk_t cbk, void *local); +nfs_truncate(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + off_t offset, fop_truncate_cbk_t cbk, void *local); extern int -nfs_read (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, size_t size, - off_t offset, fop_readv_cbk_t cbk, void *local); +nfs_read(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, size_t size, + off_t offset, fop_readv_cbk_t cbk, void *local); extern int -nfs_fsync (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, - int32_t datasync, fop_fsync_cbk_t cbk, void *local); +nfs_fsync(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, + int32_t datasync, fop_fsync_cbk_t cbk, void *local); extern int -nfs_write (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, - struct iobref *srciobref, struct iovec *vector, int32_t count, - off_t offset, fop_writev_cbk_t cbk, void *local); +nfs_write(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, + struct iobref *srciobref, struct iovec *vector, int32_t count, + off_t offset, fop_writev_cbk_t cbk, void *local); extern int -nfs_open (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - int32_t flags, fop_open_cbk_t cbk, void *local); +nfs_open(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + int32_t flags, fop_open_cbk_t cbk, void *local); extern int -nfs_rename (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc, - loc_t *newloc, fop_rename_cbk_t cbk, void *local); +nfs_rename(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc, + loc_t *newloc, fop_rename_cbk_t cbk, void *local); extern int -nfs_link (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc, - loc_t *newloc, fop_link_cbk_t cbk, void *local); +nfs_link(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc, + loc_t *newloc, fop_link_cbk_t cbk, void *local); extern int -nfs_unlink (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - fop_unlink_cbk_t cbk, void *local); +nfs_unlink(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + fop_unlink_cbk_t cbk, void *local); extern int -nfs_rmdir (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - fop_rmdir_cbk_t cbk, void *local); +nfs_rmdir(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + fop_rmdir_cbk_t cbk, void *local); extern int -nfs_mknod (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - mode_t mode, dev_t dev, fop_mknod_cbk_t cbk, void *local); +nfs_mknod(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + mode_t mode, dev_t dev, fop_mknod_cbk_t cbk, void *local); extern int -nfs_readlink (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *linkloc, - fop_readlink_cbk_t cbk, void *local); +nfs_readlink(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *linkloc, + fop_readlink_cbk_t cbk, void *local); extern int -nfs_setattr (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - struct iatt *buf, int32_t valid, fop_setattr_cbk_t cbk, - void *local); +nfs_setattr(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + struct iatt *buf, int32_t valid, fop_setattr_cbk_t cbk, + void *local); extern int -nfs_statfs (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - fop_statfs_cbk_t cbk, void *local); +nfs_statfs(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + fop_statfs_cbk_t cbk, void *local); extern int -nfs_stat (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - fop_stat_cbk_t cbk, void *local); +nfs_stat(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + fop_stat_cbk_t cbk, void *local); extern int -nfs_symlink (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, char *target, - loc_t *linkloc, fop_symlink_cbk_t cbk, void *local); +nfs_symlink(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, char *target, + loc_t *linkloc, fop_symlink_cbk_t cbk, void *local); /* Synchronous equivalents */ extern call_stub_t * -nfs_open_sync (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - int32_t flags); +nfs_open_sync(xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, int32_t flags); extern call_stub_t * -nfs_write_sync (xlator_t *xl, nfs_user_t *nfu, fd_t *fd, struct iobuf *srciob, - struct iovec *vec, int count, off_t offset); +nfs_write_sync(xlator_t *xl, nfs_user_t *nfu, fd_t *fd, struct iobuf *srciob, + struct iovec *vec, int count, off_t offset); extern call_stub_t * -nfs_read_sync (xlator_t *xl, nfs_user_t *nfu, fd_t *fd, size_t size, - off_t offset); +nfs_read_sync(xlator_t *xl, nfs_user_t *nfu, fd_t *fd, size_t size, + off_t offset); extern int -nfs_opendir (xlator_t *nfsx, xlator_t *fopxl, nfs_user_t *nfu, loc_t *pathloc, - fop_opendir_cbk_t cbk, void *local); +nfs_opendir(xlator_t *nfsx, xlator_t *fopxl, nfs_user_t *nfu, loc_t *pathloc, + fop_opendir_cbk_t cbk, void *local); extern int -nfs_access (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - int32_t accesstest, fop_access_cbk_t cbk, void *local); +nfs_access(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + int32_t accesstest, fop_access_cbk_t cbk, void *local); extern int -nfs_lk (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, - int cmd, struct gf_flock *flock, fop_lk_cbk_t cbk, void *local); +nfs_lk(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, int cmd, + struct gf_flock *flock, fop_lk_cbk_t cbk, void *local); extern int -nfs_getxattr (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, - char *name, dict_t *xdata, fop_getxattr_cbk_t cbk, void *local); +nfs_getxattr(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, + char *name, dict_t *xdata, fop_getxattr_cbk_t cbk, void *local); extern int -nfs_setxattr (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, - loc_t *loc, dict_t *dict, int32_t flags, dict_t *xdata, - fop_setxattr_cbk_t cbk, void *local); +nfs_setxattr(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, + dict_t *dict, int32_t flags, dict_t *xdata, fop_setxattr_cbk_t cbk, + void *local); #endif diff --git a/xlators/nfs/server/src/nfs-inodes.h b/xlators/nfs/server/src/nfs-inodes.h index 40037fbcbb2..7a874c8a4ce 100644 --- a/xlators/nfs/server/src/nfs-inodes.h +++ b/xlators/nfs/server/src/nfs-inodes.h @@ -17,54 +17,51 @@ #include "call-stub.h" #include "nfs-fops.h" - extern int -nfs_link_inode (inode_t *newi, inode_t *parent, char *name, - struct iatt *newstat); +nfs_link_inode(inode_t *newi, inode_t *parent, char *name, + struct iatt *newstat); extern int -nfs_inode_create (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, - loc_t *pathloc, int flags, int mode, fop_create_cbk_t cbk, - void *local); +nfs_inode_create(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + int flags, int mode, fop_create_cbk_t cbk, void *local); extern int -nfs_inode_mkdir (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - int mode, fop_mkdir_cbk_t cbk, void *local); +nfs_inode_mkdir(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + int mode, fop_mkdir_cbk_t cbk, void *local); extern int -nfs_inode_open (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, - int32_t flags, fop_open_cbk_t cbk, - void *local); +nfs_inode_open(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, + int32_t flags, fop_open_cbk_t cbk, void *local); extern int -nfs_inode_rename (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc, - loc_t *newloc, fop_rename_cbk_t cbk, void *local); +nfs_inode_rename(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc, + loc_t *newloc, fop_rename_cbk_t cbk, void *local); extern int -nfs_inode_link (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc, - loc_t *newloc, fop_link_cbk_t cbk, void *local); +nfs_inode_link(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc, + loc_t *newloc, fop_link_cbk_t cbk, void *local); extern int -nfs_inode_unlink (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - fop_unlink_cbk_t cbk, void *local); +nfs_inode_unlink(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + fop_unlink_cbk_t cbk, void *local); extern int -nfs_inode_rmdir (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - fop_rmdir_cbk_t cbk, void *local); +nfs_inode_rmdir(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + fop_rmdir_cbk_t cbk, void *local); extern int -nfs_inode_symlink (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, char *target, - loc_t *pathloc, fop_symlink_cbk_t cbk, void *local); +nfs_inode_symlink(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, char *target, + loc_t *pathloc, fop_symlink_cbk_t cbk, void *local); extern int -nfs_inode_opendir (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, - fop_opendir_cbk_t cbk, void *local); +nfs_inode_opendir(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, + fop_opendir_cbk_t cbk, void *local); extern int -nfs_inode_mknod (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - mode_t mode, dev_t dev, fop_mknod_cbk_t cbk, void *local); +nfs_inode_mknod(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + mode_t mode, dev_t dev, fop_mknod_cbk_t cbk, void *local); extern int -nfs_inode_lookup (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - fop_lookup_cbk_t cbk, void *local); +nfs_inode_lookup(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + fop_lookup_cbk_t cbk, void *local); #endif diff --git a/xlators/nfs/server/src/nfs-mem-types.h b/xlators/nfs/server/src/nfs-mem-types.h index 5cac0eb4978..5737aae6a09 100644 --- a/xlators/nfs/server/src/nfs-mem-types.h +++ b/xlators/nfs/server/src/nfs-mem-types.h @@ -8,50 +8,48 @@ cases as published by the Free Software Foundation. */ - #ifndef __NFS_MEM_TYPES_H__ #define __NFS_MEM_TYPES_H__ #include "mem-types.h" enum gf_nfs_mem_types_ { - gf_nfs_mt_mountentry = gf_common_mt_end + 1, - gf_nfs_mt_mountbody, - gf_nfs_mt_nfs_state, - gf_nfs_mt_char, - gf_nfs_mt_exportnode, - gf_nfs_mt_groupnode, - gf_nfs_mt_mount3_state, - gf_nfs_mt_write3args, - gf_nfs_mt_nfs3_export, - gf_nfs_mt_nfs3_state, - gf_nfs_mt_entry3, - gf_nfs_mt_entryp3, - gf_nfs_mt_nfs3_fd_entry, - gf_nfs_mt_nfs3_fh, - gf_nfs_mt_nfs_initer_list, - gf_nfs_mt_xlator_t, - gf_nfs_mt_list_head, - gf_nfs_mt_mnt3_resolve, - gf_nfs_mt_mnt3_export, - gf_nfs_mt_mnt3_auth_params, - gf_nfs_mt_int, - gf_nfs_mt_mountres3, - gf_nfs_mt_mountstat3, - gf_nfs_mt_inode_q, - gf_nfs_mt_nlm4_state, - gf_nfs_mt_nlm4_cm, - gf_nfs_mt_nlm4_fde, - gf_nfs_mt_nlm4_nlmclnt, - gf_nfs_mt_nlm4_share, - gf_nfs_mt_aux_gids, - gf_nfs_mt_inode_ctx, - gf_nfs_mt_auth_spec, - gf_nfs_mt_arr, - gf_nfs_mt_auth_cache, - gf_nfs_mt_auth_cache_entry, - gf_nfs_mt_nlm4_notify, - gf_nfs_mt_end + gf_nfs_mt_mountentry = gf_common_mt_end + 1, + gf_nfs_mt_mountbody, + gf_nfs_mt_nfs_state, + gf_nfs_mt_char, + gf_nfs_mt_exportnode, + gf_nfs_mt_groupnode, + gf_nfs_mt_mount3_state, + gf_nfs_mt_write3args, + gf_nfs_mt_nfs3_export, + gf_nfs_mt_nfs3_state, + gf_nfs_mt_entry3, + gf_nfs_mt_entryp3, + gf_nfs_mt_nfs3_fd_entry, + gf_nfs_mt_nfs3_fh, + gf_nfs_mt_nfs_initer_list, + gf_nfs_mt_xlator_t, + gf_nfs_mt_list_head, + gf_nfs_mt_mnt3_resolve, + gf_nfs_mt_mnt3_export, + gf_nfs_mt_mnt3_auth_params, + gf_nfs_mt_int, + gf_nfs_mt_mountres3, + gf_nfs_mt_mountstat3, + gf_nfs_mt_inode_q, + gf_nfs_mt_nlm4_state, + gf_nfs_mt_nlm4_cm, + gf_nfs_mt_nlm4_fde, + gf_nfs_mt_nlm4_nlmclnt, + gf_nfs_mt_nlm4_share, + gf_nfs_mt_aux_gids, + gf_nfs_mt_inode_ctx, + gf_nfs_mt_auth_spec, + gf_nfs_mt_arr, + gf_nfs_mt_auth_cache, + gf_nfs_mt_auth_cache_entry, + gf_nfs_mt_nlm4_notify, + gf_nfs_mt_end }; #endif - diff --git a/xlators/nfs/server/src/nfs-messages.h b/xlators/nfs/server/src/nfs-messages.h index 919fb5eb1d1..b8fe99e45d3 100644 --- a/xlators/nfs/server/src/nfs-messages.h +++ b/xlators/nfs/server/src/nfs-messages.h @@ -22,210 +22,81 @@ * glfs-message-id.h. */ -GLFS_MSGID(NFS, - NFS_MSG_UNUSED_1, - NFS_MSG_UNUSED_2, - NFS_MSG_INVALID_ENTRY, - NFS_MSG_INODE_LOC_FILL_ERROR, - NFS_MSG_HARD_RESOLVE_FAIL, - NFS_MSG_ARGS_DECODE_ERROR, - NFS_MSG_LOOKUP_PROC_FAIL, - NFS_MSG_UNUSED_8, - NFS_MSG_UNUSED_9, - NFS_MSG_READLINK_PROC_FAIL, - NFS_MSG_UNUSED_11, - NFS_MSG_ANONYMOUS_FD_FAIL, - NFS_MSG_READ_FAIL, - NFS_MSG_UNUSED_14, - NFS_MSG_UNUSED_15, - NFS_MSG_STATE_WRONG, - NFS_MSG_WRITE_FAIL, - NFS_MSG_UNUSED_18, - NFS_MSG_UNUSED_19, - NFS_MSG_UNUSED_20, - NFS_MSG_CREATE_FAIL, - NFS_MSG_UNUSED_22, - NFS_MSG_UNUSED_23, - NFS_MSG_DIR_OP_FAIL, - NFS_MSG_UNUSED_25, - NFS_MSG_SYMLINK_FAIL, - NFS_MSG_UNUSED_27, - NFS_MSG_MKNOD_FAIL, - NFS_MSG_OPT_INIT_FAIL, - NFS_MSG_UNUSED_30, - NFS_MSG_REMOVE_FAIL, - NFS_MSG_RMDIR_CBK, - NFS_MSG_UNUSED_33, - NFS_MSG_RENAME_FAIL, - NFS_MSG_UNUSED_35, - NFS_MSG_LINK_FAIL, - NFS_MSG_UNUSED_37, - NFS_MSG_UNUSED_38, - NFS_MSG_READDIR_FAIL, - NFS_MSG_READDIRP_FAIL, - NFS_MSG_UNUSED_41, - NFS_MSG_UNUSED_42, - NFS_MSG_FSTAT_FAIL, - NFS_MSG_UNUSED_44, - NFS_MSG_FSINFO_FAIL, - NFS_MSG_UNUSED_46, - NFS_MSG_PATHCONF_FAIL, - NFS_MSG_UNUSED_48, - NFS_MSG_COMMIT_FAIL, - NFS_MSG_PROT_INIT_ADD_FAIL, - NFS_MSG_FORMAT_FAIL, - NFS_MSG_SNPRINTF_FAIL, - NFS_MSG_VOLID_MISSING, - NFS_MSG_PARSE_VOL_UUID_FAIL, - NFS_MSG_STR2BOOL_FAIL, - NFS_MSG_SUBVOL_INIT_FAIL, - NFS_MSG_NO_MEMORY, - NFS_MSG_LISTENERS_CREATE_FAIL, - NFS_MSG_STATE_INIT_FAIL, - NFS_MSG_RECONF_FAIL, - NFS_MSG_RECONF_SUBVOL_FAIL, - NFS_MSG_STR_TOO_LONG, - NFS_MSG_STATE_MISSING, - NFS_MSG_INDEX_NOT_FOUND, - NFS_MSG_EXPORT_ID_FAIL, - NFS_MSG_NO_RW_ACCESS, - NFS_MSG_BAD_HANDLE, - NFS_MSG_RESOLVE_FH_FAIL, - NFS_MSG_RESOLVE_STAT, - NFS_MSG_VOL_DISABLE, - NFS_MSG_INIT_CALL_STAT_FAIL, - NFS_MSG_ENCODE_FAIL, - NFS_MSG_SERIALIZE_REPLY_FAIL, - NFS_MSG_SUBMIT_REPLY_FAIL, - NFS_MSG_UNUSED_75, - NFS_MSG_UNUSED_76, - NFS_MSG_STAT_FOP_FAIL, - NFS_MSG_GETATTR_FAIL, - NFS_MSG_UNUSED_79, - NFS_MSG_UNUSED_80, - NFS_MSG_TIMESTAMP_NO_SYNC, - NFS_MSG_SETATTR_INVALID, - NFS_MSG_SETATTR_FAIL, - NFS_MSG_UNUSED_84, - NFS_MSG_ACCESS_PROC_FAIL, - NFS_MSG_PGM_NOT_FOUND, - NFS_MSG_PGM_INIT_FAIL, - NFS_MSG_PGM_REG_FAIL, - NFS_MSG_LOOKUP_ROOT_FAIL, - NFS_MSG_ROOT_LOC_INIT_FAIL, - NFS_MSG_STARTUP_FAIL, - NFS_MSG_XLATOR_INIT_FAIL, - NFS_MSG_NFS_MAN_DISABLE, - NFS_MSG_DICT_GET_FAILED, - NFS_MSG_PARSE_FAIL, - NFS_MSG_NLM_MAN_DISABLE, - NFS_MSG_ACL_MAN_DISABLE, - NFS_MSG_DICT_SET_FAILED, - NFS_MSG_INIT_GRP_CACHE_FAIL, - NFS_MSG_NO_PERM, - NFS_MSG_REG_FILE_ERROR, - NFS_MSG_RPC_INIT_FAIL, - NFS_MSG_RPC_CONFIG_FAIL, - NFS_MSG_RECONFIG_PATH, - NFS_MSG_RECONFIG_VALUE, - NFS_MSG_RECONFIG_VOL, - NFS_MSG_NLM_INFO, - NFS_MSG_ACL_INFO, - NFS_MSG_INIT_FAIL, - NFS_MSG_STARTED, - NFS_MSG_VOL_NOT_FOUND, - NFS_MSG_RECONFIG_ENABLE, - NFS_MSG_RECONFIG_FAIL, - NFS_MSG_MNT_STATE_NOT_FOUND, - NFS_MSG_ENCODE_MSG_FAIL, - NFS_MSG_REP_SUBMIT_FAIL, - NFS_MSG_READ_LOCKED, - NFS_MSG_MODIFY_LOCKED, - NFS_MSG_RWTAB_OVERWRITE_FAIL, - NFS_MSG_UPDATE_FAIL, - NFS_MSG_OPEN_FAIL, - NFS_MSG_LOCK_FAIL, - NFS_MSG_REWRITE_ERROR, - NFS_MSG_HASH_PATH_FAIL, - NFS_MSG_LOOKUP_MNT_ERROR, - NFS_MSG_GET_ROOT_INODE_FAIL, - NFS_MSG_RESOLVE_INODE_FAIL, - NFS_MSG_RESOLVE_SUBDIR_FAIL, - NFS_MSG_RESOLVE_SYMLINK_ERROR, - NFS_MSG_RESOLVE_ERROR, - NFS_MSG_UNSUPPORTED_VERSION, - NFS_MSG_AUTH_VERIFY_FAILED, - NFS_MSG_PEER_NOT_ALLOWED, - NFS_MSG_GET_PEER_ADDR_FAIL, - NFS_MSG_BAD_PEER, - NFS_MSG_PEER_TOO_LONG, - NFS_MSG_CALLER_NOT_FOUND, - NFS_MSG_GET_REMOTE_NAME_FAIL, - NFS_MSG_UNKNOWN_MNT_TYPE, - NFS_MSG_PARSE_HOSTSPEC_FAIL, - NFS_MSG_PARSE_AUTH_PARAM_FAIL, - NFS_MSG_SET_EXP_FAIL, - NFS_MSG_INIT_DIR_EXP_FAIL, - NFS_MSG_DIR_EXP_SETUP_FAIL, - NFS_MSG_VOL_INIT_FAIL, - NFS_MSG_AUTH_ERROR, - NFS_MSG_UPDATING_EXP, - NFS_MSG_SET_EXP_AUTH_PARAM_FAIL, - NFS_MSG_UPDATING_NET_GRP, - NFS_MSG_SET_NET_GRP_FAIL, - NFS_MSG_PURGING_AUTH_CACHE, - NFS_MSG_MNT_STATE_INIT_FAIL, - NFS_MSG_EXP_AUTH_DISABLED, - NFS_MSG_FH_TO_VOL_FAIL, - NFS_MSG_INODE_SHARES_NOT_FOUND, - NFS_MSG_VOLUME_ERROR, - NFS_MSG_GET_USER_ACL_FAIL, - NFS_MSG_GET_DEF_ACL_FAIL, - NFS_MSG_SET_USER_ACL_FAIL, - NFS_MSG_SET_DEF_ACL_FAIL, - NFS_MSG_ACL_INIT_FAIL, - NFS_MSG_LOAD_PARSE_ERROR, - NFS_MSG_CLNT_CALL_ERROR, - NFS_MSG_CLNT_CREATE_ERROR, - NFS_MSG_NLM_GRACE_PERIOD, - NFS_MSG_RPC_CLNT_ERROR, - NFS_MSG_GET_PORT_ERROR, - NFS_MSG_NLMCLNT_NOT_FOUND, - NFS_MSG_FD_LOOKUP_NULL, - NFS_MSG_SM_NOTIFY, - NFS_MSG_NLM_INIT_FAIL, - NFS_MSG_START_ERROR, - NFS_MSG_UNLINK_ERROR, - NFS_MSG_SHARE_LIST_STORE_FAIL, - NFS_MSG_CLIENT_NOT_FOUND, - NFS_MSG_SHARE_CALL_FAIL, - NFS_MSG_UNSHARE_CALL_FAIL, - NFS_MSG_GET_PID_FAIL, - NFS_MSG_ARG_FREE_FAIL, - NFS_MSG_PMAP_UNSET_FAIL, - NFS_MSG_UDP_SERV_FAIL, - NFS_MSG_REG_NLMCBK_FAIL, - NFS_MSG_TCP_SERV_FAIL, - NFS_MSG_SVC_RUN_RETURNED, - NFS_MSG_XLATOR_SET_FAIL, - NFS_MSG_SVC_ERROR, - NFS_MSG_GET_FH_FAIL, - NFS_MSG_FIND_FIRST_MATCH_FAIL, - NFS_MSG_NETGRP_NOT_FOUND, - NFS_MSG_FILE_OP_FAILED, - NFS_MSG_PATH_RESOLVE_FAIL, - NFS_MSG_LOC_FILL_RESOLVE_FAIL, - NFS_MSG_INODE_NOT_FOUND, - NFS_MSG_INODE_CTX_STORE_FAIL, - NFS_MSG_GETPWUID_FAIL, - NFS_MSG_MAP_GRP_LIST_FAIL, - NFS_MSG_PARSE_DIR_FAIL, - NFS_MSG_LOOKUP_FAIL, - NFS_MSG_STAT_ERROR, - NFS_MSG_GFID_DICT_CREATE_FAIL, - NFS_MSG_HASH_XLATOR_FAIL, - NFS_MSG_ENABLE_THROTTLE_FAIL -); +GLFS_MSGID( + NFS, NFS_MSG_UNUSED_1, NFS_MSG_UNUSED_2, NFS_MSG_INVALID_ENTRY, + NFS_MSG_INODE_LOC_FILL_ERROR, NFS_MSG_HARD_RESOLVE_FAIL, + NFS_MSG_ARGS_DECODE_ERROR, NFS_MSG_LOOKUP_PROC_FAIL, NFS_MSG_UNUSED_8, + NFS_MSG_UNUSED_9, NFS_MSG_READLINK_PROC_FAIL, NFS_MSG_UNUSED_11, + NFS_MSG_ANONYMOUS_FD_FAIL, NFS_MSG_READ_FAIL, NFS_MSG_UNUSED_14, + NFS_MSG_UNUSED_15, NFS_MSG_STATE_WRONG, NFS_MSG_WRITE_FAIL, + NFS_MSG_UNUSED_18, NFS_MSG_UNUSED_19, NFS_MSG_UNUSED_20, + NFS_MSG_CREATE_FAIL, NFS_MSG_UNUSED_22, NFS_MSG_UNUSED_23, + NFS_MSG_DIR_OP_FAIL, NFS_MSG_UNUSED_25, NFS_MSG_SYMLINK_FAIL, + NFS_MSG_UNUSED_27, NFS_MSG_MKNOD_FAIL, NFS_MSG_OPT_INIT_FAIL, + NFS_MSG_UNUSED_30, NFS_MSG_REMOVE_FAIL, NFS_MSG_RMDIR_CBK, + NFS_MSG_UNUSED_33, NFS_MSG_RENAME_FAIL, NFS_MSG_UNUSED_35, + NFS_MSG_LINK_FAIL, NFS_MSG_UNUSED_37, NFS_MSG_UNUSED_38, + NFS_MSG_READDIR_FAIL, NFS_MSG_READDIRP_FAIL, NFS_MSG_UNUSED_41, + NFS_MSG_UNUSED_42, NFS_MSG_FSTAT_FAIL, NFS_MSG_UNUSED_44, + NFS_MSG_FSINFO_FAIL, NFS_MSG_UNUSED_46, NFS_MSG_PATHCONF_FAIL, + NFS_MSG_UNUSED_48, NFS_MSG_COMMIT_FAIL, NFS_MSG_PROT_INIT_ADD_FAIL, + NFS_MSG_FORMAT_FAIL, NFS_MSG_SNPRINTF_FAIL, NFS_MSG_VOLID_MISSING, + NFS_MSG_PARSE_VOL_UUID_FAIL, NFS_MSG_STR2BOOL_FAIL, + NFS_MSG_SUBVOL_INIT_FAIL, NFS_MSG_NO_MEMORY, NFS_MSG_LISTENERS_CREATE_FAIL, + NFS_MSG_STATE_INIT_FAIL, NFS_MSG_RECONF_FAIL, NFS_MSG_RECONF_SUBVOL_FAIL, + NFS_MSG_STR_TOO_LONG, NFS_MSG_STATE_MISSING, NFS_MSG_INDEX_NOT_FOUND, + NFS_MSG_EXPORT_ID_FAIL, NFS_MSG_NO_RW_ACCESS, NFS_MSG_BAD_HANDLE, + NFS_MSG_RESOLVE_FH_FAIL, NFS_MSG_RESOLVE_STAT, NFS_MSG_VOL_DISABLE, + NFS_MSG_INIT_CALL_STAT_FAIL, NFS_MSG_ENCODE_FAIL, + NFS_MSG_SERIALIZE_REPLY_FAIL, NFS_MSG_SUBMIT_REPLY_FAIL, NFS_MSG_UNUSED_75, + NFS_MSG_UNUSED_76, NFS_MSG_STAT_FOP_FAIL, NFS_MSG_GETATTR_FAIL, + NFS_MSG_UNUSED_79, NFS_MSG_UNUSED_80, NFS_MSG_TIMESTAMP_NO_SYNC, + NFS_MSG_SETATTR_INVALID, NFS_MSG_SETATTR_FAIL, NFS_MSG_UNUSED_84, + NFS_MSG_ACCESS_PROC_FAIL, NFS_MSG_PGM_NOT_FOUND, NFS_MSG_PGM_INIT_FAIL, + NFS_MSG_PGM_REG_FAIL, NFS_MSG_LOOKUP_ROOT_FAIL, NFS_MSG_ROOT_LOC_INIT_FAIL, + NFS_MSG_STARTUP_FAIL, NFS_MSG_XLATOR_INIT_FAIL, NFS_MSG_NFS_MAN_DISABLE, + NFS_MSG_DICT_GET_FAILED, NFS_MSG_PARSE_FAIL, NFS_MSG_NLM_MAN_DISABLE, + NFS_MSG_ACL_MAN_DISABLE, NFS_MSG_DICT_SET_FAILED, + NFS_MSG_INIT_GRP_CACHE_FAIL, NFS_MSG_NO_PERM, NFS_MSG_REG_FILE_ERROR, + NFS_MSG_RPC_INIT_FAIL, NFS_MSG_RPC_CONFIG_FAIL, NFS_MSG_RECONFIG_PATH, + NFS_MSG_RECONFIG_VALUE, NFS_MSG_RECONFIG_VOL, NFS_MSG_NLM_INFO, + NFS_MSG_ACL_INFO, NFS_MSG_INIT_FAIL, NFS_MSG_STARTED, NFS_MSG_VOL_NOT_FOUND, + NFS_MSG_RECONFIG_ENABLE, NFS_MSG_RECONFIG_FAIL, NFS_MSG_MNT_STATE_NOT_FOUND, + NFS_MSG_ENCODE_MSG_FAIL, NFS_MSG_REP_SUBMIT_FAIL, NFS_MSG_READ_LOCKED, + NFS_MSG_MODIFY_LOCKED, NFS_MSG_RWTAB_OVERWRITE_FAIL, NFS_MSG_UPDATE_FAIL, + NFS_MSG_OPEN_FAIL, NFS_MSG_LOCK_FAIL, NFS_MSG_REWRITE_ERROR, + NFS_MSG_HASH_PATH_FAIL, NFS_MSG_LOOKUP_MNT_ERROR, + NFS_MSG_GET_ROOT_INODE_FAIL, NFS_MSG_RESOLVE_INODE_FAIL, + NFS_MSG_RESOLVE_SUBDIR_FAIL, NFS_MSG_RESOLVE_SYMLINK_ERROR, + NFS_MSG_RESOLVE_ERROR, NFS_MSG_UNSUPPORTED_VERSION, + NFS_MSG_AUTH_VERIFY_FAILED, NFS_MSG_PEER_NOT_ALLOWED, + NFS_MSG_GET_PEER_ADDR_FAIL, NFS_MSG_BAD_PEER, NFS_MSG_PEER_TOO_LONG, + NFS_MSG_CALLER_NOT_FOUND, NFS_MSG_GET_REMOTE_NAME_FAIL, + NFS_MSG_UNKNOWN_MNT_TYPE, NFS_MSG_PARSE_HOSTSPEC_FAIL, + NFS_MSG_PARSE_AUTH_PARAM_FAIL, NFS_MSG_SET_EXP_FAIL, + NFS_MSG_INIT_DIR_EXP_FAIL, NFS_MSG_DIR_EXP_SETUP_FAIL, + NFS_MSG_VOL_INIT_FAIL, NFS_MSG_AUTH_ERROR, NFS_MSG_UPDATING_EXP, + NFS_MSG_SET_EXP_AUTH_PARAM_FAIL, NFS_MSG_UPDATING_NET_GRP, + NFS_MSG_SET_NET_GRP_FAIL, NFS_MSG_PURGING_AUTH_CACHE, + NFS_MSG_MNT_STATE_INIT_FAIL, NFS_MSG_EXP_AUTH_DISABLED, + NFS_MSG_FH_TO_VOL_FAIL, NFS_MSG_INODE_SHARES_NOT_FOUND, + NFS_MSG_VOLUME_ERROR, NFS_MSG_GET_USER_ACL_FAIL, NFS_MSG_GET_DEF_ACL_FAIL, + NFS_MSG_SET_USER_ACL_FAIL, NFS_MSG_SET_DEF_ACL_FAIL, NFS_MSG_ACL_INIT_FAIL, + NFS_MSG_LOAD_PARSE_ERROR, NFS_MSG_CLNT_CALL_ERROR, + NFS_MSG_CLNT_CREATE_ERROR, NFS_MSG_NLM_GRACE_PERIOD, NFS_MSG_RPC_CLNT_ERROR, + NFS_MSG_GET_PORT_ERROR, NFS_MSG_NLMCLNT_NOT_FOUND, NFS_MSG_FD_LOOKUP_NULL, + NFS_MSG_SM_NOTIFY, NFS_MSG_NLM_INIT_FAIL, NFS_MSG_START_ERROR, + NFS_MSG_UNLINK_ERROR, NFS_MSG_SHARE_LIST_STORE_FAIL, + NFS_MSG_CLIENT_NOT_FOUND, NFS_MSG_SHARE_CALL_FAIL, + NFS_MSG_UNSHARE_CALL_FAIL, NFS_MSG_GET_PID_FAIL, NFS_MSG_ARG_FREE_FAIL, + NFS_MSG_PMAP_UNSET_FAIL, NFS_MSG_UDP_SERV_FAIL, NFS_MSG_REG_NLMCBK_FAIL, + NFS_MSG_TCP_SERV_FAIL, NFS_MSG_SVC_RUN_RETURNED, NFS_MSG_XLATOR_SET_FAIL, + NFS_MSG_SVC_ERROR, NFS_MSG_GET_FH_FAIL, NFS_MSG_FIND_FIRST_MATCH_FAIL, + NFS_MSG_NETGRP_NOT_FOUND, NFS_MSG_FILE_OP_FAILED, NFS_MSG_PATH_RESOLVE_FAIL, + NFS_MSG_LOC_FILL_RESOLVE_FAIL, NFS_MSG_INODE_NOT_FOUND, + NFS_MSG_INODE_CTX_STORE_FAIL, NFS_MSG_GETPWUID_FAIL, + NFS_MSG_MAP_GRP_LIST_FAIL, NFS_MSG_PARSE_DIR_FAIL, NFS_MSG_LOOKUP_FAIL, + NFS_MSG_STAT_ERROR, NFS_MSG_GFID_DICT_CREATE_FAIL, NFS_MSG_HASH_XLATOR_FAIL, + NFS_MSG_ENABLE_THROTTLE_FAIL); #endif /* _NFS_MESSAGES_H_ */ - diff --git a/xlators/nfs/server/src/nfs.h b/xlators/nfs/server/src/nfs.h index 33ba419a573..531a269071c 100644 --- a/xlators/nfs/server/src/nfs.h +++ b/xlators/nfs/server/src/nfs.h @@ -17,135 +17,138 @@ #include "lkowner.h" #include "gidcache.h" -#define GF_NFS "nfs" +#define GF_NFS "nfs" -#define GF_NFS_CONCURRENT_OPS_MULT 15 +#define GF_NFS_CONCURRENT_OPS_MULT 15 -#define GF_NFS_INODE_LRU_MULT 6000 +#define GF_NFS_INODE_LRU_MULT 6000 -#define GF_RPC_MIN_THREADS 1 -#define GF_RPC_MAX_THREADS 16 +#define GF_RPC_MIN_THREADS 1 +#define GF_RPC_MAX_THREADS 16 -#define GF_NFS_DEFAULT_MEMFACTOR 15 -#define GF_NFS_MIN_MEMFACTOR 1 -#define GF_NFS_MAX_MEMFACTOR 30 +#define GF_NFS_DEFAULT_MEMFACTOR 15 +#define GF_NFS_MIN_MEMFACTOR 1 +#define GF_NFS_MAX_MEMFACTOR 30 -#define GF_NFS_DVM_ON 1 -#define GF_NFS_DVM_OFF 0 +#define GF_NFS_DVM_ON 1 +#define GF_NFS_DVM_OFF 0 /* Disable using the exports file by default */ -#define GF_NFS_DEFAULT_EXPORT_AUTH 0 +#define GF_NFS_DEFAULT_EXPORT_AUTH 0 -#define GF_NFS_DEFAULT_AUTH_REFRESH_INTERVAL_SEC 2 -#define GF_NFS_DEFAULT_AUTH_CACHE_TTL_SEC 300 /* 5 min */ +#define GF_NFS_DEFAULT_AUTH_REFRESH_INTERVAL_SEC 2 +#define GF_NFS_DEFAULT_AUTH_CACHE_TTL_SEC 300 /* 5 min */ /* This corresponds to the max 16 number of group IDs that are sent through an * RPC request. Since NFS is the only one going to set this, we can be safe * in keeping this size hardcoded. */ -#define GF_REQUEST_MAXGROUPS 16 +#define GF_REQUEST_MAXGROUPS 16 /* Callback into a version-specific NFS protocol. * The return type is used by the nfs.c code to register the protocol. * with the RPC service. */ -typedef rpcsvc_program_t *(*nfs_version_initer_t) (xlator_t *nfsx); +typedef rpcsvc_program_t *(*nfs_version_initer_t)(xlator_t *nfsx); /* List of version-specific protocol initiators */ struct nfs_initer_list { - struct list_head list; - nfs_version_initer_t init; - rpcsvc_program_t *program; - gf_boolean_t required; + struct list_head list; + nfs_version_initer_t init; + rpcsvc_program_t *program; + gf_boolean_t required; }; struct nfs_state { - rpcsvc_t *rpcsvc; - struct list_head versions; - struct mount3_state *mstate; - struct nfs3_state *nfs3state; - struct nlm4_state *nlm4state; - struct mem_pool *foppool; - unsigned int memfactor; - xlator_list_t *subvols; - - gf_lock_t svinitlock; - int allsubvols; - int upsubvols; - xlator_t **initedxl; - int subvols_started; - int dynamicvolumes; - int enable_ino32; - unsigned int override_portnum; - int allow_insecure; - int enable_nlm; - int enable_acl; - int mount_udp; - - /* Enable exports auth model */ - int exports_auth; - /* Refresh auth params from disk periodically */ - int refresh_auth; - - unsigned int auth_refresh_time_secs; - unsigned int auth_cache_ttl_sec; - - char *rmtab; - struct rpc_clnt *rpc_clnt; - gf_boolean_t server_aux_gids; - uint32_t server_aux_gids_max_age; - gid_cache_t gid_cache; - uint32_t generation; - gf_boolean_t register_portmap; - char *rpc_statd; - char *rpc_statd_pid_file; - gf_boolean_t rdirplus; - uint32_t event_threads; + rpcsvc_t *rpcsvc; + struct list_head versions; + struct mount3_state *mstate; + struct nfs3_state *nfs3state; + struct nlm4_state *nlm4state; + struct mem_pool *foppool; + unsigned int memfactor; + xlator_list_t *subvols; + + gf_lock_t svinitlock; + int allsubvols; + int upsubvols; + xlator_t **initedxl; + int subvols_started; + int dynamicvolumes; + int enable_ino32; + unsigned int override_portnum; + int allow_insecure; + int enable_nlm; + int enable_acl; + int mount_udp; + + /* Enable exports auth model */ + int exports_auth; + /* Refresh auth params from disk periodically */ + int refresh_auth; + + unsigned int auth_refresh_time_secs; + unsigned int auth_cache_ttl_sec; + + char *rmtab; + struct rpc_clnt *rpc_clnt; + gf_boolean_t server_aux_gids; + uint32_t server_aux_gids_max_age; + gid_cache_t gid_cache; + uint32_t generation; + gf_boolean_t register_portmap; + char *rpc_statd; + char *rpc_statd_pid_file; + gf_boolean_t rdirplus; + uint32_t event_threads; }; struct nfs_inode_ctx { - struct list_head shares; - uint32_t generation; + struct list_head shares; + uint32_t generation; }; -#define gf_nfs_dvm_on(nfsstt) (((struct nfs_state *)nfsstt)->dynamicvolumes == GF_NFS_DVM_ON) -#define gf_nfs_dvm_off(nfsstt) (((struct nfs_state *)nfsstt)->dynamicvolumes == GF_NFS_DVM_OFF) -#define __gf_nfs_enable_ino32(nfsstt) (((struct nfs_state *)nfsstt)->enable_ino32) -#define gf_nfs_this_private ((struct nfs_state *)((xlator_t *)THIS)->private) -#define gf_nfs_enable_ino32() (__gf_nfs_enable_ino32(gf_nfs_this_private)) +#define gf_nfs_dvm_on(nfsstt) \ + (((struct nfs_state *)nfsstt)->dynamicvolumes == GF_NFS_DVM_ON) +#define gf_nfs_dvm_off(nfsstt) \ + (((struct nfs_state *)nfsstt)->dynamicvolumes == GF_NFS_DVM_OFF) +#define __gf_nfs_enable_ino32(nfsstt) \ + (((struct nfs_state *)nfsstt)->enable_ino32) +#define gf_nfs_this_private ((struct nfs_state *)((xlator_t *)THIS)->private) +#define gf_nfs_enable_ino32() (__gf_nfs_enable_ino32(gf_nfs_this_private)) /* We have one gid more than the glusterfs maximum since we pass the primary * gid as the first element of the array. */ -#define NFS_NGROUPS (GF_REQUEST_MAXGROUPS + 1) +#define NFS_NGROUPS (GF_REQUEST_MAXGROUPS + 1) /* Index of the primary gid */ -#define NFS_PRIMGID_IDX 0 +#define NFS_PRIMGID_IDX 0 typedef struct nfs_user_info { - uid_t uid; - gid_t gids[NFS_NGROUPS]; - int ngrps; - gf_lkowner_t lk_owner; - char identifier[UNIX_PATH_MAX]; /* ip of user */ + uid_t uid; + gid_t gids[NFS_NGROUPS]; + int ngrps; + gf_lkowner_t lk_owner; + char identifier[UNIX_PATH_MAX]; /* ip of user */ } nfs_user_t; extern int -nfs_user_root_create (nfs_user_t *newnfu); +nfs_user_root_create(nfs_user_t *newnfu); extern int -nfs_user_create (nfs_user_t *newnfu, uid_t uid, gid_t gid, - rpc_transport_t *trans, gid_t *auxgids, int auxcount); +nfs_user_create(nfs_user_t *newnfu, uid_t uid, gid_t gid, + rpc_transport_t *trans, gid_t *auxgids, int auxcount); extern void -nfs_request_user_init (nfs_user_t *nfu, rpcsvc_request_t *req); +nfs_request_user_init(nfs_user_t *nfu, rpcsvc_request_t *req); extern void -nfs_request_primary_user_init (nfs_user_t *nfu, rpcsvc_request_t *req, - uid_t uid, gid_t gid); +nfs_request_primary_user_init(nfs_user_t *nfu, rpcsvc_request_t *req, uid_t uid, + gid_t gid); extern int -nfs_subvolume_started (struct nfs_state *nfs, xlator_t *xl); +nfs_subvolume_started(struct nfs_state *nfs, xlator_t *xl); extern void -nfs_fix_groups (xlator_t *this, call_stack_t *root); +nfs_fix_groups(xlator_t *this, call_stack_t *root); #endif diff --git a/xlators/nfs/server/src/nfs3-fh.h b/xlators/nfs/server/src/nfs3-fh.h index 3af36cc98b0..442f6feeb25 100644 --- a/xlators/nfs/server/src/nfs3-fh.h +++ b/xlators/nfs/server/src/nfs3-fh.h @@ -19,82 +19,83 @@ /* BIG FAT WARNING: The file handle code is tightly coupled to NFSv3 file * handles for now. This will change if and when we need v4. */ -#define GF_NFSFH_IDENT0 ':' -#define GF_NFSFH_IDENT1 'O' -#define GF_NFSFH_IDENT2 'G' -#define GF_NFSFH_IDENT3 'L' -#define GF_NFSFH_IDENT_SIZE (sizeof(char) * 4) -#define GF_NFSFH_STATIC_SIZE (GF_NFSFH_IDENT_SIZE + (3*sizeof (uuid_t))) - -#define nfs3_fh_exportid_to_index(exprtid) ((uint16_t)exprtid[15]) +#define GF_NFSFH_IDENT0 ':' +#define GF_NFSFH_IDENT1 'O' +#define GF_NFSFH_IDENT2 'G' +#define GF_NFSFH_IDENT3 'L' +#define GF_NFSFH_IDENT_SIZE (sizeof(char) * 4) +#define GF_NFSFH_STATIC_SIZE (GF_NFSFH_IDENT_SIZE + (3 * sizeof(uuid_t))) + +#define nfs3_fh_exportid_to_index(exprtid) ((uint16_t)exprtid[15]) /* ATTENTION: Change in size of the structure below should be reflected in the * GF_NFSFH_STATIC_SIZE. */ struct nfs3_fh { - - /* Used to ensure that a bunch of bytes are actually a GlusterFS NFS - * file handle. Should contain ":OGL" - */ - char ident[4]; - - /* UUID that identifies an export. The value stored in exportid - * depends on the usage of gluster nfs. If the DVM is enabled using - * the nfs.dynamic-volumes option then exportid will contain the UUID - * of the volume so that gnfs is able to identify volumes uniquely - * through volume additions,deletions,migrations, etc. - * - * When not using dvm, exportid contains the index of the volume - * based on the position of the volume in the list of subvolumes - * for gnfs. - */ - uuid_t exportid; - - /* File/dir gfid. */ - uuid_t gfid; - uuid_t mountid; - /* This structure must be exactly NFS3_FHSIZE (64) bytes long. - Having the structure shorter results in buffer overflows - during XDR decoding. - */ - unsigned char padding[NFS3_FHSIZE - GF_NFSFH_STATIC_SIZE]; + /* Used to ensure that a bunch of bytes are actually a GlusterFS NFS + * file handle. Should contain ":OGL" + */ + char ident[4]; + + /* UUID that identifies an export. The value stored in exportid + * depends on the usage of gluster nfs. If the DVM is enabled using + * the nfs.dynamic-volumes option then exportid will contain the UUID + * of the volume so that gnfs is able to identify volumes uniquely + * through volume additions,deletions,migrations, etc. + * + * When not using dvm, exportid contains the index of the volume + * based on the position of the volume in the list of subvolumes + * for gnfs. + */ + uuid_t exportid; + + /* File/dir gfid. */ + uuid_t gfid; + uuid_t mountid; + /* This structure must be exactly NFS3_FHSIZE (64) bytes long. + Having the structure shorter results in buffer overflows + during XDR decoding. + */ + unsigned char padding[NFS3_FHSIZE - GF_NFSFH_STATIC_SIZE]; } __attribute__((__packed__)); -#define GF_NFS3FH_STATIC_INITIALIZER {{0},} +#define GF_NFS3FH_STATIC_INITIALIZER \ + { \ + {0}, \ + } extern uint32_t -nfs3_fh_compute_size (); +nfs3_fh_compute_size(); extern uint16_t -nfs3_fh_hash_entry (uuid_t gfid); +nfs3_fh_hash_entry(uuid_t gfid); extern int -nfs3_fh_validate (struct nfs3_fh *fh); +nfs3_fh_validate(struct nfs3_fh *fh); extern struct nfs3_fh -nfs3_fh_build_indexed_root_fh (xlator_list_t *cl, xlator_t *xl); +nfs3_fh_build_indexed_root_fh(xlator_list_t *cl, xlator_t *xl); extern int -nfs3_fh_is_root_fh (struct nfs3_fh *fh); +nfs3_fh_is_root_fh(struct nfs3_fh *fh); extern int -nfs3_fh_build_child_fh (struct nfs3_fh *parent, struct iatt *newstat, - struct nfs3_fh *newfh); +nfs3_fh_build_child_fh(struct nfs3_fh *parent, struct iatt *newstat, + struct nfs3_fh *newfh); extern void -nfs3_log_fh (struct nfs3_fh *fh); +nfs3_log_fh(struct nfs3_fh *fh); extern void -nfs3_fh_to_str (struct nfs3_fh *fh, char *str, size_t len); +nfs3_fh_to_str(struct nfs3_fh *fh, char *str, size_t len); extern int -nfs3_fh_build_parent_fh (struct nfs3_fh *child, struct iatt *newstat, - struct nfs3_fh *newfh); +nfs3_fh_build_parent_fh(struct nfs3_fh *child, struct iatt *newstat, + struct nfs3_fh *newfh); extern struct nfs3_fh -nfs3_fh_build_uuid_root_fh (uuid_t volumeid, uuid_t mountid); +nfs3_fh_build_uuid_root_fh(uuid_t volumeid, uuid_t mountid); extern int -nfs3_build_fh (inode_t *inode, uuid_t exportid, - struct nfs3_fh *newfh); +nfs3_build_fh(inode_t *inode, uuid_t exportid, struct nfs3_fh *newfh); #endif diff --git a/xlators/nfs/server/src/nfs3-helpers.h b/xlators/nfs/server/src/nfs3-helpers.h index 213639e3806..7c70c20b787 100644 --- a/xlators/nfs/server/src/nfs3-helpers.h +++ b/xlators/nfs/server/src/nfs3-helpers.h @@ -19,41 +19,40 @@ #include <sys/statvfs.h> -#define GF_NFS3_FD_CACHED 0xcaced +#define GF_NFS3_FD_CACHED 0xcaced extern struct nfs3_fh -nfs3_extract_lookup_fh (lookup3args *args); +nfs3_extract_lookup_fh(lookup3args *args); extern char * -nfs3_extract_lookup_name (lookup3args *args); +nfs3_extract_lookup_name(lookup3args *args); extern nfsstat3 -nfs3_errno_to_nfsstat3 (int errnum); +nfs3_errno_to_nfsstat3(int errnum); -extern nfsstat3 -nfs3_cbk_errno_status (int32_t, int32_t); +extern nfsstat3 nfs3_cbk_errno_status(int32_t, int32_t); extern void -nfs3_fill_lookup3res (lookup3res *res, nfsstat3 stat, struct nfs3_fh *newfh, - struct iatt *stbuf, struct iatt *postparent, - uint64_t deviceid); +nfs3_fill_lookup3res(lookup3res *res, nfsstat3 stat, struct nfs3_fh *newfh, + struct iatt *stbuf, struct iatt *postparent, + uint64_t deviceid); extern post_op_attr -nfs3_stat_to_post_op_attr (struct iatt *buf); +nfs3_stat_to_post_op_attr(struct iatt *buf); extern struct nfs3_fh -nfs3_extract_getattr_fh (getattr3args *args); +nfs3_extract_getattr_fh(getattr3args *args); extern void -nfs3_fill_getattr3res (getattr3res *res, nfsstat3 stat, struct iatt *buf, - uint64_t deviceid); +nfs3_fill_getattr3res(getattr3res *res, nfsstat3 stat, struct iatt *buf, + uint64_t deviceid); extern struct nfs3_fh -nfs3_extract_fsinfo_fh (fsinfo3args *args); +nfs3_extract_fsinfo_fh(fsinfo3args *args); extern void -nfs3_fill_fsinfo3res (struct nfs3_state *nfs3, fsinfo3res *res, - nfsstat3 status, struct iatt *fsroot,uint64_t deviceid); +nfs3_fill_fsinfo3res(struct nfs3_state *nfs3, fsinfo3res *res, nfsstat3 status, + struct iatt *fsroot, uint64_t deviceid); /* Functions containing _prep_ are used specifically to work around * the memory allocations that happen inside Sun RPC library. @@ -73,271 +72,268 @@ nfs3_fill_fsinfo3res (struct nfs3_state *nfs3, fsinfo3res *res, * looking through the glibc/sunrpc sources. */ extern void -nfs3_prep_lookup3args (lookup3args *args, struct nfs3_fh *fh, char *name); +nfs3_prep_lookup3args(lookup3args *args, struct nfs3_fh *fh, char *name); extern void -nfs3_prep_getattr3args (getattr3args *args, struct nfs3_fh *fh); +nfs3_prep_getattr3args(getattr3args *args, struct nfs3_fh *fh); extern void -nfs3_prep_fsinfo3args (fsinfo3args *args, struct nfs3_fh *root); +nfs3_prep_fsinfo3args(fsinfo3args *args, struct nfs3_fh *root); extern char * nfsstat3_strerror(int stat); extern void -nfs3_prep_access3args (access3args *args, struct nfs3_fh *fh); +nfs3_prep_access3args(access3args *args, struct nfs3_fh *fh); extern void -nfs3_fill_access3res (access3res *res, nfsstat3 status, int32_t accbits, - int32_t reqaccbits); +nfs3_fill_access3res(access3res *res, nfsstat3 status, int32_t accbits, + int32_t reqaccbits); extern char * -nfs3_fhcache_getpath (struct nfs3_state *nfs3, struct nfs3_fh *fh); +nfs3_fhcache_getpath(struct nfs3_state *nfs3, struct nfs3_fh *fh); extern int -nfs3_fhcache_putpath (struct nfs3_state *nfs3, struct nfs3_fh *fh, char *path); +nfs3_fhcache_putpath(struct nfs3_state *nfs3, struct nfs3_fh *fh, char *path); extern void -nfs3_prep_readdir3args (readdir3args *ra, struct nfs3_fh *fh); +nfs3_prep_readdir3args(readdir3args *ra, struct nfs3_fh *fh); extern void -nfs3_fill_readdir3res (readdir3res *res, nfsstat3 stat, struct nfs3_fh *dfh, - uint64_t cverf, struct iatt *dirstat, - gf_dirent_t *entries, count3 count, int is_eof, - uint64_t deviceid); +nfs3_fill_readdir3res(readdir3res *res, nfsstat3 stat, struct nfs3_fh *dfh, + uint64_t cverf, struct iatt *dirstat, + gf_dirent_t *entries, count3 count, int is_eof, + uint64_t deviceid); extern void -nfs3_prep_readdirp3args (readdirp3args *ra, struct nfs3_fh *fh); +nfs3_prep_readdirp3args(readdirp3args *ra, struct nfs3_fh *fh); extern void -nfs3_fill_readdirp3res (readdirp3res *res, nfsstat3 stat, - struct nfs3_fh *dirfh, uint64_t cverf, - struct iatt *dirstat, gf_dirent_t *entries, - count3 dircount, count3 maxcount, int is_eof, - uint64_t deviceid); +nfs3_fill_readdirp3res(readdirp3res *res, nfsstat3 stat, struct nfs3_fh *dirfh, + uint64_t cverf, struct iatt *dirstat, + gf_dirent_t *entries, count3 dircount, count3 maxcount, + int is_eof, uint64_t deviceid); extern void -nfs3_free_readdirp3res (readdirp3res *res); +nfs3_free_readdirp3res(readdirp3res *res); extern void -nfs3_free_readdir3res (readdir3res *res); +nfs3_free_readdir3res(readdir3res *res); extern void -nfs3_prep_fsstat3args (fsstat3args *args, struct nfs3_fh *fh); +nfs3_prep_fsstat3args(fsstat3args *args, struct nfs3_fh *fh); extern void -nfs3_fill_fsstat3res (fsstat3res *res, nfsstat3 stat, struct statvfs *fsbuf, - struct iatt *postbuf, uint64_t deviceid); +nfs3_fill_fsstat3res(fsstat3res *res, nfsstat3 stat, struct statvfs *fsbuf, + struct iatt *postbuf, uint64_t deviceid); extern int32_t -nfs3_sattr3_to_setattr_valid (sattr3 *sattr, struct iatt *buf, mode_t *omode); +nfs3_sattr3_to_setattr_valid(sattr3 *sattr, struct iatt *buf, mode_t *omode); extern void -nfs3_fill_create3res (create3res *res, nfsstat3 stat, struct nfs3_fh *newfh, - struct iatt *newbuf, struct iatt *preparent, - struct iatt *postparent, uint64_t deviceid); +nfs3_fill_create3res(create3res *res, nfsstat3 stat, struct nfs3_fh *newfh, + struct iatt *newbuf, struct iatt *preparent, + struct iatt *postparent, uint64_t deviceid); extern void -nfs3_prep_create3args (create3args *args, struct nfs3_fh *fh, char *name); +nfs3_prep_create3args(create3args *args, struct nfs3_fh *fh, char *name); extern void -nfs3_prep_setattr3args (setattr3args *args, struct nfs3_fh *fh); +nfs3_prep_setattr3args(setattr3args *args, struct nfs3_fh *fh); extern void -nfs3_fill_setattr3res (setattr3res *res, nfsstat3 stat, struct iatt *preop, - struct iatt *postop, uint64_t deviceid); +nfs3_fill_setattr3res(setattr3res *res, nfsstat3 stat, struct iatt *preop, + struct iatt *postop, uint64_t deviceid); extern void -nfs3_prep_mkdir3args (mkdir3args *args, struct nfs3_fh *dirfh, char *name); +nfs3_prep_mkdir3args(mkdir3args *args, struct nfs3_fh *dirfh, char *name); extern void -nfs3_fill_mkdir3res (mkdir3res *res, nfsstat3 stat, struct nfs3_fh *fh, - struct iatt *buf, struct iatt *preparent, - struct iatt *postparent, uint64_t deviceid); +nfs3_fill_mkdir3res(mkdir3res *res, nfsstat3 stat, struct nfs3_fh *fh, + struct iatt *buf, struct iatt *preparent, + struct iatt *postparent, uint64_t deviceid); extern void -nfs3_prep_symlink3args (symlink3args *args, struct nfs3_fh *dirfh, char *name, - char *target); +nfs3_prep_symlink3args(symlink3args *args, struct nfs3_fh *dirfh, char *name, + char *target); extern void -nfs3_fill_symlink3res (symlink3res *res, nfsstat3 stat, struct nfs3_fh *fh, - struct iatt *buf, struct iatt *preparent, - struct iatt *postparent, uint64_t deviceid); +nfs3_fill_symlink3res(symlink3res *res, nfsstat3 stat, struct nfs3_fh *fh, + struct iatt *buf, struct iatt *preparent, + struct iatt *postparent, uint64_t deviceid); extern void -nfs3_prep_readlink3args (readlink3args *args, struct nfs3_fh *fh); +nfs3_prep_readlink3args(readlink3args *args, struct nfs3_fh *fh); extern void -nfs3_fill_readlink3res (readlink3res *res, nfsstat3 stat, char *path, - struct iatt *buf, uint64_t deviceid); +nfs3_fill_readlink3res(readlink3res *res, nfsstat3 stat, char *path, + struct iatt *buf, uint64_t deviceid); extern void -nfs3_prep_mknod3args (mknod3args *args, struct nfs3_fh *fh, char *name); +nfs3_prep_mknod3args(mknod3args *args, struct nfs3_fh *fh, char *name); extern void -nfs3_fill_mknod3res (mknod3res *res, nfsstat3 stat, struct nfs3_fh *fh, - struct iatt *buf, struct iatt *preparent, - struct iatt *postparent, uint64_t deviceid); +nfs3_fill_mknod3res(mknod3res *res, nfsstat3 stat, struct nfs3_fh *fh, + struct iatt *buf, struct iatt *preparent, + struct iatt *postparent, uint64_t deviceid); extern void -nfs3_fill_remove3res (remove3res *res, nfsstat3 stat, struct iatt *preparent, - struct iatt *postparent, uint64_t deviceid); +nfs3_fill_remove3res(remove3res *res, nfsstat3 stat, struct iatt *preparent, + struct iatt *postparent, uint64_t deviceid); extern void -nfs3_prep_remove3args (remove3args *args, struct nfs3_fh *fh, char *name); +nfs3_prep_remove3args(remove3args *args, struct nfs3_fh *fh, char *name); extern void -nfs3_fill_rmdir3res (rmdir3res *res, nfsstat3 stat, struct iatt *preparent, - struct iatt *postparent, uint64_t deviceid); +nfs3_fill_rmdir3res(rmdir3res *res, nfsstat3 stat, struct iatt *preparent, + struct iatt *postparent, uint64_t deviceid); extern void -nfs3_prep_rmdir3args (rmdir3args *args, struct nfs3_fh *fh, char *name); +nfs3_prep_rmdir3args(rmdir3args *args, struct nfs3_fh *fh, char *name); extern void -nfs3_fill_link3res (link3res *res, nfsstat3 stat, struct iatt *buf, - struct iatt *preparent, struct iatt *postparent, - uint64_t deviceid); +nfs3_fill_link3res(link3res *res, nfsstat3 stat, struct iatt *buf, + struct iatt *preparent, struct iatt *postparent, + uint64_t deviceid); extern void -nfs3_prep_link3args (link3args *args, struct nfs3_fh *target, - struct nfs3_fh * dirfh, char *name); +nfs3_prep_link3args(link3args *args, struct nfs3_fh *target, + struct nfs3_fh *dirfh, char *name); extern void -nfs3_prep_rename3args (rename3args *args, struct nfs3_fh *olddirfh, - char *oldname, struct nfs3_fh *newdirfh, - char *newname); +nfs3_prep_rename3args(rename3args *args, struct nfs3_fh *olddirfh, + char *oldname, struct nfs3_fh *newdirfh, char *newname); extern void -nfs3_fill_rename3res (rename3res *res, nfsstat3 stat, struct iatt *buf, - struct iatt *preoldparent, struct iatt *postoldparent, - struct iatt *prenewparent, struct iatt *postnewparent, - uint64_t deviceid); +nfs3_fill_rename3res(rename3res *res, nfsstat3 stat, struct iatt *buf, + struct iatt *preoldparent, struct iatt *postoldparent, + struct iatt *prenewparent, struct iatt *postnewparent, + uint64_t deviceid); extern void -nfs3_prep_write3args (write3args *args, struct nfs3_fh *fh); +nfs3_prep_write3args(write3args *args, struct nfs3_fh *fh); extern void -nfs3_fill_write3res (write3res *res, nfsstat3 stat, count3 count, - stable_how stable, uint64_t wverf, struct iatt *prestat, - struct iatt *poststat, uint64_t deviceid); +nfs3_fill_write3res(write3res *res, nfsstat3 stat, count3 count, + stable_how stable, uint64_t wverf, struct iatt *prestat, + struct iatt *poststat, uint64_t deviceid); extern void -nfs3_prep_commit3args (commit3args *args, struct nfs3_fh *fh); +nfs3_prep_commit3args(commit3args *args, struct nfs3_fh *fh); extern void -nfs3_fill_commit3res (commit3res *res, nfsstat3 stat, uint64_t wverf, - struct iatt *prestat, struct iatt *poststat, - uint64_t deviceid); +nfs3_fill_commit3res(commit3res *res, nfsstat3 stat, uint64_t wverf, + struct iatt *prestat, struct iatt *poststat, + uint64_t deviceid); extern void -nfs3_fill_read3res (read3res *res, nfsstat3 stat, count3 count, - struct iatt *poststat, int is_eof, uint64_t deviceid); +nfs3_fill_read3res(read3res *res, nfsstat3 stat, count3 count, + struct iatt *poststat, int is_eof, uint64_t deviceid); extern void -nfs3_prep_read3args (read3args *args, struct nfs3_fh *fh); +nfs3_prep_read3args(read3args *args, struct nfs3_fh *fh); extern void -nfs3_prep_pathconf3args (pathconf3args *args, struct nfs3_fh *fh); +nfs3_prep_pathconf3args(pathconf3args *args, struct nfs3_fh *fh); extern void -nfs3_fill_pathconf3res (pathconf3res *res, nfsstat3 stat, struct iatt *buf, - uint64_t deviceid); +nfs3_fill_pathconf3res(pathconf3res *res, nfsstat3 stat, struct iatt *buf, + uint64_t deviceid); extern int -nfs3_cached_inode_opened (xlator_t *nfsxl, inode_t *inode); +nfs3_cached_inode_opened(xlator_t *nfsxl, inode_t *inode); extern void -nfs3_log_common_res (uint32_t xid, int op, nfsstat3 stat, int pstat, - const char *path); +nfs3_log_common_res(uint32_t xid, int op, nfsstat3 stat, int pstat, + const char *path); extern void -nfs3_log_readlink_res (uint32_t xid, nfsstat3 stat, int pstat, - char *linkpath, const char *path); +nfs3_log_readlink_res(uint32_t xid, nfsstat3 stat, int pstat, char *linkpath, + const char *path); extern void -nfs3_log_read_res (uint32_t xid, nfsstat3 stat, int pstat, - count3 count, int is_eof, struct iovec *vec, - int32_t vcount, const char *path); +nfs3_log_read_res(uint32_t xid, nfsstat3 stat, int pstat, count3 count, + int is_eof, struct iovec *vec, int32_t vcount, + const char *path); extern void -nfs3_log_write_res (uint32_t xid, nfsstat3 stat, int pstat, count3 count, - int stable, uint64_t wverf, const char *path); +nfs3_log_write_res(uint32_t xid, nfsstat3 stat, int pstat, count3 count, + int stable, uint64_t wverf, const char *path); extern void -nfs3_log_newfh_res (uint32_t xid, int op, nfsstat3 stat, int pstat, - struct nfs3_fh *newfh, const char *path); +nfs3_log_newfh_res(uint32_t xid, int op, nfsstat3 stat, int pstat, + struct nfs3_fh *newfh, const char *path); extern void -nfs3_log_readdir_res (uint32_t xid, nfsstat3 stat, int pstat, uint64_t cverf, - count3 count, int is_eof, const char *path); +nfs3_log_readdir_res(uint32_t xid, nfsstat3 stat, int pstat, uint64_t cverf, + count3 count, int is_eof, const char *path); extern void -nfs3_log_readdirp_res (uint32_t xid, nfsstat3 stat, int pstat, uint64_t cverf, - count3 dircount, count3 maxcount, int is_eof, - const char *path); +nfs3_log_readdirp_res(uint32_t xid, nfsstat3 stat, int pstat, uint64_t cverf, + count3 dircount, count3 maxcount, int is_eof, + const char *path); extern void -nfs3_log_commit_res (uint32_t xid, nfsstat3 stat, int pstat, uint64_t wverf, - const char *path); +nfs3_log_commit_res(uint32_t xid, nfsstat3 stat, int pstat, uint64_t wverf, + const char *path); extern void -nfs3_log_common_call (uint32_t xid, char *op, struct nfs3_fh *fh); +nfs3_log_common_call(uint32_t xid, char *op, struct nfs3_fh *fh); extern void -nfs3_log_fh_entry_call (uint32_t xid, char *op, struct nfs3_fh *fh, - char *name); +nfs3_log_fh_entry_call(uint32_t xid, char *op, struct nfs3_fh *fh, char *name); extern void -nfs3_log_rw_call (uint32_t xid, char *op, struct nfs3_fh *fh, offset3 offt, - count3 count, int stablewrite); +nfs3_log_rw_call(uint32_t xid, char *op, struct nfs3_fh *fh, offset3 offt, + count3 count, int stablewrite); extern void -nfs3_log_create_call (uint32_t xid, struct nfs3_fh *fh, char *name, - createmode3 mode); +nfs3_log_create_call(uint32_t xid, struct nfs3_fh *fh, char *name, + createmode3 mode); extern void -nfs3_log_symlink_call (uint32_t xid, struct nfs3_fh *fh, char *name, char *tgt); +nfs3_log_symlink_call(uint32_t xid, struct nfs3_fh *fh, char *name, char *tgt); extern void -nfs3_log_mknod_call (uint32_t xid, struct nfs3_fh *fh, char *name, int type); +nfs3_log_mknod_call(uint32_t xid, struct nfs3_fh *fh, char *name, int type); extern void -nfs3_log_rename_call (uint32_t xid, struct nfs3_fh *src, char *sname, - struct nfs3_fh *dst, char *dname); +nfs3_log_rename_call(uint32_t xid, struct nfs3_fh *src, char *sname, + struct nfs3_fh *dst, char *dname); extern void -nfs3_log_link_call (uint32_t xid, struct nfs3_fh *fh, char *name, - struct nfs3_fh *tgt); +nfs3_log_link_call(uint32_t xid, struct nfs3_fh *fh, char *name, + struct nfs3_fh *tgt); extern void -nfs3_log_readdir_call (uint32_t xid, struct nfs3_fh *fh, count3 dircount, - count3 maxcount); +nfs3_log_readdir_call(uint32_t xid, struct nfs3_fh *fh, count3 dircount, + count3 maxcount); extern int -nfs3_fh_resolve_entry_hard (nfs3_call_state_t *cs); +nfs3_fh_resolve_entry_hard(nfs3_call_state_t *cs); extern int -nfs3_fh_resolve_inode (nfs3_call_state_t *cs); +nfs3_fh_resolve_inode(nfs3_call_state_t *cs); extern int -nfs3_fh_resolve_entry (nfs3_call_state_t *cs); +nfs3_fh_resolve_entry(nfs3_call_state_t *cs); extern int -nfs3_fh_resolve_and_resume (nfs3_call_state_t *cs, struct nfs3_fh *fh, - char *entry, nfs3_resume_fn_t resum_fn); +nfs3_fh_resolve_and_resume(nfs3_call_state_t *cs, struct nfs3_fh *fh, + char *entry, nfs3_resume_fn_t resum_fn); extern int -nfs3_verify_dircookie (struct nfs3_state *nfs3, fd_t *dirfd, cookie3 cookie, - uint64_t cverf, nfsstat3 *stat); +nfs3_verify_dircookie(struct nfs3_state *nfs3, fd_t *dirfd, cookie3 cookie, + uint64_t cverf, nfsstat3 *stat); extern int -nfs3_is_parentdir_entry (char *entry); +nfs3_is_parentdir_entry(char *entry); uint32_t -nfs3_request_to_accessbits (int32_t accbits); +nfs3_request_to_accessbits(int32_t accbits); extern int -nfs3_fh_auth_nfsop (nfs3_call_state_t *cs, gf_boolean_t is_write_op); +nfs3_fh_auth_nfsop(nfs3_call_state_t *cs, gf_boolean_t is_write_op); void -nfs3_map_deviceid_to_statdev (struct iatt *ia, uint64_t deviceid); +nfs3_map_deviceid_to_statdev(struct iatt *ia, uint64_t deviceid); #endif diff --git a/xlators/nfs/server/src/nfs3.h b/xlators/nfs/server/src/nfs3.h index 187fb7e1912..f6d98d9f308 100644 --- a/xlators/nfs/server/src/nfs3.h +++ b/xlators/nfs/server/src/nfs3.h @@ -26,13 +26,12 @@ #include "refcount.h" #include <sys/statvfs.h> -#define GF_NFS3 GF_NFS"-nfsv3" - -#define GF_NFS3_DEFAULT_MEMFACTOR 15 -#define GF_NFS3_IOBPOOL_MULT GF_NFS_CONCURRENT_OPS_MULT -#define GF_NFS3_CLTABLE_BUCKETS_MULT 2 -#define GF_NFS3_FDTABLE_BUCKETS_MULT 2 +#define GF_NFS3 GF_NFS "-nfsv3" +#define GF_NFS3_DEFAULT_MEMFACTOR 15 +#define GF_NFS3_IOBPOOL_MULT GF_NFS_CONCURRENT_OPS_MULT +#define GF_NFS3_CLTABLE_BUCKETS_MULT 2 +#define GF_NFS3_FDTABLE_BUCKETS_MULT 2 /* Static values used for FSINFO * To change the maximum rsize and wsize supported by the NFS client, adjust @@ -43,136 +42,143 @@ * * NB: For Kernel-NFS, NFS_MAX_FILE_IO_SIZE is 1048576U (1MB). */ -#define GF_NFS3_FILE_IO_SIZE_MAX (1 * GF_UNIT_MB) /* 1048576 */ -#define GF_NFS3_FILE_IO_SIZE_MIN (4 * GF_UNIT_KB) /* 4096 */ +#define GF_NFS3_FILE_IO_SIZE_MAX (1 * GF_UNIT_MB) /* 1048576 */ +#define GF_NFS3_FILE_IO_SIZE_MIN (4 * GF_UNIT_KB) /* 4096 */ -#define GF_NFS3_FILE_IO_SIZE_DEF GF_NFS3_FILE_IO_SIZE_MAX +#define GF_NFS3_FILE_IO_SIZE_DEF GF_NFS3_FILE_IO_SIZE_MAX -#define GF_NFS3_RTMAX GF_NFS3_FILE_IO_SIZE_MAX -#define GF_NFS3_RTMIN GF_NFS3_FILE_IO_SIZE_MIN -#define GF_NFS3_RTPREF GF_NFS3_FILE_IO_SIZE_DEF -#define GF_NFS3_RTMULT GF_NFS3_FILE_IO_SIZE_MIN +#define GF_NFS3_RTMAX GF_NFS3_FILE_IO_SIZE_MAX +#define GF_NFS3_RTMIN GF_NFS3_FILE_IO_SIZE_MIN +#define GF_NFS3_RTPREF GF_NFS3_FILE_IO_SIZE_DEF +#define GF_NFS3_RTMULT GF_NFS3_FILE_IO_SIZE_MIN -#define GF_NFS3_WTMAX GF_NFS3_FILE_IO_SIZE_MAX -#define GF_NFS3_WTMIN GF_NFS3_FILE_IO_SIZE_MIN -#define GF_NFS3_WTPREF GF_NFS3_FILE_IO_SIZE_DEF -#define GF_NFS3_WTMULT GF_NFS3_FILE_IO_SIZE_MIN +#define GF_NFS3_WTMAX GF_NFS3_FILE_IO_SIZE_MAX +#define GF_NFS3_WTMIN GF_NFS3_FILE_IO_SIZE_MIN +#define GF_NFS3_WTPREF GF_NFS3_FILE_IO_SIZE_DEF +#define GF_NFS3_WTMULT GF_NFS3_FILE_IO_SIZE_MIN /* This can be tuned through nfs.readdir-size */ -#define GF_NFS3_DTMAX GF_NFS3_FILE_IO_SIZE_MAX -#define GF_NFS3_DTMIN GF_NFS3_FILE_IO_SIZE_MIN -#define GF_NFS3_DTPREF GF_NFS3_FILE_IO_SIZE_DEF +#define GF_NFS3_DTMAX GF_NFS3_FILE_IO_SIZE_MAX +#define GF_NFS3_DTMIN GF_NFS3_FILE_IO_SIZE_MIN +#define GF_NFS3_DTPREF GF_NFS3_FILE_IO_SIZE_DEF -#define GF_NFS3_MAXFILESIZE (1 * GF_UNIT_PB) +#define GF_NFS3_MAXFILESIZE (1 * GF_UNIT_PB) -#define GF_NFS3_IO_SIZE 4096 /* 4-KB */ -#define GF_NFS3_IO_SHIFT 12 /* 2^12 = 4KB */ +#define GF_NFS3_IO_SIZE 4096 /* 4-KB */ +#define GF_NFS3_IO_SHIFT 12 /* 2^12 = 4KB */ /* FIXME: Handle time resolutions */ -#define GF_NFS3_TIMEDELTA_SECS {1,0} -#define GF_NFS3_TIMEDELTA_NSECS {0,1} -#define GF_NFS3_TIMEDELTA_MSECS {0,1000000} - -#define GF_NFS3_FS_PROP (FSF3_LINK | FSF3_SYMLINK | FSF3_HOMOGENEOUS | FSF3_CANSETTIME) - -#define GF_NFS3_DIRFD_VALID 1 -#define GF_NFS3_DIRFD_INVALID 0 - -#define GF_NFS3_VOLACCESS_RW 1 -#define GF_NFS3_VOLACCESS_RO 2 - - -#define GF_NFS3_FDCACHE_SIZE 512 +#define GF_NFS3_TIMEDELTA_SECS \ + { \ + 1, 0 \ + } +#define GF_NFS3_TIMEDELTA_NSECS \ + { \ + 0, 1 \ + } +#define GF_NFS3_TIMEDELTA_MSECS \ + { \ + 0, 1000000 \ + } + +#define GF_NFS3_FS_PROP \ + (FSF3_LINK | FSF3_SYMLINK | FSF3_HOMOGENEOUS | FSF3_CANSETTIME) + +#define GF_NFS3_DIRFD_VALID 1 +#define GF_NFS3_DIRFD_INVALID 0 + +#define GF_NFS3_VOLACCESS_RW 1 +#define GF_NFS3_VOLACCESS_RO 2 + +#define GF_NFS3_FDCACHE_SIZE 512 /* This should probably be moved to a more generic layer so that if needed * different versions of NFS protocol can use the same thing. */ struct nfs3_fd_entry { - fd_t *cachedfd; - struct list_head list; + fd_t *cachedfd; + struct list_head list; }; /* Per subvolume nfs3 specific state */ struct nfs3_export { - struct list_head explist; - xlator_t *subvol; - uuid_t volumeid; - int access; - int trusted_sync; - int trusted_write; - int rootlookedup; + struct list_head explist; + xlator_t *subvol; + uuid_t volumeid; + int access; + int trusted_sync; + int trusted_write; + int rootlookedup; }; -#define GF_NFS3_DEFAULT_VOLACCESS (GF_NFS3_VOLACCESS_RW) +#define GF_NFS3_DEFAULT_VOLACCESS (GF_NFS3_VOLACCESS_RW) /* The NFSv3 protocol state */ typedef struct nfs3_state { - - /* The NFS xlator pointer. The NFS xlator can be running - * multiple versions of the NFS protocol. - */ - xlator_t *nfsx; - - /* The iob pool from which memory allocations are made for receiving - * and sending network messages. - */ - struct iobuf_pool *iobpool; - - /* List of child subvolumes for the NFSv3 protocol. - * Right now, is simply referring to the list of children in nfsx above. - */ - xlator_list_t *exportslist; - - struct list_head exports; - /* Mempool for allocations of struct nfs3_local */ - struct mem_pool *localpool; - - /* Server start-up timestamp, currently used for write verifier. */ - uint64_t serverstart; - - /* NFSv3 Protocol configurables */ - uint64_t readsize; - uint64_t writesize; - uint64_t readdirsize; - - /* Size of the iobufs used, depends on the sizes of the three params - * above. - */ - uint64_t iobsize; - - struct list_head fdlru; - gf_lock_t fdlrulock; - int fdcount; - uint32_t occ_logger; + /* The NFS xlator pointer. The NFS xlator can be running + * multiple versions of the NFS protocol. + */ + xlator_t *nfsx; + + /* The iob pool from which memory allocations are made for receiving + * and sending network messages. + */ + struct iobuf_pool *iobpool; + + /* List of child subvolumes for the NFSv3 protocol. + * Right now, is simply referring to the list of children in nfsx above. + */ + xlator_list_t *exportslist; + + struct list_head exports; + /* Mempool for allocations of struct nfs3_local */ + struct mem_pool *localpool; + + /* Server start-up timestamp, currently used for write verifier. */ + uint64_t serverstart; + + /* NFSv3 Protocol configurables */ + uint64_t readsize; + uint64_t writesize; + uint64_t readdirsize; + + /* Size of the iobufs used, depends on the sizes of the three params + * above. + */ + uint64_t iobsize; + + struct list_head fdlru; + gf_lock_t fdlrulock; + int fdcount; + uint32_t occ_logger; } nfs3_state_t; typedef enum nfs3_lookup_type { - GF_NFS3_REVALIDATE = 1, - GF_NFS3_FRESH, + GF_NFS3_REVALIDATE = 1, + GF_NFS3_FRESH, } nfs3_lookup_type_t; typedef union args_ { - nlm4_stat nlm4_stat; - nlm4_holder nlm4_holder; - nlm4_lock nlm4_lock; - nlm4_share nlm4_share; - nlm4_testrply nlm4_testrply; - nlm4_testres nlm4_testres; - nlm4_testargs nlm4_testargs; - nlm4_res nlm4_res; - nlm4_lockargs nlm4_lockargs; - nlm4_cancargs nlm4_cancargs; - nlm4_unlockargs nlm4_unlockargs; - nlm4_shareargs nlm4_shareargs; - nlm4_shareres nlm4_shareres; - nlm4_freeallargs nlm4_freeallargs; - getaclargs getaclargs; - setaclargs setaclargs; - getaclreply getaclreply; - setaclreply setaclreply; + nlm4_stat nlm4_stat; + nlm4_holder nlm4_holder; + nlm4_lock nlm4_lock; + nlm4_share nlm4_share; + nlm4_testrply nlm4_testrply; + nlm4_testres nlm4_testres; + nlm4_testargs nlm4_testargs; + nlm4_res nlm4_res; + nlm4_lockargs nlm4_lockargs; + nlm4_cancargs nlm4_cancargs; + nlm4_unlockargs nlm4_unlockargs; + nlm4_shareargs nlm4_shareargs; + nlm4_shareres nlm4_shareres; + nlm4_freeallargs nlm4_freeallargs; + getaclargs getaclargs; + setaclargs setaclargs; + getaclreply getaclreply; + setaclreply setaclreply; } args; - -typedef int (*nfs3_resume_fn_t) (void *cs); +typedef int (*nfs3_resume_fn_t)(void *cs); /* Structure used to communicate state between a fop and its callback. * Not all members are used at all times. Usage is fop and NFS request * dependent. @@ -185,80 +191,80 @@ typedef int (*nfs3_resume_fn_t) (void *cs); * Imagine the chaos if we need a mem-pool for each one of those sub-structures. */ struct nfs3_local { - GF_REF_DECL; - - rpcsvc_request_t *req; - xlator_t *vol; - nfs3_resume_fn_t resume_fn; - xlator_t *nfsx; - struct nfs3_state *nfs3state; - - /* The list hook to attach this call state to the inode's queue till - * the opening of the fd on the inode completes. - */ - struct list_head openwait_q; - - /* Per-NFSv3 Op state */ - struct nfs3_fh parent; - struct nfs3_fh fh; - fd_t *fd; - uint32_t accessbits; - int operrno; - count3 dircount; - count3 maxcount; - struct statvfs fsstat; - gf_dirent_t entries; - struct iatt stbuf; - struct iatt preparent; - struct iatt postparent; - int32_t setattr_valid; - nfstime3 timestamp; - loc_t oploc; - int writetype; - count3 datacount; - offset3 dataoffset; - struct iobuf *iob; - struct iobref *iobref; - createmode3 createmode; - uint64_t cookieverf; - int sattrguardcheck; - char *pathname; - ftype3 mknodtype; - specdata3 devnums; - cookie3 cookie; - struct iovec datavec; - mode_t mode; - struct iatt attr_in; - - /* NFSv3 FH resolver state */ - int hardresolved; - struct nfs3_fh resolvefh; - loc_t resolvedloc; - int resolve_ret; - int resolve_errno; - int hashidx; - fd_t *resolve_dir_fd; - char *resolventry; - nfs3_lookup_type_t lookuptype; - gf_dirent_t *hashmatch; - gf_dirent_t *entrymatch; - off_t lastentryoffset; - struct flock flock; - args args; - nlm4_lkowner_t lkowner; - char cookiebytes[1024]; - struct nfs3_fh lockfh; - int monitor; - rpc_transport_t *trans; - call_frame_t *frame; - - /* ACL */ - aclentry aclentry[NFS_ACL_MAX_ENTRIES]; - aclentry daclentry[NFS_ACL_MAX_ENTRIES]; - int aclcount; - char aclxattr[NFS_ACL_MAX_ENTRIES*8 + 4]; - int daclcount; - char daclxattr[NFS_ACL_MAX_ENTRIES*8 + 4]; + GF_REF_DECL; + + rpcsvc_request_t *req; + xlator_t *vol; + nfs3_resume_fn_t resume_fn; + xlator_t *nfsx; + struct nfs3_state *nfs3state; + + /* The list hook to attach this call state to the inode's queue till + * the opening of the fd on the inode completes. + */ + struct list_head openwait_q; + + /* Per-NFSv3 Op state */ + struct nfs3_fh parent; + struct nfs3_fh fh; + fd_t *fd; + uint32_t accessbits; + int operrno; + count3 dircount; + count3 maxcount; + struct statvfs fsstat; + gf_dirent_t entries; + struct iatt stbuf; + struct iatt preparent; + struct iatt postparent; + int32_t setattr_valid; + nfstime3 timestamp; + loc_t oploc; + int writetype; + count3 datacount; + offset3 dataoffset; + struct iobuf *iob; + struct iobref *iobref; + createmode3 createmode; + uint64_t cookieverf; + int sattrguardcheck; + char *pathname; + ftype3 mknodtype; + specdata3 devnums; + cookie3 cookie; + struct iovec datavec; + mode_t mode; + struct iatt attr_in; + + /* NFSv3 FH resolver state */ + int hardresolved; + struct nfs3_fh resolvefh; + loc_t resolvedloc; + int resolve_ret; + int resolve_errno; + int hashidx; + fd_t *resolve_dir_fd; + char *resolventry; + nfs3_lookup_type_t lookuptype; + gf_dirent_t *hashmatch; + gf_dirent_t *entrymatch; + off_t lastentryoffset; + struct flock flock; + args args; + nlm4_lkowner_t lkowner; + char cookiebytes[1024]; + struct nfs3_fh lockfh; + int monitor; + rpc_transport_t *trans; + call_frame_t *frame; + + /* ACL */ + aclentry aclentry[NFS_ACL_MAX_ENTRIES]; + aclentry daclentry[NFS_ACL_MAX_ENTRIES]; + int aclcount; + char aclxattr[NFS_ACL_MAX_ENTRIES * 8 + 4]; + int daclcount; + char daclxattr[NFS_ACL_MAX_ENTRIES * 8 + 4]; }; #define nfs3_is_revalidate_lookup(cst) ((cst)->lookuptype == GF_NFS3_REVALIDATE) @@ -270,17 +276,17 @@ typedef struct nfs3_local nfs3_call_state_t; /* Queue of ops waiting for open fop to return. */ struct inode_op_queue { - struct list_head opq; - pthread_mutex_t qlock; + struct list_head opq; + pthread_mutex_t qlock; }; extern rpcsvc_program_t * -nfs3svc_init (xlator_t *nfsx); +nfs3svc_init(xlator_t *nfsx); extern int -nfs3_reconfigure_state (xlator_t *nfsx, dict_t *options); +nfs3_reconfigure_state(xlator_t *nfsx, dict_t *options); extern uint64_t -nfs3_request_xlator_deviceid (rpcsvc_request_t *req); +nfs3_request_xlator_deviceid(rpcsvc_request_t *req); #endif diff --git a/xlators/nfs/server/src/nlm4.h b/xlators/nfs/server/src/nlm4.h index f9d254e2a37..4755c83f3dc 100644 --- a/xlators/nfs/server/src/nlm4.h +++ b/xlators/nfs/server/src/nlm4.h @@ -26,86 +26,86 @@ #include "nlm4-xdr.h" #include "lkowner.h" -#define NLM4_NULL 0 -#define NLM4_TEST 1 -#define NLM4_LOCK 2 -#define NLM4_CANCEL 3 -#define NLM4_UNLOCK 4 -#define NLM4_GRANTED 5 -#define NLM4_TEST_MSG 6 -#define NLM4_LOCK_MSG 7 -#define NLM4_CANCEL_MSG 8 -#define NLM4_UNLOCK_MSG 9 -#define NLM4_GRANTED_MSG 10 -#define NLM4_TEST_RES 11 -#define NLM4_LOCK_RES 12 -#define NLM4_CANCEL_RES 13 -#define NLM4_UNLOCK_RES 14 -#define NLM4_GRANTED_RES 15 -#define NLM4_SM_NOTIFY 16 -#define NLM4_SEVENTEEN 17 -#define NLM4_EIGHTEEN 18 -#define NLM4_NINETEEN 19 -#define NLM4_SHARE 20 -#define NLM4_UNSHARE 21 -#define NLM4_NM_LOCK 22 -#define NLM4_FREE_ALL 23 -#define NLM4_PROC_COUNT 24 +#define NLM4_NULL 0 +#define NLM4_TEST 1 +#define NLM4_LOCK 2 +#define NLM4_CANCEL 3 +#define NLM4_UNLOCK 4 +#define NLM4_GRANTED 5 +#define NLM4_TEST_MSG 6 +#define NLM4_LOCK_MSG 7 +#define NLM4_CANCEL_MSG 8 +#define NLM4_UNLOCK_MSG 9 +#define NLM4_GRANTED_MSG 10 +#define NLM4_TEST_RES 11 +#define NLM4_LOCK_RES 12 +#define NLM4_CANCEL_RES 13 +#define NLM4_UNLOCK_RES 14 +#define NLM4_GRANTED_RES 15 +#define NLM4_SM_NOTIFY 16 +#define NLM4_SEVENTEEN 17 +#define NLM4_EIGHTEEN 18 +#define NLM4_NINETEEN 19 +#define NLM4_SHARE 20 +#define NLM4_UNSHARE 21 +#define NLM4_NM_LOCK 22 +#define NLM4_FREE_ALL 23 +#define NLM4_PROC_COUNT 24 /* Registered with portmap */ -#define GF_NLM4_PORT 38468 -#define GF_NLM GF_NFS"-NLM" +#define GF_NLM4_PORT 38468 +#define GF_NLM GF_NFS "-NLM" #if defined(GF_DARWIN_HOST_OS) -#define GF_RPC_STATD_PROG "/usr/sbin/rpc.statd" -#define GF_RPC_STATD_PIDFILE "/var/run/statd.pid" -#define GF_SM_NOTIFY_PIDFILE "/var/run/statd.notify.pid" +#define GF_RPC_STATD_PROG "/usr/sbin/rpc.statd" +#define GF_RPC_STATD_PIDFILE "/var/run/statd.pid" +#define GF_SM_NOTIFY_PIDFILE "/var/run/statd.notify.pid" #elif defined(__NetBSD__) -#define GF_RPC_STATD_PROG "/usr/sbin/rpc.statd" -#define GF_RPC_STATD_PIDFILE "/var/run/rpc.statd.pid" -#define GF_SM_NOTIFY_PIDFILE "/var/run/inexistent.pid" +#define GF_RPC_STATD_PROG "/usr/sbin/rpc.statd" +#define GF_RPC_STATD_PIDFILE "/var/run/rpc.statd.pid" +#define GF_SM_NOTIFY_PIDFILE "/var/run/inexistent.pid" #else -#define GF_RPC_STATD_PROG "/sbin/rpc.statd" -#define GF_RPC_STATD_PIDFILE "/var/run/rpc.statd.pid" -#define GF_SM_NOTIFY_PIDFILE "/var/run/sm-notify.pid" +#define GF_RPC_STATD_PROG "/sbin/rpc.statd" +#define GF_RPC_STATD_PIDFILE "/var/run/rpc.statd.pid" +#define GF_SM_NOTIFY_PIDFILE "/var/run/sm-notify.pid" #endif extern rpcsvc_program_t * -nlm4svc_init (xlator_t *nfsx); +nlm4svc_init(xlator_t *nfsx); extern int -nlm4_init_state (xlator_t *nfsx); +nlm4_init_state(xlator_t *nfsx); #define NLM_PROGRAM 100021 #define NLM_V4 4 typedef struct nlm4_lwowner { - char temp[1024]; + char temp[1024]; } nlm4_lkowner_t; typedef struct nlm_client { - struct sockaddr_storage sa; - pid_t uniq; - struct list_head nlm_clients; - struct list_head fdes; - struct list_head shares; - struct rpc_clnt *rpc_clnt; - char *caller_name; - int nsm_monitor; + struct sockaddr_storage sa; + pid_t uniq; + struct list_head nlm_clients; + struct list_head fdes; + struct list_head shares; + struct rpc_clnt *rpc_clnt; + char *caller_name; + int nsm_monitor; } nlm_client_t; typedef struct nlm_share { - struct list_head client_list; - struct list_head inode_list; - gf_lkowner_t lkowner; - inode_t *inode; - fsh_mode mode; - fsh_access access; + struct list_head client_list; + struct list_head inode_list; + gf_lkowner_t lkowner; + inode_t *inode; + fsh_mode mode; + fsh_access access; } nlm_share_t; typedef struct nlm_fde { - struct list_head fde_list; - fd_t *fd; - int transit_cnt; + struct list_head fde_list; + fd_t *fd; + int transit_cnt; } nlm_fde_t; #endif |