Changeset 8397 for branches/cu-security-branch/src/common/misc
- Timestamp:
- 06/18/10 20:02:50 (3 years ago)
- Location:
- branches/cu-security-branch
- Files:
-
- 21 modified
-
. (modified) (1 prop)
-
src/common/misc (modified) (1 prop)
-
src/common/misc/mkspace.c (modified) (9 diffs)
-
src/common/misc/mkspace.h (modified) (2 diffs)
-
src/common/misc/msgpairarray.h (modified) (1 diff)
-
src/common/misc/msgpairarray.sm (modified) (10 diffs)
-
src/common/misc/pint-cached-config.c (modified) (1 diff)
-
src/common/misc/pint-cached-config.h (modified) (1 diff)
-
src/common/misc/pint-event.c (modified) (4 diffs)
-
src/common/misc/pint-event.h (modified) (2 diffs)
-
src/common/misc/pint-hint.c (modified) (1 diff)
-
src/common/misc/pint-mem.c (modified) (2 diffs)
-
src/common/misc/pint-util.c (modified) (4 diffs)
-
src/common/misc/pvfs2-debug.c (modified) (1 diff)
-
src/common/misc/pvfs2-internal.h (modified) (1 diff)
-
src/common/misc/pvfs2-util.c (modified) (5 diffs)
-
src/common/misc/server-config.c (modified) (20 diffs)
-
src/common/misc/server-config.h (modified) (3 diffs)
-
src/common/misc/state-machine-fns.c (modified) (1 diff)
-
src/common/misc/state-machine.h (modified) (2 diffs)
-
src/common/misc/str-utils.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/cu-security-branch
- Property svn:ignore
-
old new 3 3 aclocal.m4 4 4 autom4te.cache 5 config.status6 Makefile7 pvfs2-config.h8 module.mk
-
- Property svn:ignore
-
branches/cu-security-branch/src/common/misc
- Property svn:ignore deleted
-
branches/cu-security-branch/src/common/misc/mkspace.c
r7941 r8397 112 112 113 113 int pvfs2_mkspace( 114 char *storage_space, 114 char *data_path, 115 char *meta_path, 115 116 char *collection, 116 117 TROVE_coll_id coll_id, … … 135 136 TROVE_handle lost_and_found_dirdata_handle = TROVE_HANDLE_NULL; 136 137 137 mkspace_print(verbose,"Storage space: %s\n",storage_space); 138 mkspace_print(verbose,"Data storage space : %s\n",data_path); 139 mkspace_print(verbose,"Metadata storage space : %s\n", meta_path); 138 140 mkspace_print(verbose,"Collection : %s\n",collection); 139 141 mkspace_print(verbose,"ID : %d\n",coll_id); … … 160 162 ret = trove_initialize(TROVE_METHOD_DBPF, 161 163 NULL, 162 storage_space, 164 data_path, 165 meta_path, 163 166 0); 164 167 if (ret > -1) 165 168 { 166 gossip_err("error: storage space %s already "167 "exists; aborting!\n", storage_space);168 return -1; 169 } 170 171 ret = trove_storage_create(TROVE_METHOD_DBPF, storage_space, NULL, &op_id);169 gossip_err("error: storage space %s or %s already " 170 "exists; aborting!\n",data_path,meta_path); 171 return -1; 172 } 173 174 ret = trove_storage_create(TROVE_METHOD_DBPF, data_path, meta_path, NULL, &op_id); 172 175 if (ret != 1) 173 176 { … … 180 183 ret = trove_initialize( 181 184 TROVE_METHOD_DBPF, NULL, 182 storage_space, 0);185 data_path, meta_path, 0); 183 186 if (ret < 0) 184 187 { … … 187 190 } 188 191 189 mkspace_print(verbose,"info: created storage space '%s'.\n", 190 storage_space); 192 mkspace_print(verbose,"info: created data storage space '%s'.\n", 193 data_path); 194 mkspace_print(verbose,"info: created metadata storage space '%s'.\n", 195 meta_path); 191 196 192 197 /* try to look up collection used to store file system */ … … 637 642 638 643 int pvfs2_rmspace( 639 char *storage_space, 644 char *data_path, 645 char *meta_path, 640 646 char *collection, 641 647 TROVE_coll_id coll_id, … … 652 658 ret = trove_initialize( 653 659 TROVE_METHOD_DBPF, NULL, 654 storage_space, 0);660 data_path, meta_path, 0); 655 661 if (ret == -1) 656 662 { 657 gossip_err("error: storage space %s does not "658 "exist; aborting!\n", storage_space);663 gossip_err("error: storage space %s or %s does not " 664 "exist; aborting!\n", data_path, meta_path); 659 665 return -1; 660 666 } … … 674 680 if (!remove_collection_only) 675 681 { 676 ret = trove_storage_remove( 677 TROVE_METHOD_DBPF, storage_space,NULL, &op_id);682 ret = trove_storage_remove(TROVE_METHOD_DBPF, data_path, meta_path, 683 NULL, &op_id); 678 684 /* 679 685 * it is a bit weird to do a trove_finaliz() prior to blowing away … … 683 689 trove_finalize(TROVE_METHOD_DBPF); 684 690 mkspace_print( 685 verbose, "PVFS2 Storage Space %s removed %s\n",686 storage_space, (((ret == 1) || (ret == -TROVE_ENOENT)) ?691 verbose, "PVFS2 Storage Space %s and %s removed %s\n", 692 data_path, meta_path, (((ret == 1) || (ret == -TROVE_ENOENT)) ? 687 693 "successfully" : "with errors")); 688 694 -
branches/cu-security-branch/src/common/misc/mkspace.h
r3805 r8397 14 14 15 15 int pvfs2_mkspace( 16 char *storage_space, 16 char *data_path, 17 char *meta_path, 17 18 char *collection, 18 19 TROVE_coll_id coll_id, … … 24 25 25 26 int pvfs2_rmspace( 26 char *storage_space, 27 char *data_path, 28 char *meta_path, 27 29 char *collection, 28 30 TROVE_coll_id coll_id, -
branches/cu-security-branch/src/common/misc/msgpairarray.h
r8330 r8397 49 49 /* server address */ 50 50 PVFS_BMI_addr_t svr_addr; 51 52 /*session identifier between send and rcvs*/ 53 /*note: server-side i/o machine uses the session_tag as the flow */ 54 /*descriptor tag. */ 55 bmi_msg_tag_t session_tag; 51 56 52 57 /* req and encoded_req are used to send a request */ -
branches/cu-security-branch/src/common/misc/msgpairarray.sm
r8330 r8397 95 95 PINT_sm_msgpair_state *msg_p = NULL; 96 96 97 gossip_debug(GOSSIP_MIRROR_DEBUG,"Executing msgpairarray_init...\n"); 98 gossip_debug(GOSSIP_MIRROR_DEBUG,"\tbase frame:%d\tframe count:%d\n" 99 ,smcb->base_frame,smcb->frame_count); 100 97 101 gossip_debug(GOSSIP_MSGPAIR_DEBUG, "(%p) msgpairarray state: init " 98 102 "(%d msgpair(s))\n", smcb, mop->count); … … 116 120 msg_p->retry_count = 0; 117 121 msg_p->complete = 0; 122 118 123 } 119 124 return SM_ACTION_COMPLETE; … … 233 238 PINT_ENCODE_RESP, msg_p->req.op, msg_p->enc_type); 234 239 240 235 241 msg_p->encoded_resp_p = BMI_memalloc( 236 242 msg_p->svr_addr, msg_p->max_resp_sz, BMI_RECV); … … 245 251 246 252 session_tag = PINT_util_get_next_tag(); 253 254 /*store the session tag for this msgpair, so the msgpair completion */ 255 /*function can pass it to the caller of msgpairarray. */ 256 msg_p->session_tag = session_tag; 247 257 248 258 gossip_debug(GOSSIP_MSGPAIR_DEBUG, "%s: sm %p msgpair %d: " … … 301 311 { 302 312 PINT_encode_release(&msg_p->encoded_req, PINT_ENCODE_REQ); 313 memset(&msg_p->encoded_req,0,sizeof(msg_p->encoded_req)); 303 314 BMI_memfree(msg_p->svr_addr,msg_p->encoded_resp_p, 304 315 msg_p->max_resp_sz, BMI_RECV); … … 489 500 gossip_debug(GOSSIP_MSGPAIR_DEBUG, "(%p) msgpairarray state: " 490 501 "completion_fn\n", smcb); 502 gossip_debug(GOSSIP_MIRROR_DEBUG,"Executing msgpairarray_completion_fn..\n"); 491 503 492 504 for (i = 0; i < mop->count; i++) … … 546 558 if (msg_p->comp_fn != NULL) 547 559 { 560 gossip_debug(GOSSIP_MIRROR_DEBUG,"\texecuting msg_p->comp_fn..\n"); 548 561 /* If we call the completion function, store the result on 549 562 * a per message pair basis. Also store some non-zero … … 590 603 } 591 604 605 memset(&msg_p->encoded_req,0,sizeof(msg_p->encoded_req)); 592 606 msg_p->encoded_resp_p = NULL; 593 607 msg_p->max_resp_sz = 0; … … 601 615 gossip_debug(GOSSIP_MSGPAIR_DEBUG, "%s: sm %p msgpair %d " 602 616 "marked complete\n", __func__, smcb, i); 603 } 617 }/*end for*/ 604 618 605 619 if (need_retry) { … … 783 797 { 784 798 PINT_encode_release(encoded_req_p, PINT_ENCODE_REQ); 799 memset(encoded_req_p,0,sizeof(*encoded_req_p)); 785 800 786 801 PINT_decode_release(decoded_resp_p, PINT_DECODE_RESP); 802 memset(decoded_resp_p,0,sizeof(*decoded_resp_p)); 787 803 788 804 BMI_memfree(*svr_addr_p, encoded_resp_p, max_resp_sz, BMI_RECV); 805 encoded_resp_p = NULL; 789 806 790 807 ret = 0; -
branches/cu-security-branch/src/common/misc/pint-cached-config.c
r8330 r8397 1788 1788 } 1789 1789 1790 /* PINT_cached_config_server_names() 1791 * 1792 * Returns a list of pointers to the IO server names currently running in this 1793 * file system. 1794 * 1795 * returns 0 on success, -PVFS_error on failure 1796 */ 1797 int PINT_cached_config_io_server_names( char ***list 1798 , int *size 1799 , PVFS_fs_id fsid) 1800 { 1801 int i; 1802 struct qlist_head *hash_link = NULL; 1803 struct config_fs_cache_s *cur_config_cache = NULL; 1804 1805 assert(PINT_fsid_config_cache_table); 1806 1807 hash_link = qhash_search(PINT_fsid_config_cache_table,&(fsid)); 1808 if(!hash_link) 1809 { 1810 return(-PVFS_ENOENT); 1811 } 1812 1813 cur_config_cache = qlist_entry( 1814 hash_link, struct config_fs_cache_s, hash_link); 1815 1816 assert(cur_config_cache); 1817 1818 *size = cur_config_cache->io_server_count; 1819 1820 *list = malloc(sizeof(char *) * (*size)); 1821 1822 if (! (*list) ) 1823 return(-PVFS_ENOMEM); 1824 1825 memset(*list,0,sizeof(char *) * (*size)); 1826 1827 for (i=0; i<(*size); i++) 1828 { 1829 /*addr_string originates from the alias mapping->bmi_address*/ 1830 (*list)[i] = cur_config_cache->io_server_array[i].addr_string; 1831 } 1832 1833 return(0); 1834 } 1835 1790 1836 /* 1791 1837 * Local variables: -
branches/cu-security-branch/src/common/misc/pint-cached-config.h
r8330 r8397 136 136 struct server_configuration_s *config); 137 137 138 int PINT_cached_config_io_server_names( 139 char ***list, 140 int *size, 141 PVFS_fs_id fsid); 142 138 143 #endif /* __PINT_CACHED_CONFIG_H */ 139 144 -
branches/cu-security-branch/src/common/misc/pint-event.c
r7941 r8397 67 67 static void PINT_event_tau_thread_init(char* gname); 68 68 static void PINT_event_tau_thread_fini(void); 69 static void PINT_event_free( struct PINT_event *p ); 70 static void PINT_group_free( strcut PINT_group *g ); 69 71 70 72 #endif /* HAVE_TAU */ 73 74 static void PINT_event_free( struct PINT_event *p ) 75 { 76 if( p != NULL ) 77 { 78 if( p->name != NULL ) 79 { 80 free( p->name ); 81 } 82 free( p ); 83 } 84 return; 85 } 86 87 static void PINT_group_free( struct PINT_group *g ) 88 { 89 if( g != NULL ) 90 { 91 if( g->name != NULL ) 92 { 93 free( g->name ); 94 } 95 free( g ); 96 } 97 return; 98 } 99 71 100 72 101 static int PINT_group_compare(void *key, struct qhash_head *link) … … 105 134 if(!groups_table) 106 135 { 107 qhash_finalize(events_table); 136 qhash_destroy_and_finalize( events_table, struct PINT_event, link, 137 PINT_event_free); 108 138 return -PVFS_ENOMEM; 109 139 } … … 112 142 if(ret < 0) 113 143 { 114 qhash_finalize(events_table); 115 qhash_finalize(groups_table); 144 qhash_destroy_and_finalize( groups_table, struct PINT_group, link, 145 PINT_group_free ); 146 qhash_destroy_and_finalize( events_table, struct PINT_event, link, 147 PINT_event_free); 148 116 149 return ret; 117 150 } … … 131 164 } 132 165 166 void PINT_event_free_bucket_resources(struct qhash_table *qht, unsigned long distance_from_link) 167 { 168 char **name = NULL; 169 char *start_of_structure = NULL; 170 struct qhash_head *bucket_entry = NULL; 171 struct qhash_head *bucket = NULL; 172 struct qhash_head *next = NULL; 173 int i; 174 175 for (i=0; i<qht->table_size; i++) 176 { 177 bucket = &(qht->array[i]); 178 if (bucket==bucket->next && bucket==bucket->prev) 179 continue; //this bucket is empty 180 181 /*for each entry, deallocate the name string and the entry structure*/ 182 for (bucket_entry=bucket->next; bucket_entry != bucket; bucket_entry = next) 183 { 184 start_of_structure = (char *)((char *)bucket_entry - distance_from_link); 185 name = (char **)start_of_structure; 186 if (*name) 187 { 188 free(*name); 189 *name=NULL; 190 } 191 name=NULL; 192 193 next = bucket_entry->next; 194 free(start_of_structure); 195 start_of_structure=NULL; 196 }/*end for*/ 197 198 199 } /*end for*/ 200 201 return; 202 } 203 204 133 205 void PINT_event_finalize(void) 134 206 { 135 136 207 #if defined(HAVE_TAU) 137 208 PINT_event_tau_fini(); 138 209 #endif 139 210 140 qhash_finalize(groups_table); 141 qhash_finalize(events_table); 211 /*free the buckets in the tables and the tables themselves*/ 212 /* need to free contents as well */ 213 qhash_destroy_and_finalize( groups_table, struct PINT_group, link, 214 PINT_group_free ); 215 qhash_destroy_and_finalize( events_table, struct PINT_event, link, 216 PINT_event_free); 142 217 return; 143 218 } -
branches/cu-security-branch/src/common/misc/pint-event.h
r7941 r8397 9 9 10 10 #include "pvfs2-types.h" 11 #include "quickhash.h" 11 12 12 13 typedef PVFS_id_gen_t PINT_event_type; … … 31 32 32 33 void PINT_event_finalize(void); 34 void PINT_event_free_bucket_resources(struct qhash_table *qt 35 ,unsigned long distance_from_link); 33 36 34 37 int PINT_event_enable(const char *events); -
branches/cu-security-branch/src/common/misc/pint-hint.c
r7941 r8397 565 565 while(h) 566 566 { 567 if(!strcmp(h int->type_string, name))567 if(!strcmp(h->type_string, name)) 568 568 { 569 569 if(length) -
branches/cu-security-branch/src/common/misc/pint-mem.c
r7941 r8397 8 8 #include <errno.h> 9 9 #include <stdlib.h> 10 #include <string.h> 10 11 #ifdef HAVE_MALLOC_H 11 12 #include <malloc.h> 12 13 #endif 13 14 14 #include "pint-mem.h" 15 /* prototype definitions */ 16 inline void* PINT_mem_aligned_alloc(size_t size, size_t alignment); 17 inline void PINT_mem_aligned_free(void *ptr); 15 18 16 19 /* PINT_mem_aligned_alloc() … … 33 36 return NULL; 34 37 } 38 memset(ptr, 0, size); 35 39 return ptr; 36 40 } -
branches/cu-security-branch/src/common/misc/pint-util.c
r7941 r8397 154 154 if (dest->u.dir.hint.dist_params_len > 0) 155 155 { 156 dest->u.dir.hint.dist_params = strdup(src->u.dir.hint.dist_params); 156 dest->u.dir.hint.dist_params 157 = strdup(src->u.dir.hint.dist_params); 157 158 if (dest->u.dir.hint.dist_params == NULL) 158 159 { … … 219 220 } 220 221 222 if(src->mask & PVFS_ATTR_META_MIRROR_DFILES) 223 { 224 PVFS_size df_array_size = src->u.meta.dfile_count * 225 src->u.meta.mirror_copies_count * 226 sizeof(PVFS_handle); 227 228 if (df_array_size) 229 { 230 if ( (dest->mask & PVFS_ATTR_META_MIRROR_DFILES) 231 && (dest->u.meta.dfile_count > 0) 232 && (dest->u.meta.mirror_copies_count > 0) ) 233 { 234 if (dest->u.meta.mirror_dfile_array) 235 { 236 free(dest->u.meta.mirror_dfile_array); 237 dest->u.meta.mirror_dfile_array = NULL; 238 } 239 } 240 dest->u.meta.mirror_dfile_array = malloc(df_array_size); 241 if (!dest->u.meta.mirror_dfile_array) 242 { 243 return ret; 244 } 245 memcpy(dest->u.meta.mirror_dfile_array, 246 src->u.meta.mirror_dfile_array, df_array_size); 247 } 248 else 249 { 250 dest->u.meta.mirror_dfile_array = NULL; 251 } 252 dest->u.meta.mirror_copies_count 253 = src->u.meta.mirror_copies_count; 254 } 255 256 221 257 if(src->mask & PVFS_ATTR_META_DIST) 222 258 { … … 284 320 } 285 321 } 322 if (attr->mask & PVFS_ATTR_META_MIRROR_DFILES) 323 { 324 if (attr->u.meta.mirror_dfile_array) 325 { 326 free(attr->u.meta.mirror_dfile_array); 327 attr->u.meta.mirror_dfile_array = NULL; 328 } 329 } 286 330 if (attr->mask & PVFS_ATTR_META_DIST) 287 331 { … … 307 351 else if (attr->objtype == PVFS_TYPE_DIRECTORY) 308 352 { 309 if ((attr->mask & PVFS_ATTR_DIR_HINT) || (attr->mask & PVFS_ATTR_DIR_DIRENT_COUNT)) 353 if ((attr->mask & PVFS_ATTR_DIR_HINT) || 354 (attr->mask & PVFS_ATTR_DIR_DIRENT_COUNT)) 310 355 { 311 356 if (attr->u.dir.hint.dist_name) -
branches/cu-security-branch/src/common/misc/pvfs2-debug.c
r8332 r8397 11 11 12 12 #include "pvfs2-debug.h" 13 14 /* a private internal type */15 typedef struct16 {17 const char *keyword;18 uint64_t mask_val;19 } __keyword_mask_t;20 21 #define __DEBUG_ALL ((uint64_t) -1)22 23 /* map all config keywords to pvfs2 debug masks here */24 static __keyword_mask_t s_keyword_mask_map[] =25 {26 /* Log trove debugging info. Same as 'trove'.*/27 { "storage", GOSSIP_TROVE_DEBUG },28 /* Log trove debugging info. Same as 'storage'. */29 { "trove", GOSSIP_TROVE_DEBUG },30 /* Log trove operations. */31 { "trove_op", GOSSIP_TROVE_OP_DEBUG },32 /* Log network debug info. */33 { "network", GOSSIP_BMI_DEBUG_ALL },34 /* Log server info, including new operations. */35 { "server", GOSSIP_SERVER_DEBUG },36 /* Log client sysint info. This is only useful for the client. */37 { "client", GOSSIP_CLIENT_DEBUG },38 /* Debug the varstrip distribution */39 { "varstrip", GOSSIP_VARSTRIP_DEBUG },40 /* Log job info */41 { "job", GOSSIP_JOB_DEBUG },42 /* Debug PINT_process_request calls. EXTREMELY verbose! */43 { "request", GOSSIP_REQUEST_DEBUG },44 /* Log request scheduler events */45 { "reqsched", GOSSIP_REQ_SCHED_DEBUG },46 /* Log the flow protocol events, including flowproto_multiqueue */47 { "flowproto", GOSSIP_FLOW_PROTO_DEBUG },48 /* Log flow calls */49 { "flow", GOSSIP_FLOW_DEBUG },50 /* Debug the client name cache. Only useful on the client. */51 { "ncache", GOSSIP_NCACHE_DEBUG },52 /* Debug read-ahead cache events. Only useful on the client. */53 { "mmaprcache", GOSSIP_MMAP_RCACHE_DEBUG },54 /* Debug the attribute cache. Only useful on the client. */55 { "acache", GOSSIP_ACACHE_DEBUG },56 /* Log/Debug distribution calls */57 { "distribution", GOSSIP_DIST_DEBUG },58 /* Debug the server-side dbpf attribute cache */59 { "dbpfattrcache", GOSSIP_DBPF_ATTRCACHE_DEBUG },60 /* Debug the client lookup state machine. */61 { "lookup", GOSSIP_LOOKUP_DEBUG },62 /* Debug the client remove state macine. */63 { "remove", GOSSIP_REMOVE_DEBUG },64 /* Debug the server getattr state machine. */65 { "getattr", GOSSIP_GETATTR_DEBUG },66 /* Debug the server setattr state machine. */67 { "setattr", GOSSIP_SETATTR_DEBUG },68 /* vectored getattr server state machine */69 { "listattr", GOSSIP_LISTATTR_DEBUG },70 /* Debug the client and server get ext attributes SM. */71 { "geteattr", GOSSIP_GETEATTR_DEBUG },72 /* Debug the client and server set ext attributes SM. */73 { "seteattr", GOSSIP_SETEATTR_DEBUG },74 /* Debug the readdir operation (client and server) */75 { "readdir", GOSSIP_READDIR_DEBUG },76 /* Debug the mkdir operation (server only) */77 { "mkdir", GOSSIP_MKDIR_DEBUG },78 /* Debug the io operation (reads and writes)79 * for both the client and server */80 { "io", GOSSIP_IO_DEBUG },81 /* Debug the server's open file descriptor cache */82 { "open_cache", GOSSIP_DBPF_OPEN_CACHE_DEBUG },83 /* Debug permissions checking on the server */84 { "permissions", GOSSIP_PERMISSIONS_DEBUG },85 /* Debug the cancel operation */86 { "cancel", GOSSIP_CANCEL_DEBUG },87 /* Debug the msgpair state machine */88 { "msgpair", GOSSIP_MSGPAIR_DEBUG },89 /* Debug the client core app */90 { "clientcore", GOSSIP_CLIENTCORE_DEBUG },91 /* Debug the client timing state machines (job timeout, etc.) */92 { "clientcore_timing", GOSSIP_CLIENTCORE_TIMING_DEBUG },93 /* network encoding */94 { "endecode", GOSSIP_ENDECODE_DEBUG },95 /* Show server file (metadata) accesses (both modify and read-only). */96 { "access", GOSSIP_ACCESS_DEBUG },97 /* Show more detailed server file accesses */98 { "access_detail", GOSSIP_ACCESS_DETAIL_DEBUG },99 /* Debug the listeattr operation */100 { "listeattr", GOSSIP_LISTEATTR_DEBUG },101 /* Debug the state machine management code */102 { "sm", GOSSIP_STATE_MACHINE_DEBUG },103 /* Debug the metadata dbpf keyval functions */104 { "keyval", GOSSIP_DBPF_KEYVAL_DEBUG },105 /* Debug the metadata sync coalescing code */106 { "coalesce", GOSSIP_DBPF_COALESCE_DEBUG },107 /* Display the hostnames instead of IP addrs in debug output */108 { "access_hostnames", GOSSIP_ACCESS_HOSTNAMES },109 /* Show the client device events */110 { "user_dev", GOSSIP_USER_DEV_DEBUG },111 /* Debug security module */112 { "security", GOSSIP_SECURITY_DEBUG },113 /* Debug the fsck tool */114 { "fsck", GOSSIP_FSCK_DEBUG },115 /* Debug the bstream code */116 { "bstream", GOSSIP_BSTREAM_DEBUG },117 /* Debug trove in direct io mode */118 {"directio", GOSSIP_DIRECTIO_DEBUG},119 /* Everything except the periodic events. Useful for debugging */120 { "verbose",121 (__DEBUG_ALL & ~(GOSSIP_PERFCOUNTER_DEBUG | GOSSIP_STATE_MACHINE_DEBUG |122 GOSSIP_ENDECODE_DEBUG | GOSSIP_USER_DEV_DEBUG))123 },124 /* No debug output */125 { "none", GOSSIP_NO_DEBUG },126 /* Everything */127 { "all", __DEBUG_ALL }128 };129 #undef __DEBUG_ALL130 131 static const int num_keyword_mask_map = (int) \132 (sizeof(s_keyword_mask_map) / sizeof(__keyword_mask_t));133 134 /* map all kmod keywords to kmod debug masks here */135 static __keyword_mask_t s_kmod_keyword_mask_map[] =136 {137 {"super" , GOSSIP_SUPER_DEBUG},138 {"inode" , GOSSIP_INODE_DEBUG},139 {"file" , GOSSIP_FILE_DEBUG},140 {"dir" , GOSSIP_DIR_DEBUG},141 {"utils" , GOSSIP_UTILS_DEBUG},142 {"wait" , GOSSIP_WAIT_DEBUG},143 {"acl" , GOSSIP_ACL_DEBUG},144 {"dcache", GOSSIP_DCACHE_DEBUG},145 {"dev" , GOSSIP_DEV_DEBUG},146 {"name" , GOSSIP_NAME_DEBUG},147 {"bufmap", GOSSIP_BUFMAP_DEBUG},148 {"cache" , GOSSIP_CACHE_DEBUG},149 {"proc" , GOSSIP_PROC_DEBUG},150 {"xattr" , GOSSIP_XATTR_DEBUG},151 {"init" , GOSSIP_INIT_DEBUG},152 {"none" , GOSSIP_NO_DEBUG},153 {"all" , GOSSIP_MAX_DEBUG}154 };155 156 static const int num_kmod_keyword_mask_map = (int) \157 (sizeof(s_kmod_keyword_mask_map) / sizeof(__keyword_mask_t));158 13 159 14 static uint64_t debug_to_mask(__keyword_mask_t *mask_map, -
branches/cu-security-branch/src/common/misc/pvfs2-internal.h
r8330 r8397 94 94 #define SPECIAL_METAFILE_HINT_KEYSTR "meta_hint\0" 95 95 #define SPECIAL_METAFILE_HINT_KEYLEN 21 96 #define SPECIAL_MIRROR_PARAMS_KEYSTR "mirror\0" 97 #define SPECIAL_MIRROR_PARAMS_KEYLEN 18 98 #define SPECIAL_MIRROR_COPIES_KEYSTR "mirror.copies\0" 99 #define SPECIAL_MIRROR_COPIES_KEYLEN 25 100 #define SPECIAL_MIRROR_HANDLES_KEYSTR "mirror.handles\0" 101 #define SPECIAL_MIRROR_HANDLES_KEYLEN 26 102 #define SPECIAL_MIRROR_STATUS_KEYSTR "mirror.status\0" 103 #define SPECIAL_MIRROR_STATUS_KEYLEN 25 104 96 105 97 106 #define IO_MAX_REGIONS 64 -
branches/cu-security-branch/src/common/misc/pvfs2-util.c
r8394 r8397 438 438 *tmp = 0; 439 439 mntent->mnt_opts = strdup("rw"); 440 mntent->fs_id = PVFS_FS_ID_NULL; 440 441 return &s_stat_tab_array[0]; 441 442 } … … 1075 1076 /* Search for mntent by fsid */ 1076 1077 gen_mutex_lock(&s_stat_tab_mutex); 1077 1078 1078 for(i = 0; i < s_stat_tab_count; i++) 1079 1079 { … … 1110 1110 1111 1111 gen_mutex_unlock(&s_stat_tab_mutex); 1112 1113 1112 return -PVFS_EINVAL; 1114 1113 } … … 1730 1729 if (sys_attrmask & PVFS_ATTR_SYS_DFILE_COUNT) 1731 1730 { 1732 attrmask |= PVFS_ATTR_META_DFILES; 1731 attrmask |= (PVFS_ATTR_META_DFILES | PVFS_ATTR_META_MIRROR_DFILES); 1732 } 1733 if (sys_attrmask & PVFS_ATTR_SYS_MIRROR_COPIES_COUNT) 1734 { 1735 attrmask |= PVFS_ATTR_META_MIRROR_DFILES; 1733 1736 } 1734 1737 … … 1834 1837 sys_mask |= PVFS_ATTR_SYS_DFILE_COUNT; 1835 1838 } 1839 if (obj_mask & PVFS_ATTR_META_MIRROR_DFILES) 1840 { 1841 sys_mask |= PVFS_ATTR_SYS_MIRROR_COPIES_COUNT; 1842 } 1836 1843 if (obj_mask & PVFS_ATTR_META_DIST) 1837 1844 { -
branches/cu-security-branch/src/common/misc/server-config.c
r8365 r8397 35 35 36 36 static DOTCONF_CB(get_logstamp); 37 static DOTCONF_CB(get_storage_space); 37 static DOTCONF_CB(get_storage_path); 38 static DOTCONF_CB(get_data_path); 39 static DOTCONF_CB(get_meta_path); 38 40 static DOTCONF_CB(enter_defaults_context); 39 41 static DOTCONF_CB(exit_defaults_context); … … 79 81 static DOTCONF_CB(get_bmi_module_list); 80 82 static DOTCONF_CB(get_flow_module_list); 83 84 static DOTCONF_CB(get_root_squash); 85 static DOTCONF_CB(get_root_squash_exceptions); 81 86 static DOTCONF_CB(get_read_only); 87 static DOTCONF_CB(get_all_squash); 88 static DOTCONF_CB(get_anon_gid); 89 static DOTCONF_CB(get_anon_uid); 90 82 91 static DOTCONF_CB(get_handle_recycle_timeout_seconds); 83 92 static DOTCONF_CB(get_flow_buffer_size_bytes); … … 346 355 347 356 /* Specifies the beginning of a ExportOptions context. 348 * This groups options specific to a filesystem and related to the 349 * behavior of how it gets exported to various clients. 357 * This groups options specific to a filesystem and related to the behavior 358 * of how it gets exported to various clients. Most of these options 359 * will affect things like what uids get translated to and so on.. 350 360 */ 351 361 {"<ExportOptions>",ARG_NONE, enter_export_options_context, NULL,CTX_FILESYSTEM, … … 546 556 CTX_DEFAULTS|CTX_SERVER_OPTIONS,"50"}, 547 557 548 /* Specifies the local path for the pvfs2 server to use as storage space. 549 * This option specifies the default path for all servers and will appear 558 /* DEPRECATED 559 * Specifies the local path for the pvfs2 server to use as 560 * storage space for data files and metadata files. This option should not 561 * be used in conjuction with DataStorageSpace or MetadataStorageSpace. 562 * This option is only meant as a migration path for configurations where i 563 * users do not want (or don't expect to need to) modify their configuration 564 * to run this version. 565 * 566 * This option specifies the default path for all servers and will appear 550 567 * in the Defaults context. 551 568 * … … 554 571 * Example: 555 572 * 556 * StorageSpace /tmp/pvfs.storage 557 */ 558 {"StorageSpace",ARG_STR, get_storage_space,NULL, 573 * StorageSpace /tmp/pvfs-data.storage 574 * DEPRECATED. 575 */ 576 {"StorageSpace",ARG_STR, get_storage_path,NULL, 577 CTX_DEFAULTS|CTX_SERVER_OPTIONS,NULL}, 578 579 /* Specifies the local path for the pvfs2 server to use as storage space 580 * for data files. This option specifies the default path for all servers 581 * and will appear in the Defaults context. 582 * 583 * NOTE: This can be overridden in the <ServerOptions> tag on a per-server 584 * basis. Look at the "Option" tag for more details 585 * Example: 586 * 587 * DataStorageSpace /tmp/pvfs-data.storage 588 */ 589 {"DataStorageSpace",ARG_STR, get_data_path,NULL, 590 CTX_DEFAULTS|CTX_SERVER_OPTIONS,NULL}, 591 592 /* Specifies the local path for the pvfs2 server to use as storage space 593 * for metadata files. This option specifies the default path for all 594 * servers and will appear in the Defaults context. 595 * 596 * NOTE: This can be overridden in the <ServerOptions> tag on a per-server 597 * basis. Look at the "Option" tag for more details 598 * Example: 599 * 600 * MetadataStorageSpace /tmp/pvfs-meta.storage 601 */ 602 {"MetadataStorageSpace",ARG_STR, get_meta_path,NULL, 559 603 CTX_DEFAULTS|CTX_SERVER_OPTIONS,NULL}, 560 604 … … 691 735 * usec: [%H:%M:%S.%U] 692 736 * 693 * datetime: [%m/%d %H:%M]737 * datetime: [%m/%d/%Y %H:%M:%S] 694 738 * 695 739 * thread: [%H:%M:%S.%U (%lu)] … … 721 765 * to the rest of the world. 722 766 */ 767 768 /* RootSquash option specifies whether the exported file-system needs to 769 * squash accesses by root. This is an optional parameter that needs 770 * to be specified as part of the ExportOptions 771 * context and is a list of BMI URL specification of client addresses 772 * for which RootSquash has to be enforced. 773 * 774 * RootSquash tcp://192.168.2.0@24 tcp://10.0.0.* tcp://192.168.* ... 775 */ 776 {"RootSquash", ARG_LIST, get_root_squash, NULL, 777 CTX_EXPORT, ""}, 778 779 /* RootSquashExceptions option specifies exceoptions to the RootSquash 780 * list. This is an optional parameter that needs to be specified as 781 * part of the ExportOptions context and is a list of BMI URL 782 * specification of client addresses for which RootSquash 783 * has to be enforced. 784 * RootSquash tcp://192.168.2.0@24 tcp://10.0.0.* tcp://192.168.* ... 785 */ 786 {"RootSquashExceptions", ARG_LIST, get_root_squash_exceptions, NULL, 787 CTX_EXPORT, ""}, 723 788 724 789 /* ReadOnly option specifies whether the exported file-system needs to … … 734 799 {"ReadOnly", ARG_LIST, get_read_only, NULL, 735 800 CTX_EXPORT, ""}, 801 802 /* AllSquash option specifies whether the exported file-system needs to 803 * squash all accesses to the file-system to a specified uid/gid! 804 * This is an optional parameter that needs to be specified as part of 805 * the ExportOptions context and is a list of BMI URL specification of client 806 * addresses for which AllSquash has to be enforced. 807 * An example: 808 * 809 * AllSquash tcp://192.168.2.0@24 tcp://10.0.0.* tcp://192.168.* ... 810 */ 811 {"AllSquash", ARG_LIST, get_all_squash, NULL, 812 CTX_EXPORT, ""}, 813 814 /* AnonUID and AnonGID are 2 integers that tell the servers to translate 815 * the requesting clients' uid/gid to the specified ones whenever AllSquash 816 * is specified! 817 * If these are not specified and AllSquash is specified then the uid used 818 * will be that of nobody and gid that of nobody. 819 * An example: 820 * 821 * AnonUID 3454 822 * AnonGID 3454 823 */ 824 825 {"AnonUID", ARG_STR, get_anon_uid, NULL, 826 CTX_EXPORT, "65534"}, 827 {"AnonGID", ARG_STR, get_anon_gid, NULL, 828 CTX_EXPORT, "65534"}, 736 829 737 830 /* The TROVE storage layer has a management component that deals with … … 1007 1100 } 1008 1101 1009 if (server_alias_name && !config_s-> storage_path)1102 if (server_alias_name && !config_s->data_path) 1010 1103 { 1011 1104 gossip_err("Configuration file error. " 1012 "No storage path specified for alias %s.\n", server_alias_name); 1105 "No data storage path specified for alias %s.\n", server_alias_name); 1106 return 1; 1107 } 1108 1109 if (server_alias_name && !config_s->meta_path) 1110 { 1111 gossip_err("Configuration file error. " 1112 "No metadata storage path specified for alias %s.\n", server_alias_name); 1013 1113 return 1; 1014 1114 } … … 1109 1209 1110 1210 1111 DOTCONF_CB(get_storage_ space)1211 DOTCONF_CB(get_storage_path) 1112 1212 { 1113 1213 struct server_configuration_s *config_s = … … 1118 1218 return NULL; 1119 1219 } 1120 if (config_s->storage_path) 1121 { 1122 free(config_s->storage_path); 1123 } 1124 config_s->storage_path = 1220 1221 if( config_s->data_path ) 1222 { 1223 free(config_s->data_path); 1224 } 1225 1226 if( config_s->meta_path ) 1227 { 1228 free(config_s->meta_path); 1229 } 1230 1231 config_s->data_path = 1232 (cmd->data.str ? strdup(cmd->data.str) : NULL); 1233 config_s->meta_path = 1234 (cmd->data.str ? strdup(cmd->data.str) : NULL); 1235 return NULL; 1236 } 1237 1238 DOTCONF_CB(get_data_path) 1239 { 1240 struct server_configuration_s *config_s = 1241 (struct server_configuration_s *)cmd->context; 1242 if(config_s->configuration_context == CTX_SERVER_OPTIONS && 1243 config_s->my_server_options == 0) 1244 { 1245 return NULL; 1246 } 1247 if (config_s->data_path) 1248 { 1249 free(config_s->data_path); 1250 } 1251 1252 config_s->data_path = 1253 (cmd->data.str ? strdup(cmd->data.str) : NULL); 1254 return NULL; 1255 } 1256 1257 DOTCONF_CB(get_meta_path) 1258 { 1259 struct server_configuration_s *config_s = 1260 (struct server_configuration_s *)cmd->context; 1261 if(config_s->configuration_context == CTX_SERVER_OPTIONS && 1262 config_s->my_server_options == 0) 1263 { 1264 return NULL; 1265 } 1266 if (config_s->meta_path) 1267 { 1268 free(config_s->meta_path); 1269 } 1270 1271 config_s->meta_path = 1125 1272 (cmd->data.str ? strdup(cmd->data.str) : NULL); 1126 1273 return NULL; … … 1739 1886 } 1740 1887 1888 DOTCONF_CB(get_root_squash) 1889 { 1890 struct filesystem_configuration_s *fs_conf = NULL; 1891 struct server_configuration_s *config_s = 1892 (struct server_configuration_s *)cmd->context; 1893 1894 fs_conf = (struct filesystem_configuration_s *) 1895 PINT_llist_head(config_s->file_systems); 1896 assert(fs_conf); 1897 1898 if (cmd->arg_count == 0) 1899 { 1900 fs_conf->exp_flags &= ~TROVE_EXP_ROOT_SQUASH; 1901 } 1902 else 1903 { 1904 fs_conf->exp_flags |= TROVE_EXP_ROOT_SQUASH; 1905 fs_conf->root_squash_netmasks = (int *) calloc(cmd->arg_count, sizeof(int)); 1906 if (fs_conf->root_squash_netmasks == NULL) 1907 { 1908 fs_conf->root_squash_count = 0; 1909 return("Could not allocate memory for root_squash_netmasks\n"); 1910 } 1911 if (get_list_of_strings(cmd->arg_count, cmd->data.list, 1912 &fs_conf->root_squash_hosts) < 0) 1913 { 1914 free(fs_conf->root_squash_netmasks); 1915 fs_conf->root_squash_netmasks = NULL; 1916 fs_conf->root_squash_count = 0; 1917 return("Could not allocate memory for root_squash_hosts\n"); 1918 } 1919 fs_conf->root_squash_count = cmd->arg_count; 1920 /* Setup the netmasks */ 1921 if (setup_netmasks(fs_conf->root_squash_count, fs_conf->root_squash_hosts, 1922 fs_conf->root_squash_netmasks) < 0) 1923 { 1924 free(fs_conf->root_squash_netmasks); 1925 fs_conf->root_squash_netmasks = NULL; 1926 free_list_of_strings(fs_conf->root_squash_count, &fs_conf->root_squash_hosts); 1927 fs_conf->root_squash_count = 0; 1928 return("Could not setup netmasks for root_squash_hosts\n"); 1929 } 1930 gossip_debug(GOSSIP_SERVER_DEBUG, "Parsed %d RootSquash wildcard entries\n", 1931 cmd->arg_count); 1932 } 1933 return NULL; 1934 } 1935 1936 DOTCONF_CB(get_root_squash_exceptions) 1937 { 1938 struct filesystem_configuration_s *fs_conf = NULL; 1939 struct server_configuration_s *config_s = 1940 (struct server_configuration_s *)cmd->context; 1941 1942 fs_conf = (struct filesystem_configuration_s *) 1943 PINT_llist_head(config_s->file_systems); 1944 assert(fs_conf); 1945 1946 if (cmd->arg_count != 0) 1947 { 1948 fs_conf->root_squash_exceptions_netmasks = (int *) calloc(cmd->arg_count, sizeof(int)); 1949 if (fs_conf->root_squash_exceptions_netmasks == NULL) 1950 { 1951 fs_conf->root_squash_exceptions_count = 0; 1952 return("Could not allocate memory for root_squash_exceptions_netmasks\n"); 1953 } 1954 if (get_list_of_strings(cmd->arg_count, cmd->data.list, 1955 &fs_conf->root_squash_exceptions_hosts) < 0) 1956 { 1957 free(fs_conf->root_squash_exceptions_netmasks); 1958 fs_conf->root_squash_exceptions_netmasks = NULL; 1959 fs_conf->root_squash_exceptions_count = 0; 1960 return("Could not allocate memory for root_squash_exceptions_hosts\n"); 1961 } 1962 fs_conf->root_squash_exceptions_count = cmd->arg_count; 1963 /* Setup the netmasks */ 1964 if (setup_netmasks(fs_conf->root_squash_exceptions_count, fs_conf->root_squash_exceptions_hosts, 1965 fs_conf->root_squash_exceptions_netmasks) < 0) 1966 { 1967 free(fs_conf->root_squash_exceptions_netmasks); 1968 fs_conf->root_squash_exceptions_netmasks = NULL; 1969 free_list_of_strings(fs_conf->root_squash_exceptions_count, &fs_conf->root_squash_exceptions_hosts); 1970 fs_conf->root_squash_exceptions_count = 0; 1971 return("Could not setup netmasks for root_squash_exceptions_hosts\n"); 1972 } 1973 gossip_debug(GOSSIP_SERVER_DEBUG, "Parsed %d RootSquashExceptions wildcard entries\n", 1974 cmd->arg_count); 1975 } 1976 return NULL; 1977 } 1978 1979 1741 1980 DOTCONF_CB(get_read_only) 1742 1981 { … … 1782 2021 cmd->arg_count); 1783 2022 } 2023 return NULL; 2024 } 2025 2026 DOTCONF_CB(get_all_squash) 2027 { 2028 struct filesystem_configuration_s *fs_conf = NULL; 2029 struct server_configuration_s *config_s = 2030 (struct server_configuration_s *)cmd->context; 2031 2032 fs_conf = (struct filesystem_configuration_s *) 2033 PINT_llist_head(config_s->file_systems); 2034 assert(fs_conf); 2035 2036 if (cmd->arg_count == 0) 2037 { 2038 fs_conf->exp_flags &= ~TROVE_EXP_ALL_SQUASH; 2039 } 2040 else 2041 { 2042 fs_conf->exp_flags |= TROVE_EXP_ALL_SQUASH; 2043 fs_conf->all_squash_netmasks = (int *) calloc(cmd->arg_count, sizeof(int)); 2044 if (fs_conf->all_squash_netmasks == NULL) 2045 { 2046 fs_conf->all_squash_count = 0; 2047 return("Could not allocate memory for all_squash_netmasks\n"); 2048 } 2049 if (get_list_of_strings(cmd->arg_count, cmd->data.list, 2050 &fs_conf->all_squash_hosts) < 0) 2051 { 2052 free(fs_conf->all_squash_netmasks); 2053 fs_conf->all_squash_netmasks = NULL; 2054 fs_conf->all_squash_count = 0; 2055 return("Could not allocate memory for all_squash_hosts\n"); 2056 } 2057 fs_conf->all_squash_count = cmd->arg_count; 2058 if (setup_netmasks(fs_conf->all_squash_count, fs_conf->all_squash_hosts, 2059 fs_conf->all_squash_netmasks) < 0) 2060 { 2061 free(fs_conf->all_squash_netmasks); 2062 fs_conf->all_squash_netmasks = NULL; 2063 free_list_of_strings(fs_conf->all_squash_count, &fs_conf->all_squash_hosts); 2064 fs_conf->all_squash_count = 0; 2065 return("Could not setup netmasks for all_squash_hosts\n"); 2066 } 2067 gossip_debug(GOSSIP_SERVER_DEBUG, "Parsed %d AllSquash wildcard entries\n", 2068 cmd->arg_count); 2069 } 2070 return NULL; 2071 } 2072 2073 DOTCONF_CB(get_anon_uid) 2074 { 2075 struct filesystem_configuration_s *fs_conf = NULL; 2076 unsigned int tmp_var; 2077 int ret = -1; 2078 struct server_configuration_s *config_s = 2079 (struct server_configuration_s *)cmd->context; 2080 2081 fs_conf = (struct filesystem_configuration_s *) 2082 PINT_llist_head(config_s->file_systems); 2083 assert(fs_conf); 2084 ret = sscanf(cmd->data.str, "%u", &tmp_var); 2085 if(ret != 1) 2086 { 2087 return("AnonUID does not have a long long unsigned value.\n"); 2088 } 2089 fs_conf->exp_anon_uid = tmp_var; 2090 return NULL; 2091 } 2092 2093 DOTCONF_CB(get_anon_gid) 2094 { 2095 struct filesystem_configuration_s *fs_conf = NULL; 2096 unsigned int tmp_var; 2097 int ret = -1; 2098 struct server_configuration_s *config_s = 2099 (struct server_configuration_s *)cmd->context; 2100 2101 fs_conf = (struct filesystem_configuration_s *) 2102 PINT_llist_head(config_s->file_systems); 2103 assert(fs_conf); 2104 ret = sscanf(cmd->data.str, "%u", &tmp_var); 2105 if(ret != 1) 2106 { 2107 return("AnonGID does not have a unsigned value.\n"); 2108 } 2109 fs_conf->exp_anon_gid = tmp_var; 1784 2110 return NULL; 1785 2111 } … … 2670 2996 } 2671 2997 2672 if (config_s->storage_path) 2673 { 2674 free(config_s->storage_path); 2675 config_s->storage_path = NULL; 2998 if (config_s->data_path) 2999 { 3000 free(config_s->data_path); 3001 config_s->data_path = NULL; 3002 } 3003 3004 if (config_s->meta_path) 3005 { 3006 free(config_s->meta_path); 3007 config_s->meta_path = NULL; 2676 3008 } 2677 3009 … … 2981 3313 free(fs->ro_netmasks); 2982 3314 fs->ro_netmasks = NULL; 3315 } 3316 /* free all root_squash_exception_hosts specifications */ 3317 if (fs->root_squash_exceptions_hosts) 3318 { 3319 free_list_of_strings(fs->root_squash_exceptions_count, &fs->root_squash_exceptions_hosts); 3320 fs->root_squash_exceptions_count = 0; 3321 } 3322 if (fs->root_squash_exceptions_netmasks) 3323 { 3324 free(fs->root_squash_exceptions_netmasks); 3325 fs->root_squash_exceptions_netmasks = NULL; 3326 } 3327 /* free all root_squash_hosts specifications */ 3328 if (fs->root_squash_hosts) 3329 { 3330 free_list_of_strings(fs->root_squash_count, &fs->root_squash_hosts); 3331 fs->root_squash_count = 0; 3332 } 3333 if (fs->root_squash_netmasks) 3334 { 3335 free(fs->root_squash_netmasks); 3336 fs->root_squash_netmasks = NULL; 3337 } 3338 /* free all all_squash_hosts specifications */ 3339 if (fs->all_squash_hosts) 3340 { 3341 free_list_of_strings(fs->all_squash_count, &fs->all_squash_hosts); 3342 fs->all_squash_count = 0; 3343 } 3344 if (fs->all_squash_netmasks) 3345 { 3346 free(fs->all_squash_netmasks); 3347 fs->all_squash_netmasks = NULL; 2983 3348 } 2984 3349 free(fs); … … 3097 3462 dest_fs->exp_flags = src_fs->exp_flags; 3098 3463 dest_fs->ro_count = src_fs->ro_count; 3464 dest_fs->root_squash_count = src_fs->root_squash_count; 3465 dest_fs->all_squash_count = src_fs->all_squash_count; 3099 3466 if (src_fs->ro_count > 0 && src_fs->ro_hosts) 3100 3467 { … … 3114 3481 memcpy(dest_fs->ro_netmasks, src_fs->ro_netmasks, src_fs->ro_count * sizeof(int)); 3115 3482 } 3483 if (src_fs->root_squash_count > 0 && src_fs->root_squash_hosts) 3484 { 3485 int i; 3486 dest_fs->root_squash_hosts = (char **) calloc(src_fs->root_squash_count, sizeof(char *)); 3487 assert(dest_fs->root_squash_hosts); 3488 for (i = 0; i < src_fs->root_squash_count; i++) 3489 { 3490 dest_fs->root_squash_hosts[i] = strdup(src_fs->root_squash_hosts[i]); 3491 assert(dest_fs->root_squash_hosts[i]); 3492 } 3493 } 3494 if (src_fs->root_squash_count > 0 && src_fs->root_squash_netmasks) 3495 { 3496 dest_fs->root_squash_netmasks = (int *) calloc(src_fs->root_squash_count, sizeof(int)); 3497 assert(dest_fs->root_squash_netmasks); 3498 memcpy(dest_fs->root_squash_netmasks, src_fs->root_squash_netmasks, src_fs->root_squash_count * sizeof(int)); 3499 } 3500 if (src_fs->all_squash_count > 0 && src_fs->all_squash_hosts) 3501 { 3502 int i; 3503 dest_fs->all_squash_hosts = (char **) calloc(src_fs->all_squash_count, sizeof(char *)); 3504 assert(dest_fs->all_squash_hosts); 3505 for (i = 0; i < src_fs->all_squash_count; i++) 3506 { 3507 dest_fs->all_squash_hosts[i] = strdup(src_fs->all_squash_hosts[i]); 3508 assert(dest_fs->all_squash_hosts[i]); 3509 } 3510 } 3511 if (src_fs->all_squash_count > 0 && src_fs->all_squash_netmasks) 3512 { 3513 dest_fs->all_squash_netmasks = (int *) calloc(src_fs->all_squash_count, sizeof(int)); 3514 assert(dest_fs->all_squash_netmasks); 3515 memcpy(dest_fs->all_squash_netmasks, src_fs->all_squash_netmasks, src_fs->all_squash_count * sizeof(int)); 3516 } 3517 dest_fs->exp_anon_uid = src_fs->exp_anon_uid; 3518 dest_fs->exp_anon_gid = src_fs->exp_anon_gid; 3116 3519 3117 3520 dest_fs->fp_buffer_size = src_fs->fp_buffer_size; … … 3119 3522 } 3120 3523 } 3524 3121 3525 3122 3526 static host_alias_s *find_host_alias_ptr_by_alias( … … 4106 4510 4107 4511 ret = pvfs2_mkspace( 4108 config-> storage_path, cur_fs->file_system_name,4512 config->data_path, config->meta_path, cur_fs->file_system_name, 4109 4513 cur_fs->coll_id, root_handle, cur_meta_handle_range, 4110 4514 cur_data_handle_range, create_collection_only, 1); … … 4161 4565 (remove_collection_only ? "collection" : 4162 4566 "storage space")); 4163 ret = pvfs2_rmspace(config->storage_path, 4567 ret = pvfs2_rmspace(config->data_path, 4568 config->meta_path, 4164 4569 cur_fs->file_system_name, 4165 4570 cur_fs->coll_id, -
branches/cu-security-branch/src/common/misc/server-config.h
r8332 r8397 103 103 int *ro_netmasks; 104 104 105 int root_squash_count; 106 char **root_squash_hosts; 107 int *root_squash_netmasks; 108 109 int root_squash_exceptions_count; 110 char **root_squash_exceptions_hosts; 111 int *root_squash_exceptions_netmasks; 112 113 int all_squash_count; 114 char **all_squash_hosts; 115 int *all_squash_netmasks; 116 117 PVFS_uid exp_anon_uid; 118 PVFS_gid exp_anon_gid; 119 105 120 int32_t small_file_size; 106 121 … … 125 140 } distribution_configuration; 126 141 127 enum security_keyword128 {129 SECURITY_KEYWORD_EMAIL,130 SECURITY_KEYWORD_EMAIL_REGEX,131 SECURITY_KEYWORD_SUBJECT,132 SECURITY_KEYWORD_SUBJECT_REGEX,133 };134 135 142 typedef struct server_configuration_s 136 143 { … … 139 146 char *server_alias; /* the command line server-alias parameter */ 140 147 int my_server_options; 141 char *storage_path; 148 char *data_path; /* path to data storage directory */ 149 char *meta_path; /* path to metadata storage directory */ 142 150 char *fs_config_filename; /* the fs.conf file name */ 143 151 size_t fs_config_buflen; /* the fs.conf file length */ -
branches/cu-security-branch/src/common/misc/state-machine-fns.c
r7941 r8397 431 431 { 432 432 return smcb->op == PVFS_SERVER_GET_CONFIG 433 || smcb->op == PVFS_SERVER_FETCH_CONFIG434 433 || smcb->op == PVFS_CLIENT_JOB_TIMER 435 434 || smcb->op == PVFS_CLIENT_PERF_COUNT_TIMER -
branches/cu-security-branch/src/common/misc/state-machine.h
r8330 r8397 50 50 SM_RUN = 9 51 51 }; 52 53 /*define msgpairarray parameters for server-to-server requests*/ 54 #define PINT_serv_init_msgarray_params(sm_p, __fsid) \ 55 do { \ 56 PINT_sm_msgpair_params *mpp = &sm_p->msgarray_op.params; \ 57 struct server_configuration_s *server_config = \ 58 get_server_config_struct(); \ 59 mpp->job_context = server_job_context; \ 60 if (server_config) \ 61 { \ 62 mpp->job_timeout = server_config->client_job_bmi_timeout; \ 63 mpp->retry_limit = server_config->client_retry_limit; \ 64 mpp->retry_delay = server_config->client_retry_delay_ms; \ 65 } \ 66 else \ 67 { \ 68 mpp->job_timeout = PVFS2_CLIENT_JOB_BMI_TIMEOUT_DEFAULT; \ 69 mpp->retry_limit = PVFS2_CLIENT_RETRY_LIMIT_DEFAULT; \ 70 mpp->retry_delay = PVFS2_CLIENT_RETRY_DELAY_MS_DEFAULT; \ 71 } \ 72 } while (0) 52 73 53 74 /* these define things like stack size and so forth for the common … … 204 225 int *remaining); 205 226 206 /* This macro is used in calls to PINT_sm_fram () */227 /* This macro is used in calls to PINT_sm_frame() */ 207 228 #define PINT_FRAME_CURRENT 0 229 #define PINT_FRAME_TOP 1 208 230 209 231 struct PINT_state_machine_s pvfs2_void_sm; -
branches/cu-security-branch/src/common/misc/str-utils.c
r8330 r8397 144 144 145 145 /* initialize our starting position */ 146 if (*inout_segp == NULL) { 147 ptr = pathname; 148 } 149 else if (*opaquep != NULL) { 150 /* replace the '/', point just past it */ 151 ptr = (char *) *opaquep; 152 *ptr = '/'; 153 ptr++; 154 } 155 else return -1; /* NULL *opaquep indicates last segment returned last time */ 146 if (*inout_segp == NULL) 147 { 148 ptr = pathname; 149 } 150 else if (*opaquep != NULL) 151 { 152 /* replace the '/', point just past it */ 153 ptr = (char *) *opaquep; 154 *ptr = '/'; 155 ptr++; 156 } 157 else 158 return -1; /* NULL *opaquep indicates last segment returned last time */ 156 159 157 160 /* at this point, the string is back in its original state */ 158 161 159 162 /* jump past separators */ 160 while ((*ptr != '\0') && (*ptr == '/')) ptr++; 161 if (*ptr == '\0') return -1; /* all that was left was trailing '/'s */ 163 while ((*ptr != '\0') && (*ptr == '/')) 164 ptr++; 165 if (*ptr == '\0') 166 return -1; /* all that was left was trailing '/'s */ 162 167 163 168 *inout_segp = ptr; 164 169 165 170 /* find next separator */ 166 while ((*ptr != '\0') && (*ptr != '/')) ptr++; 167 if (*ptr == '\0') *opaquep = NULL; /* indicate last segment */ 168 else { 169 /* terminate segment and save position of terminator */ 170 *ptr = '\0'; 171 *opaquep = ptr; 171 while ((*ptr != '\0') && (*ptr != '/')) 172 ptr++; 173 if (*ptr == '\0') 174 *opaquep = NULL; /* indicate last segment */ 175 else 176 { 177 /* terminate segment and save position of terminator */ 178 *ptr = '\0'; 179 *opaquep = ptr; 172 180 } 173 181 return 0; … … 312 320 for(i =0; i < pathlen; i++) 313 321 { 314 if (path[i] == '/')315 {316 num_slashes_seen++;317 if (num_slashes_seen > skip)318 {319 break;320 }321 }322 if (path[i] == '/') 323 { 324 num_slashes_seen++; 325 if (num_slashes_seen > skip) 326 { 327 break; 328 } 329 } 322 330 } 323 331 … … 356 364 if (!comma_list || !tokens) 357 365 { 358 return (0);366 return (0); 359 367 } 360 368 … … 363 371 while ((holder = index(holder, ','))) 364 372 { 365 tokencount++;366 holder++;373 tokencount++; 374 holder++; 367 375 } 368 376 … … 380 388 if (!(*tokens)) 381 389 { 382 return 0;390 return 0; 383 391 } 384 392 385 393 if(1 == tokencount) 386 394 { 387 (*tokens)[0] = strdup(comma_list);388 if(!(*tokens)[0])389 {390 tokencount = 0;391 goto failure;392 }393 return tokencount;395 (*tokens)[0] = strdup(comma_list); 396 if(!(*tokens)[0]) 397 { 398 tokencount = 0; 399 goto failure; 400 } 401 return tokencount; 394 402 } 395 403 … … 399 407 for (i = 0; i < tokencount && holder; i++) 400 408 { 401 holder2 = index(holder, ',');402 if (!holder2)403 {404 holder2 = end;405 }409 holder2 = index(holder, ','); 410 if (!holder2) 411 { 412 holder2 = end; 413 } 406 414 if (holder2 - holder == 0) { 407 415 retval--; 408 goto out;409 } 410 (*tokens)[i] = (char *) malloc((holder2 - holder) + 1);411 if (!(*tokens)[i])412 {413 goto failure;414 }415 strncpy((*tokens)[i], holder, (holder2 - holder));416 (*tokens)[i][(holder2 - holder)] = '\0';416 return (retval); 417 } 418 (*tokens)[i] = (char *) malloc((holder2 - holder) + 1); 419 if (!(*tokens)[i]) 420 { 421 goto failure; 422 } 423 strncpy((*tokens)[i], holder, (holder2 - holder)); 424 (*tokens)[i][(holder2 - holder)] = '\0'; 417 425 assert(strlen((*tokens)[i]) != 0); 418 holder = holder2 + 1; 419 } 420 421 out: 426 holder = holder2 + 1; 427 } 428 422 429 return (retval); 423 430 424 failure:431 failure: 425 432 426 433 /* free up any memory we allocated if we failed */ 427 434 if (*tokens) 428 435 { 429 for (i = 0; i < tokencount; i++)430 {431 if ((*tokens)[i])432 {433 free((*tokens)[i]);434 }435 }436 free(*tokens);436 for (i = 0; i < tokencount; i++) 437 { 438 if ((*tokens)[i]) 439 { 440 free((*tokens)[i]); 441 } 442 } 443 free(*tokens); 437 444 } 438 445 return (0);
