diff options
Diffstat (limited to 'xlators/protocol/server')
-rw-r--r-- | xlators/protocol/server/src/authenticate.h | 24 | ||||
-rw-r--r-- | xlators/protocol/server/src/server-common.h | 202 | ||||
-rw-r--r-- | xlators/protocol/server/src/server-helpers.h | 124 | ||||
-rw-r--r-- | xlators/protocol/server/src/server-mem-types.h | 31 | ||||
-rw-r--r-- | xlators/protocol/server/src/server-messages.h | 134 | ||||
-rw-r--r-- | xlators/protocol/server/src/server.h | 377 |
6 files changed, 411 insertions, 481 deletions
diff --git a/xlators/protocol/server/src/authenticate.h b/xlators/protocol/server/src/authenticate.h index 5f92183fb12..6fc53933343 100644 --- a/xlators/protocol/server/src/authenticate.h +++ b/xlators/protocol/server/src/authenticate.h @@ -22,23 +22,21 @@ #include "list.h" #include "xlator.h" -typedef enum { - AUTH_ACCEPT, - AUTH_REJECT, - AUTH_DONT_CARE -} auth_result_t; +typedef enum { AUTH_ACCEPT, AUTH_REJECT, AUTH_DONT_CARE } auth_result_t; -typedef auth_result_t (*auth_fn_t) (dict_t *input_params, - dict_t *config_params); +typedef auth_result_t (*auth_fn_t)(dict_t *input_params, dict_t *config_params); typedef struct { - void *handle; - auth_fn_t authenticate; - volume_opt_list_t *vol_opt; + void *handle; + auth_fn_t authenticate; + volume_opt_list_t *vol_opt; } auth_handle_t; -int32_t gf_auth_init (xlator_t *xl, dict_t *auth_modules); -void gf_auth_fini (dict_t *auth_modules); -auth_result_t gf_authenticate (dict_t *, dict_t *, dict_t *); +int32_t +gf_auth_init(xlator_t *xl, dict_t *auth_modules); +void +gf_auth_fini(dict_t *auth_modules); +auth_result_t +gf_authenticate(dict_t *, dict_t *, dict_t *); #endif /* _AUTHENTICATE_H */ diff --git a/xlators/protocol/server/src/server-common.h b/xlators/protocol/server/src/server-common.h index e272235a192..53e46afdc69 100644 --- a/xlators/protocol/server/src/server-common.h +++ b/xlators/protocol/server/src/server-common.h @@ -9,200 +9,186 @@ #include "xdr-nfs3.h" void -server_post_stat (server_state_t *state, - gfs3_stat_rsp *rsp, struct iatt *stbuf); +server_post_stat(server_state_t *state, gfs3_stat_rsp *rsp, struct iatt *stbuf); void -server_post_readlink (gfs3_readlink_rsp *rsp, struct iatt *stbuf, - const char *buf); +server_post_readlink(gfs3_readlink_rsp *rsp, struct iatt *stbuf, + const char *buf); void -server_post_mknod (server_state_t *state, gfs3_mknod_rsp *rsp, - struct iatt *stbuf, struct iatt *preparent, - struct iatt *postparent, inode_t *inode); +server_post_mknod(server_state_t *state, gfs3_mknod_rsp *rsp, + struct iatt *stbuf, struct iatt *preparent, + struct iatt *postparent, inode_t *inode); void -server_post_mkdir (server_state_t *state, gfs3_mkdir_rsp *rsp, - inode_t *inode, - struct iatt *stbuf, struct iatt *preparent, - struct iatt *postparent, dict_t *xdata); +server_post_mkdir(server_state_t *state, gfs3_mkdir_rsp *rsp, inode_t *inode, + struct iatt *stbuf, struct iatt *preparent, + struct iatt *postparent, dict_t *xdata); void -server_post_unlink (server_state_t *state, gfs3_unlink_rsp *rsp, - struct iatt *preparent, struct iatt *postparent); +server_post_unlink(server_state_t *state, gfs3_unlink_rsp *rsp, + struct iatt *preparent, struct iatt *postparent); void -server_post_rmdir (server_state_t *state, gfs3_rmdir_rsp *rsp, - struct iatt *preparent, struct iatt *postparent); +server_post_rmdir(server_state_t *state, gfs3_rmdir_rsp *rsp, + struct iatt *preparent, struct iatt *postparent); void -server_post_symlink (server_state_t *state, gfs3_symlink_rsp *rsp, - inode_t *inode, - struct iatt *stbuf, struct iatt *preparent, - struct iatt *postparent, dict_t *xdata); +server_post_symlink(server_state_t *state, gfs3_symlink_rsp *rsp, + inode_t *inode, struct iatt *stbuf, struct iatt *preparent, + struct iatt *postparent, dict_t *xdata); void -server_post_link (server_state_t *state, gfs3_link_rsp *rsp, - inode_t *inode, - struct iatt *stbuf, struct iatt *preparent, - struct iatt *postparent, dict_t *xdata); +server_post_link(server_state_t *state, gfs3_link_rsp *rsp, inode_t *inode, + struct iatt *stbuf, struct iatt *preparent, + struct iatt *postparent, dict_t *xdata); void -server_post_truncate (gfs3_truncate_rsp *rsp, struct iatt *prebuf, - struct iatt *postbuf); +server_post_truncate(gfs3_truncate_rsp *rsp, struct iatt *prebuf, + struct iatt *postbuf); void -server_post_writev (gfs3_write_rsp *rsp, struct iatt *prebuf, - struct iatt *postbuf); +server_post_writev(gfs3_write_rsp *rsp, struct iatt *prebuf, + struct iatt *postbuf); void -server_post_statfs (gfs3_statfs_rsp *rsp, struct statvfs *stbuf); +server_post_statfs(gfs3_statfs_rsp *rsp, struct statvfs *stbuf); void -server_post_fsync (gfs3_fsync_rsp *rsp, struct iatt *prebuf, - struct iatt *postbuf); +server_post_fsync(gfs3_fsync_rsp *rsp, struct iatt *prebuf, + struct iatt *postbuf); void -server_post_ftruncate (gfs3_ftruncate_rsp *rsp, struct iatt *prebuf, +server_post_ftruncate(gfs3_ftruncate_rsp *rsp, struct iatt *prebuf, struct iatt *postbuf); void -server_post_fstat (server_state_t *state, - gfs3_fstat_rsp *rsp, struct iatt *stbuf); +server_post_fstat(server_state_t *state, gfs3_fstat_rsp *rsp, + struct iatt *stbuf); void -server_post_lk (xlator_t *this, gfs3_lk_rsp *rsp, struct gf_flock *lock); +server_post_lk(xlator_t *this, gfs3_lk_rsp *rsp, struct gf_flock *lock); int -server_post_readdir (gfs3_readdir_rsp *rsp, gf_dirent_t *entries); +server_post_readdir(gfs3_readdir_rsp *rsp, gf_dirent_t *entries); void -server_post_zerofill (gfs3_zerofill_rsp *rsp, struct iatt *statpre, - struct iatt *statpost); +server_post_zerofill(gfs3_zerofill_rsp *rsp, struct iatt *statpre, + struct iatt *statpost); void -server_post_discard (gfs3_discard_rsp *rsp, struct iatt *statpre, - struct iatt *statpost); +server_post_discard(gfs3_discard_rsp *rsp, struct iatt *statpre, + struct iatt *statpost); void -server_post_fallocate (gfs3_fallocate_rsp *rsp, struct iatt *statpre, - struct iatt *statpost); +server_post_fallocate(gfs3_fallocate_rsp *rsp, struct iatt *statpre, + struct iatt *statpost); void -server_post_seek (gfs3_seek_rsp *rsp, off_t offset); +server_post_seek(gfs3_seek_rsp *rsp, off_t offset); int -server_post_readdirp (gfs3_readdirp_rsp *rsp, gf_dirent_t *entries); +server_post_readdirp(gfs3_readdirp_rsp *rsp, gf_dirent_t *entries); void -server_post_fsetattr (gfs3_fsetattr_rsp *rsp, struct iatt *statpre, - struct iatt *statpost); +server_post_fsetattr(gfs3_fsetattr_rsp *rsp, struct iatt *statpre, + struct iatt *statpost); void -server_post_setattr (gfs3_setattr_rsp *rsp, struct iatt *statpre, - struct iatt *statpost); +server_post_setattr(gfs3_setattr_rsp *rsp, struct iatt *statpre, + struct iatt *statpost); void -server_post_rchecksum (gfs3_rchecksum_rsp *rsp, uint32_t weak_checksum, - uint8_t *strong_checksum); +server_post_rchecksum(gfs3_rchecksum_rsp *rsp, uint32_t weak_checksum, + uint8_t *strong_checksum); void -server_post_rename (call_frame_t *frame, server_state_t *state, - gfs3_rename_rsp *rsp, - struct iatt *stbuf, - struct iatt *preoldparent, - struct iatt *postoldparent, - struct iatt *prenewparent, - struct iatt *postnewparent); +server_post_rename(call_frame_t *frame, server_state_t *state, + gfs3_rename_rsp *rsp, struct iatt *stbuf, + struct iatt *preoldparent, struct iatt *postoldparent, + struct iatt *prenewparent, struct iatt *postnewparent); int -server_post_open (call_frame_t *frame, xlator_t *this, - gfs3_open_rsp *rsp, fd_t *fd); +server_post_open(call_frame_t *frame, xlator_t *this, gfs3_open_rsp *rsp, + fd_t *fd); void -server_post_readv (gfs3_read_rsp *rsp, struct iatt *stbuf, int op_ret); +server_post_readv(gfs3_read_rsp *rsp, struct iatt *stbuf, int op_ret); int -server_post_opendir (call_frame_t *frame, xlator_t *this, - gfs3_opendir_rsp *rsp, fd_t *fd); +server_post_opendir(call_frame_t *frame, xlator_t *this, gfs3_opendir_rsp *rsp, + fd_t *fd); int -server_post_create (call_frame_t *frame, gfs3_create_rsp *rsp, - server_state_t *state, - xlator_t *this, fd_t *fd, inode_t *inode, - struct iatt *stbuf, struct iatt *preparent, - struct iatt *postparent); +server_post_create(call_frame_t *frame, gfs3_create_rsp *rsp, + server_state_t *state, xlator_t *this, fd_t *fd, + inode_t *inode, struct iatt *stbuf, struct iatt *preparent, + struct iatt *postparent); void -server_post_lookup (gfs3_lookup_rsp *rsp, call_frame_t *frame, - server_state_t *state, - inode_t *inode, struct iatt *stbuf, - struct iatt *postparent); +server_post_lookup(gfs3_lookup_rsp *rsp, call_frame_t *frame, + server_state_t *state, inode_t *inode, struct iatt *stbuf, + struct iatt *postparent); void -server_post_lease (gfs3_lease_rsp *rsp, struct gf_lease *lease); +server_post_lease(gfs3_lease_rsp *rsp, struct gf_lease *lease); void -server4_post_readlink (gfx_readlink_rsp *rsp, struct iatt *stbuf, +server4_post_readlink(gfx_readlink_rsp *rsp, struct iatt *stbuf, const char *buf); void -server4_post_statfs (gfx_statfs_rsp *rsp, struct statvfs *stbuf); +server4_post_statfs(gfx_statfs_rsp *rsp, struct statvfs *stbuf); void -server4_post_lk (xlator_t *this, gfx_lk_rsp *rsp, struct gf_flock *lock); +server4_post_lk(xlator_t *this, gfx_lk_rsp *rsp, struct gf_flock *lock); int -server4_post_readdir (gfx_readdir_rsp *rsp, gf_dirent_t *entries); +server4_post_readdir(gfx_readdir_rsp *rsp, gf_dirent_t *entries); void -server4_post_seek (gfx_seek_rsp *rsp, off_t offset); +server4_post_seek(gfx_seek_rsp *rsp, off_t offset); int -server4_post_readdirp (gfx_readdirp_rsp *rsp, gf_dirent_t *entries); +server4_post_readdirp(gfx_readdirp_rsp *rsp, gf_dirent_t *entries); void -server4_post_rchecksum (gfx_rchecksum_rsp *rsp, uint32_t weak_checksum, +server4_post_rchecksum(gfx_rchecksum_rsp *rsp, uint32_t weak_checksum, uint8_t *strong_checksum); void -server4_post_rename (call_frame_t *frame, server_state_t *state, - gfx_rename_rsp *rsp, - struct iatt *stbuf, - struct iatt *preoldparent, - struct iatt *postoldparent, - struct iatt *prenewparent, - struct iatt *postnewparent); +server4_post_rename(call_frame_t *frame, server_state_t *state, + gfx_rename_rsp *rsp, struct iatt *stbuf, + struct iatt *preoldparent, struct iatt *postoldparent, + struct iatt *prenewparent, struct iatt *postnewparent); int -server4_post_open (call_frame_t *frame, xlator_t *this, - gfx_open_rsp *rsp, fd_t *fd); +server4_post_open(call_frame_t *frame, xlator_t *this, gfx_open_rsp *rsp, + fd_t *fd); void -server4_post_readv (gfx_read_rsp *rsp, struct iatt *stbuf, int op_ret); +server4_post_readv(gfx_read_rsp *rsp, struct iatt *stbuf, int op_ret); int -server4_post_create (call_frame_t *frame, gfx_create_rsp *rsp, - server_state_t *state, - xlator_t *this, fd_t *fd, inode_t *inode, - struct iatt *stbuf, struct iatt *preparent, +server4_post_create(call_frame_t *frame, gfx_create_rsp *rsp, + server_state_t *state, xlator_t *this, fd_t *fd, + inode_t *inode, struct iatt *stbuf, struct iatt *preparent, struct iatt *postparent); void -server4_post_common_2iatt (gfx_common_2iatt_rsp *rsp, - struct iatt *stbuf1, struct iatt *stbuf2); +server4_post_common_2iatt(gfx_common_2iatt_rsp *rsp, struct iatt *stbuf1, + struct iatt *stbuf2); void -server4_post_entry_remove (server_state_t *state, gfx_common_2iatt_rsp *rsp, - struct iatt *stbuf1, struct iatt *stbuf2); +server4_post_entry_remove(server_state_t *state, gfx_common_2iatt_rsp *rsp, + struct iatt *stbuf1, struct iatt *stbuf2); void -server4_post_common_3iatt (server_state_t *state, gfx_common_3iatt_rsp *rsp, - inode_t *inode, struct iatt *stbuf, struct iatt *pre, - struct iatt *post); +server4_post_common_3iatt(server_state_t *state, gfx_common_3iatt_rsp *rsp, + inode_t *inode, struct iatt *stbuf, struct iatt *pre, + struct iatt *post); void -server4_post_common_iatt (server_state_t *state, gfx_common_iatt_rsp *rsp, - struct iatt *stbuf); +server4_post_common_iatt(server_state_t *state, gfx_common_iatt_rsp *rsp, + struct iatt *stbuf); void -server4_post_lease (gfx_lease_rsp *rsp, struct gf_lease *lease); +server4_post_lease(gfx_lease_rsp *rsp, struct gf_lease *lease); void -server4_post_lookup (gfx_common_2iatt_rsp *rsp, call_frame_t *frame, - server_state_t *state, - inode_t *inode, struct iatt *stbuf); +server4_post_lookup(gfx_common_2iatt_rsp *rsp, call_frame_t *frame, + server_state_t *state, inode_t *inode, struct iatt *stbuf); void -server4_post_link (server_state_t *state, gfx_common_3iatt_rsp *rsp, - inode_t *inode, struct iatt *stbuf, struct iatt *pre, - struct iatt *post); +server4_post_link(server_state_t *state, gfx_common_3iatt_rsp *rsp, + inode_t *inode, struct iatt *stbuf, struct iatt *pre, + struct iatt *post); diff --git a/xlators/protocol/server/src/server-helpers.h b/xlators/protocol/server/src/server-helpers.h index b89105a355f..20b8d901bd2 100644 --- a/xlators/protocol/server/src/server-helpers.h +++ b/xlators/protocol/server/src/server-helpers.h @@ -14,119 +14,127 @@ #include "server.h" #include "defaults.h" -#define CALL_STATE(frame) ((server_state_t *)frame->root->state) +#define CALL_STATE(frame) ((server_state_t *)frame->root->state) -#define XPRT_FROM_FRAME(frame) ((rpc_transport_t *) CALL_STATE(frame)->xprt) +#define XPRT_FROM_FRAME(frame) ((rpc_transport_t *)CALL_STATE(frame)->xprt) -#define SERVER_CONF(frame) \ - ((server_conf_t *)XPRT_FROM_FRAME(frame)->this->private) +#define SERVER_CONF(frame) \ + ((server_conf_t *)XPRT_FROM_FRAME(frame)->this->private) #define XPRT_FROM_XLATOR(this) ((((server_conf_t *)this->private))->listen) -#define INODE_LRU_LIMIT(this) \ - (((server_conf_t *)(this->private))->config.inode_lru_limit) +#define INODE_LRU_LIMIT(this) \ + (((server_conf_t *)(this->private))->config.inode_lru_limit) #define IS_ROOT_INODE(inode) (inode == inode->table->root) -#define IS_NOT_ROOT(pathlen) ((pathlen > 2)? 1 : 0) +#define IS_NOT_ROOT(pathlen) ((pathlen > 2) ? 1 : 0) -void free_state (server_state_t *state); +void +free_state(server_state_t *state); -void server_loc_wipe (loc_t *loc); +void +server_loc_wipe(loc_t *loc); void -server_print_request (call_frame_t *frame); +server_print_request(call_frame_t *frame); call_frame_t * -get_frame_from_request (rpcsvc_request_t *req); +get_frame_from_request(rpcsvc_request_t *req); int -server_connection_cleanup (xlator_t *this, struct _client *client, - int32_t flags); +server_connection_cleanup(xlator_t *this, struct _client *client, + int32_t flags); int -server_build_config (xlator_t *this, server_conf_t *conf); +server_build_config(xlator_t *this, server_conf_t *conf); -int serialize_rsp_dirent (gf_dirent_t *entries, gfs3_readdir_rsp *rsp); -int serialize_rsp_direntp (gf_dirent_t *entries, gfs3_readdirp_rsp *rsp); -int readdirp_rsp_cleanup (gfs3_readdirp_rsp *rsp); -int readdir_rsp_cleanup (gfs3_readdir_rsp *rsp); -int readdirp_rsp_cleanup_v2 (gfx_readdirp_rsp *rsp); -int readdir_rsp_cleanup_v2 (gfx_readdir_rsp *rsp); -int auth_set_username_passwd (dict_t *input_params, dict_t *config_params, - struct _client *client); +int +serialize_rsp_dirent(gf_dirent_t *entries, gfs3_readdir_rsp *rsp); +int +serialize_rsp_direntp(gf_dirent_t *entries, gfs3_readdirp_rsp *rsp); +int +readdirp_rsp_cleanup(gfs3_readdirp_rsp *rsp); +int +readdir_rsp_cleanup(gfs3_readdir_rsp *rsp); +int +readdirp_rsp_cleanup_v2(gfx_readdirp_rsp *rsp); +int +readdir_rsp_cleanup_v2(gfx_readdir_rsp *rsp); +int +auth_set_username_passwd(dict_t *input_params, dict_t *config_params, + struct _client *client); -server_ctx_t *server_ctx_get (client_t *client, xlator_t *xlator); -int server_process_event_upcall (xlator_t *this, void *data); +server_ctx_t * +server_ctx_get(client_t *client, xlator_t *xlator); +int +server_process_event_upcall(xlator_t *this, void *data); inode_t * -server_inode_new (inode_table_t *itable, uuid_t gfid); +server_inode_new(inode_table_t *itable, uuid_t gfid); int -serialize_rsp_locklist (lock_migration_info_t *locklist, - gfs3_getactivelk_rsp *rsp); +serialize_rsp_locklist(lock_migration_info_t *locklist, + gfs3_getactivelk_rsp *rsp); int -serialize_rsp_locklist_v2 (lock_migration_info_t *locklist, - gfx_getactivelk_rsp *rsp); +serialize_rsp_locklist_v2(lock_migration_info_t *locklist, + gfx_getactivelk_rsp *rsp); int -getactivelkinfo_rsp_cleanup (gfs3_getactivelk_rsp *rsp); +getactivelkinfo_rsp_cleanup(gfs3_getactivelk_rsp *rsp); int -getactivelkinfo_rsp_cleanup_v2 (gfx_getactivelk_rsp *rsp); +getactivelkinfo_rsp_cleanup_v2(gfx_getactivelk_rsp *rsp); int -server_populate_compound_response (xlator_t *this, gfs3_compound_rsp *rsp, - call_frame_t *frame, - compound_args_cbk_t *args_cbk, int index); +server_populate_compound_response(xlator_t *this, gfs3_compound_rsp *rsp, + call_frame_t *frame, + compound_args_cbk_t *args_cbk, int index); int -server_get_compound_resolve (server_state_t *state, gfs3_compound_req *req); +server_get_compound_resolve(server_state_t *state, gfs3_compound_req *req); int -server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame, - default_args_t *this_args, - int index); +server_populate_compound_request(gfs3_compound_req *req, call_frame_t *frame, + default_args_t *this_args, int index); void -server_compound_rsp_cleanup (gfs3_compound_rsp *rsp, compound_args_cbk_t *args); +server_compound_rsp_cleanup(gfs3_compound_rsp *rsp, compound_args_cbk_t *args); void -server_compound_req_cleanup (gfs3_compound_req *req, int len); +server_compound_req_cleanup(gfs3_compound_req *req, int len); int -unserialize_req_locklist (gfs3_setactivelk_req *req, - lock_migration_info_t *lmi); +unserialize_req_locklist(gfs3_setactivelk_req *req, lock_migration_info_t *lmi); int -unserialize_req_locklist_v2 (gfx_setactivelk_req *req, - lock_migration_info_t *lmi); +unserialize_req_locklist_v2(gfx_setactivelk_req *req, + lock_migration_info_t *lmi); int -serialize_rsp_dirent (gf_dirent_t *entries, gfs3_readdir_rsp *rsp); +serialize_rsp_dirent(gf_dirent_t *entries, gfs3_readdir_rsp *rsp); int -serialize_rsp_direntp (gf_dirent_t *entries, gfs3_readdirp_rsp *rsp); +serialize_rsp_direntp(gf_dirent_t *entries, gfs3_readdirp_rsp *rsp); int -serialize_rsp_dirent_v2 (gf_dirent_t *entries, gfx_readdir_rsp *rsp); +serialize_rsp_dirent_v2(gf_dirent_t *entries, gfx_readdir_rsp *rsp); int -serialize_rsp_direntp_v2 (gf_dirent_t *entries, gfx_readdirp_rsp *rsp); +serialize_rsp_direntp_v2(gf_dirent_t *entries, gfx_readdirp_rsp *rsp); int -server_populate_compound_response_v2 (xlator_t *this, gfx_compound_rsp *rsp, - call_frame_t *frame, - compound_args_cbk_t *args_cbk, int index); +server_populate_compound_response_v2(xlator_t *this, gfx_compound_rsp *rsp, + call_frame_t *frame, + compound_args_cbk_t *args_cbk, int index); int -server_get_compound_resolve_v2 (server_state_t *state, gfx_compound_req *req); +server_get_compound_resolve_v2(server_state_t *state, gfx_compound_req *req); int -server_populate_compound_request_v2 (gfx_compound_req *req, call_frame_t *frame, - default_args_t *this_args, - int index); +server_populate_compound_request_v2(gfx_compound_req *req, call_frame_t *frame, + default_args_t *this_args, int index); void -server_compound_rsp_cleanup_v2 (gfx_compound_rsp *rsp, compound_args_cbk_t *args); +server_compound_rsp_cleanup_v2(gfx_compound_rsp *rsp, + compound_args_cbk_t *args); void -server_compound_req_cleanup_v2 (gfx_compound_req *req, int len); - +server_compound_req_cleanup_v2(gfx_compound_req *req, int len); #endif /* !_SERVER_HELPERS_H */ diff --git a/xlators/protocol/server/src/server-mem-types.h b/xlators/protocol/server/src/server-mem-types.h index 76a78ac3ede..4b341e53845 100644 --- a/xlators/protocol/server/src/server-mem-types.h +++ b/xlators/protocol/server/src/server-mem-types.h @@ -8,27 +8,26 @@ cases as published by the Free Software Foundation. */ - #ifndef __SERVER_MEM_TYPES_H__ #define __SERVER_MEM_TYPES_H__ #include "mem-types.h" enum gf_server_mem_types_ { - gf_server_mt_server_conf_t = gf_common_mt_end + 1, - gf_server_mt_resolv_comp_t, - gf_server_mt_state_t, - gf_server_mt_locker_t, - gf_server_mt_lock_table_t, - gf_server_mt_conn_t, - gf_server_mt_dirent_rsp_t, - gf_server_mt_rsp_buf_t, - gf_server_mt_volfile_ctx_t, - gf_server_mt_timer_data_t, - gf_server_mt_setvolume_rsp_t, - gf_server_mt_lock_mig_t, - gf_server_mt_compound_rsp_t, - gf_server_mt_child_status, - gf_server_mt_end, + gf_server_mt_server_conf_t = gf_common_mt_end + 1, + gf_server_mt_resolv_comp_t, + gf_server_mt_state_t, + gf_server_mt_locker_t, + gf_server_mt_lock_table_t, + gf_server_mt_conn_t, + gf_server_mt_dirent_rsp_t, + gf_server_mt_rsp_buf_t, + gf_server_mt_volfile_ctx_t, + gf_server_mt_timer_data_t, + gf_server_mt_setvolume_rsp_t, + gf_server_mt_lock_mig_t, + gf_server_mt_compound_rsp_t, + gf_server_mt_child_status, + gf_server_mt_end, }; #endif /* __SERVER_MEM_TYPES_H__ */ diff --git a/xlators/protocol/server/src/server-messages.h b/xlators/protocol/server/src/server-messages.h index f7698806e3c..bc7431b9d86 100644 --- a/xlators/protocol/server/src/server-messages.h +++ b/xlators/protocol/server/src/server-messages.h @@ -23,101 +23,43 @@ * glfs-message-id.h. */ -GLFS_MSGID(PS, - PS_MSG_AUTHENTICATE_ERROR, - PS_MSG_VOL_VALIDATE_FAILED, - PS_MSG_AUTH_INIT_FAILED, - PS_MSG_REMOTE_CLIENT_REFUSED, - PS_MSG_GFID_RESOLVE_FAILED, - PS_MSG_ANONYMOUS_FD_CREATE_FAILED, - PS_MSG_NO_MEMORY, - PS_MSG_FD_NOT_FOUND, - PS_MSG_INVALID_ENTRY, - PS_MSG_GET_UID_FAILED, - PS_MSG_UID_NOT_FOUND, - PS_MSG_MAPPING_ERROR, - PS_MSG_FD_CLEANUP, - PS_MSG_SERVER_CTX_GET_FAILED, - PS_MSG_FDENTRY_NULL, - PS_MSG_DIR_NOT_FOUND, - PS_MSG_SERVER_MSG, - PS_MSG_DICT_SERIALIZE_FAIL, - PS_MSG_RW_STAT, - PS_MSG_DICT_GET_FAILED, - PS_MSG_LOGIN_ERROR, - PS_MSG_REMOUNT_CLIENT_REQD, - PS_MSG_DEFAULTING_FILE, - PS_MSG_VOL_FILE_OPEN_FAILED, - PS_MSG_STAT_ERROR, - PS_MSG_SSL_NAME_SET_FAILED, - PS_MSG_ASPRINTF_FAILED, - PS_MSG_CLIENT_VERSION_NOT_SET, - PS_MSG_CLIENT_ACCEPTED, - PS_MSG_CLIENT_LK_VERSION_ERROR, - PS_MSG_GRACE_TIMER_EXPD, - PS_MSG_SERIALIZE_REPLY_FAILED, - PS_MSG_AUTH_IP_ERROR, - PS_MSG_SKIP_FORMAT_CHK, - PS_MSG_INTERNET_ADDR_ERROR, - PS_MSG_CLIENT_DISCONNECTING, - PS_MSG_GRACE_TIMER_START, - PS_MSG_STATEDUMP_PATH_ERROR, - PS_MSG_GRP_CACHE_ERROR, - PS_MSG_RPC_CONF_ERROR, - PS_MSG_TRANSPORT_ERROR, - PS_MSG_SUBVOL_NULL, - PS_MSG_PARENT_VOL_ERROR, - PS_MSG_RPCSVC_CREATE_FAILED, - PS_MSG_RPCSVC_LISTENER_CREATE_FAILED, - PS_MSG_RPCSVC_NOTIFY, - PS_MSG_PGM_REG_FAILED, - PS_MSG_ULIMIT_SET_FAILED, - PS_MSG_STATFS, - PS_MSG_LOOKUP_INFO, - PS_MSG_LK_INFO, - PS_MSG_LOCK_ERROR, - PS_MSG_INODELK_INFO, - PS_MSG_ENTRYLK_INFO, - PS_MSG_ACCESS_INFO, - PS_MSG_DIR_INFO, - PS_MSG_MKNOD_INFO, - PS_MSG_REMOVEXATTR_INFO, - PS_MSG_GETXATTR_INFO, - PS_MSG_SETXATTR_INFO, - PS_MSG_RENAME_INFO, - PS_MSG_LINK_INFO, - PS_MSG_TRUNCATE_INFO, - PS_MSG_FSTAT_INFO, - PS_MSG_FLUSH_INFO, - PS_MSG_SYNC_INFO, - PS_MSG_WRITE_INFO, - PS_MSG_READ_INFO, - PS_MSG_CHKSUM_INFO, - PS_MSG_OPEN_INFO, - PS_MSG_CREATE_INFO, - PS_MSG_SETATTR_INFO, - PS_MSG_XATTROP_INFO, - PS_MSG_ALLOC_INFO, - PS_MSG_DISCARD_INFO, - PS_MSG_ZEROFILL_INFO, - PS_MSG_FD_CREATE_FAILED, - PS_MSG_WRONG_STATE, - PS_MSG_CONF_DIR_INVALID, - PS_MSG_MOUNT_PT_FAIL, - PS_MSG_STAT_INFO, - PS_MSG_FILE_OP_FAILED, - PS_MSG_GRACE_TIMER_CANCELLED, - PS_MSG_ENCODE_MSG_FAILED, - PS_MSG_REPLY_SUBMIT_FAILED, - PS_MSG_RPC_NOTIFY_ERROR, - PS_MSG_SERVER_EVENT_UPCALL_FAILED, - PS_MSG_SERVER_IPC_INFO, - PS_MSG_SEEK_INFO, - PS_MSG_COMPOUND_INFO, - PS_MSG_CLIENT_OPVERSION_GET_FAILED, - PS_MSG_CHILD_STATUS_FAILED, - PS_MSG_PUT_INFO -); +GLFS_MSGID(PS, PS_MSG_AUTHENTICATE_ERROR, PS_MSG_VOL_VALIDATE_FAILED, + PS_MSG_AUTH_INIT_FAILED, PS_MSG_REMOTE_CLIENT_REFUSED, + PS_MSG_GFID_RESOLVE_FAILED, PS_MSG_ANONYMOUS_FD_CREATE_FAILED, + PS_MSG_NO_MEMORY, PS_MSG_FD_NOT_FOUND, PS_MSG_INVALID_ENTRY, + PS_MSG_GET_UID_FAILED, PS_MSG_UID_NOT_FOUND, PS_MSG_MAPPING_ERROR, + PS_MSG_FD_CLEANUP, PS_MSG_SERVER_CTX_GET_FAILED, PS_MSG_FDENTRY_NULL, + PS_MSG_DIR_NOT_FOUND, PS_MSG_SERVER_MSG, PS_MSG_DICT_SERIALIZE_FAIL, + PS_MSG_RW_STAT, PS_MSG_DICT_GET_FAILED, PS_MSG_LOGIN_ERROR, + PS_MSG_REMOUNT_CLIENT_REQD, PS_MSG_DEFAULTING_FILE, + PS_MSG_VOL_FILE_OPEN_FAILED, PS_MSG_STAT_ERROR, + PS_MSG_SSL_NAME_SET_FAILED, PS_MSG_ASPRINTF_FAILED, + PS_MSG_CLIENT_VERSION_NOT_SET, PS_MSG_CLIENT_ACCEPTED, + PS_MSG_CLIENT_LK_VERSION_ERROR, PS_MSG_GRACE_TIMER_EXPD, + PS_MSG_SERIALIZE_REPLY_FAILED, PS_MSG_AUTH_IP_ERROR, + PS_MSG_SKIP_FORMAT_CHK, PS_MSG_INTERNET_ADDR_ERROR, + PS_MSG_CLIENT_DISCONNECTING, PS_MSG_GRACE_TIMER_START, + PS_MSG_STATEDUMP_PATH_ERROR, PS_MSG_GRP_CACHE_ERROR, + PS_MSG_RPC_CONF_ERROR, PS_MSG_TRANSPORT_ERROR, PS_MSG_SUBVOL_NULL, + PS_MSG_PARENT_VOL_ERROR, PS_MSG_RPCSVC_CREATE_FAILED, + PS_MSG_RPCSVC_LISTENER_CREATE_FAILED, PS_MSG_RPCSVC_NOTIFY, + PS_MSG_PGM_REG_FAILED, PS_MSG_ULIMIT_SET_FAILED, PS_MSG_STATFS, + PS_MSG_LOOKUP_INFO, PS_MSG_LK_INFO, PS_MSG_LOCK_ERROR, + PS_MSG_INODELK_INFO, PS_MSG_ENTRYLK_INFO, PS_MSG_ACCESS_INFO, + PS_MSG_DIR_INFO, PS_MSG_MKNOD_INFO, PS_MSG_REMOVEXATTR_INFO, + PS_MSG_GETXATTR_INFO, PS_MSG_SETXATTR_INFO, PS_MSG_RENAME_INFO, + PS_MSG_LINK_INFO, PS_MSG_TRUNCATE_INFO, PS_MSG_FSTAT_INFO, + PS_MSG_FLUSH_INFO, PS_MSG_SYNC_INFO, PS_MSG_WRITE_INFO, + PS_MSG_READ_INFO, PS_MSG_CHKSUM_INFO, PS_MSG_OPEN_INFO, + PS_MSG_CREATE_INFO, PS_MSG_SETATTR_INFO, PS_MSG_XATTROP_INFO, + PS_MSG_ALLOC_INFO, PS_MSG_DISCARD_INFO, PS_MSG_ZEROFILL_INFO, + PS_MSG_FD_CREATE_FAILED, PS_MSG_WRONG_STATE, PS_MSG_CONF_DIR_INVALID, + PS_MSG_MOUNT_PT_FAIL, PS_MSG_STAT_INFO, PS_MSG_FILE_OP_FAILED, + PS_MSG_GRACE_TIMER_CANCELLED, PS_MSG_ENCODE_MSG_FAILED, + PS_MSG_REPLY_SUBMIT_FAILED, PS_MSG_RPC_NOTIFY_ERROR, + PS_MSG_SERVER_EVENT_UPCALL_FAILED, PS_MSG_SERVER_IPC_INFO, + PS_MSG_SEEK_INFO, PS_MSG_COMPOUND_INFO, + PS_MSG_CLIENT_OPVERSION_GET_FAILED, PS_MSG_CHILD_STATUS_FAILED, + PS_MSG_PUT_INFO); #endif /* !_PS_MESSAGES_H__ */ - diff --git a/xlators/protocol/server/src/server.h b/xlators/protocol/server/src/server.h index 88aaa263018..e6064af076e 100644 --- a/xlators/protocol/server/src/server.h +++ b/xlators/protocol/server/src/server.h @@ -26,237 +26,234 @@ #include "defaults.h" #include "authenticate.h" -#define DEFAULT_BLOCK_SIZE 4194304 /* 4MB */ -#define DEFAULT_VOLUME_FILE_PATH CONFDIR "/glusterfs.vol" -#define GF_MAX_SOCKET_WINDOW_SIZE (1 * GF_UNIT_MB) -#define GF_MIN_SOCKET_WINDOW_SIZE (0) - -#define CPD_REQ_FIELD(v, f) ((v)->compound_req_u.compound_##f##_req) -#define CPD_RSP_FIELD(v, f) ((v)->compound_rsp_u.compound_##f##_rsp) - -#define SERVER_COMMON_RSP_CLEANUP(rsp, fop, i) \ - do { \ - compound_rsp *this_rsp = NULL; \ - this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i];\ - gf_common_rsp *_this_rsp = &CPD_RSP_FIELD(this_rsp, fop); \ - \ - GF_FREE (_this_rsp->xdata.xdata_val); \ - } while (0) - -#define SERVER_FOP_RSP_CLEANUP(rsp, fop, i) \ - do { \ - compound_rsp *this_rsp = NULL; \ - this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i];\ - gfs3_##fop##_rsp *_this_rsp = &CPD_RSP_FIELD(this_rsp, fop); \ - \ - GF_FREE (_this_rsp->xdata.xdata_val); \ - } while (0) - -#define SERVER_COMPOUND_FOP_CLEANUP(curr_req, fop) \ - do { \ - gfs3_##fop##_req *_req = &CPD_REQ_FIELD(curr_req, fop); \ - \ - free (_req->xdata.xdata_val); \ - } while (0) - -#define CPD4_REQ_FIELD(v, f) ((v)->compound_req_v2_u.compound_##f##_req) -#define CPD4_RSP_FIELD(v, f) ((v)->compound_rsp_v2_u.compound_##f##_rsp) - -#define SERVER4_COMMON_RSP_CLEANUP(rsp, fop, i) \ - do { \ - compound_rsp_v2 *this_rsp = NULL; \ - this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i]; \ - gfx_common_rsp *_this_rsp = &CPD4_RSP_FIELD(this_rsp, fop); \ - \ - GF_FREE (_this_rsp->xdata.pairs.pairs_val); \ - } while (0) - -#define SERVER4_FOP_RSP_CLEANUP(rsp, fop, i, rsp_type) \ - do { \ - compound_rsp_v2 *this_rsp = NULL; \ - this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i]; \ - gfx_##rsp_type##_rsp *_this_rsp = &CPD4_RSP_FIELD(this_rsp, fop); \ - \ - GF_FREE (_this_rsp->xdata.pairs.pairs_val); \ - } while (0) - +#define DEFAULT_BLOCK_SIZE 4194304 /* 4MB */ +#define DEFAULT_VOLUME_FILE_PATH CONFDIR "/glusterfs.vol" +#define GF_MAX_SOCKET_WINDOW_SIZE (1 * GF_UNIT_MB) +#define GF_MIN_SOCKET_WINDOW_SIZE (0) + +#define CPD_REQ_FIELD(v, f) ((v)->compound_req_u.compound_##f##_req) +#define CPD_RSP_FIELD(v, f) ((v)->compound_rsp_u.compound_##f##_rsp) + +#define SERVER_COMMON_RSP_CLEANUP(rsp, fop, i) \ + do { \ + compound_rsp *this_rsp = NULL; \ + this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i]; \ + gf_common_rsp *_this_rsp = &CPD_RSP_FIELD(this_rsp, fop); \ + \ + GF_FREE(_this_rsp->xdata.xdata_val); \ + } while (0) + +#define SERVER_FOP_RSP_CLEANUP(rsp, fop, i) \ + do { \ + compound_rsp *this_rsp = NULL; \ + this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i]; \ + gfs3_##fop##_rsp *_this_rsp = &CPD_RSP_FIELD(this_rsp, fop); \ + \ + GF_FREE(_this_rsp->xdata.xdata_val); \ + } while (0) + +#define SERVER_COMPOUND_FOP_CLEANUP(curr_req, fop) \ + do { \ + gfs3_##fop##_req *_req = &CPD_REQ_FIELD(curr_req, fop); \ + \ + free(_req->xdata.xdata_val); \ + } while (0) + +#define CPD4_REQ_FIELD(v, f) ((v)->compound_req_v2_u.compound_##f##_req) +#define CPD4_RSP_FIELD(v, f) ((v)->compound_rsp_v2_u.compound_##f##_rsp) + +#define SERVER4_COMMON_RSP_CLEANUP(rsp, fop, i) \ + do { \ + compound_rsp_v2 *this_rsp = NULL; \ + this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i]; \ + gfx_common_rsp *_this_rsp = &CPD4_RSP_FIELD(this_rsp, fop); \ + \ + GF_FREE(_this_rsp->xdata.pairs.pairs_val); \ + } while (0) + +#define SERVER4_FOP_RSP_CLEANUP(rsp, fop, i, rsp_type) \ + do { \ + compound_rsp_v2 *this_rsp = NULL; \ + this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i]; \ + gfx_##rsp_type##_rsp *_this_rsp = &CPD4_RSP_FIELD(this_rsp, fop); \ + \ + GF_FREE(_this_rsp->xdata.pairs.pairs_val); \ + } while (0) typedef enum { - INTERNAL_LOCKS = 1, - POSIX_LOCKS = 2, + INTERNAL_LOCKS = 1, + POSIX_LOCKS = 2, } server_lock_flags_t; typedef struct _server_state server_state_t; -int server_null (rpcsvc_request_t *req); +int +server_null(rpcsvc_request_t *req); struct _volfile_ctx { - struct _volfile_ctx *next; - char *key; - uint32_t checksum; + struct _volfile_ctx *next; + char *key; + uint32_t checksum; }; struct _child_status { - struct list_head status_list; - char *name; - gf_boolean_t child_up; - gf_atomic_t xprtrefcnt; + struct list_head status_list; + char *name; + gf_boolean_t child_up; + gf_atomic_t xprtrefcnt; }; struct server_conf { - rpcsvc_t *rpc; - struct rpcsvc_config rpc_conf; - int inode_lru_limit; - gf_boolean_t verify_volfile; - gf_boolean_t trace; - char *conf_dir; - struct _volfile_ctx *volfile; - dict_t *auth_modules; - pthread_mutex_t mutex; - struct list_head xprt_list; - pthread_t barrier_th; - - gf_boolean_t server_manage_gids; /* resolve gids on brick */ - gid_cache_t gid_cache; - int32_t gid_cache_timeout; - - int event_threads; /* # of event threads - * configured */ - - gf_boolean_t parent_up; - gf_boolean_t dync_auth; /* if set authenticate dynamically, - * in case if volume set options - * (say *.allow | *.reject) are - * tweeked */ - struct _child_status *child_status; - gf_lock_t itable_lock; - gf_boolean_t strict_auth_enabled; + rpcsvc_t *rpc; + struct rpcsvc_config rpc_conf; + int inode_lru_limit; + gf_boolean_t verify_volfile; + gf_boolean_t trace; + char *conf_dir; + struct _volfile_ctx *volfile; + dict_t *auth_modules; + pthread_mutex_t mutex; + struct list_head xprt_list; + pthread_t barrier_th; + + gf_boolean_t server_manage_gids; /* resolve gids on brick */ + gid_cache_t gid_cache; + int32_t gid_cache_timeout; + + int event_threads; /* # of event threads + * configured */ + + gf_boolean_t parent_up; + gf_boolean_t dync_auth; /* if set authenticate dynamically, + * in case if volume set options + * (say *.allow | *.reject) are + * tweeked */ + struct _child_status *child_status; + gf_lock_t itable_lock; + gf_boolean_t strict_auth_enabled; }; typedef struct server_conf server_conf_t; - typedef enum { - RESOLVE_MUST = 1, - RESOLVE_NOT, - RESOLVE_MAY, - RESOLVE_DONTCARE, - RESOLVE_EXACT + RESOLVE_MUST = 1, + RESOLVE_NOT, + RESOLVE_MAY, + RESOLVE_DONTCARE, + RESOLVE_EXACT } server_resolve_type_t; - struct resolve_comp { - char *basename; - inode_t *inode; + char *basename; + inode_t *inode; }; typedef struct { - server_resolve_type_t type; - int64_t fd_no; - u_char gfid[16]; - u_char pargfid[16]; - char *path; - char *bname; - int op_ret; - int op_errno; - loc_t resolve_loc; + server_resolve_type_t type; + int64_t fd_no; + u_char gfid[16]; + u_char pargfid[16]; + char *path; + char *bname; + int op_ret; + int op_errno; + loc_t resolve_loc; } server_resolve_t; - -typedef int (*server_resume_fn_t) (call_frame_t *frame, xlator_t *bound_xl); +typedef int (*server_resume_fn_t)(call_frame_t *frame, xlator_t *bound_xl); int -resolve_and_resume (call_frame_t *frame, server_resume_fn_t fn); +resolve_and_resume(call_frame_t *frame, server_resume_fn_t fn); struct _server_state { - rpc_transport_t *xprt; - inode_table_t *itable; - - server_resume_fn_t resume_fn; - - loc_t loc; - loc_t loc2; - server_resolve_t resolve; - server_resolve_t resolve2; - - /* used within resolve_and_resume */ - loc_t *loc_now; - server_resolve_t *resolve_now; - - struct iatt stbuf; - int valid; - - fd_t *fd; - dict_t *params; - int32_t flags; - int wbflags; - struct iovec payload_vector[MAX_IOVEC]; - int payload_count; - struct iobuf *iobuf; - struct iobref *iobref; - - size_t size; - off_t offset; - mode_t mode; - dev_t dev; - size_t nr_count; - int cmd; - int type; - char *name; - int name_len; - - int mask; - char is_revalidate; - dict_t *dict; - struct gf_flock flock; - const char *volume; - dir_entry_t *entry; - gf_seek_what_t what; - - dict_t *xdata; - mode_t umask; - struct gf_lease lease; - lock_migration_info_t locklist; - /* required for compound fops */ - gfs3_compound_req req; - /* TODO: having xdr definition here - is not a good idea, but not taking - up the functionality right now */ - gfx_compound_req req_v2; - - /* last length till which iovec for compound - * writes was processed */ - int write_length; - struct iovec rsp_vector[MAX_IOVEC]; - int rsp_count; - struct iobuf *rsp_iobuf; - struct iobref *rsp_iobref; - compound_args_t *args; - - /* subdir mount */ - client_t *client; + rpc_transport_t *xprt; + inode_table_t *itable; + + server_resume_fn_t resume_fn; + + loc_t loc; + loc_t loc2; + server_resolve_t resolve; + server_resolve_t resolve2; + + /* used within resolve_and_resume */ + loc_t *loc_now; + server_resolve_t *resolve_now; + + struct iatt stbuf; + int valid; + + fd_t *fd; + dict_t *params; + int32_t flags; + int wbflags; + struct iovec payload_vector[MAX_IOVEC]; + int payload_count; + struct iobuf *iobuf; + struct iobref *iobref; + + size_t size; + off_t offset; + mode_t mode; + dev_t dev; + size_t nr_count; + int cmd; + int type; + char *name; + int name_len; + + int mask; + char is_revalidate; + dict_t *dict; + struct gf_flock flock; + const char *volume; + dir_entry_t *entry; + gf_seek_what_t what; + + dict_t *xdata; + mode_t umask; + struct gf_lease lease; + lock_migration_info_t locklist; + /* required for compound fops */ + gfs3_compound_req req; + /* TODO: having xdr definition here + is not a good idea, but not taking + up the functionality right now */ + gfx_compound_req req_v2; + + /* last length till which iovec for compound + * writes was processed */ + int write_length; + struct iovec rsp_vector[MAX_IOVEC]; + int rsp_count; + struct iobuf *rsp_iobuf; + struct iobref *rsp_iobref; + compound_args_t *args; + + /* subdir mount */ + client_t *client; }; - extern struct rpcsvc_program gluster_handshake_prog; extern struct rpcsvc_program glusterfs3_3_fop_prog; extern struct rpcsvc_program glusterfs4_0_fop_prog; typedef struct _server_ctx { - gf_lock_t fdtable_lock; - fdtable_t *fdtable; + gf_lock_t fdtable_lock; + fdtable_t *fdtable; } server_ctx_t; - int -server_submit_reply (call_frame_t *frame, rpcsvc_request_t *req, void *arg, - struct iovec *payload, int payloadcount, - struct iobref *iobref, xdrproc_t xdrproc); +server_submit_reply(call_frame_t *frame, rpcsvc_request_t *req, void *arg, + struct iovec *payload, int payloadcount, + struct iobref *iobref, xdrproc_t xdrproc); -int gf_server_check_setxattr_cmd (call_frame_t *frame, dict_t *dict); -int gf_server_check_getxattr_cmd (call_frame_t *frame, const char *name); +int +gf_server_check_setxattr_cmd(call_frame_t *frame, dict_t *dict); +int +gf_server_check_getxattr_cmd(call_frame_t *frame, const char *name); void -forget_inode_if_no_dentry (inode_t *inode); +forget_inode_if_no_dentry(inode_t *inode); -server_ctx_t* -server_ctx_get (client_t *client, xlator_t *xlator); +server_ctx_t * +server_ctx_get(client_t *client, xlator_t *xlator); #endif /* !_SERVER_H */ |