Show
Ignore:
Timestamp:
06/18/10 20:02:50 (3 years ago)
Author:
nlmills
Message:

initial merge with Orange-Branch. much will be broken

Location:
branches/cu-security-branch
Files:
21 modified

Legend:

Unmodified
Added
Removed
  • branches/cu-security-branch

    • Property svn:ignore
      •  

        old new  
        33aclocal.m4 
        44autom4te.cache 
        5 config.status 
        6 Makefile 
        7 pvfs2-config.h 
        8 module.mk 
  • branches/cu-security-branch/src/common/misc

    • Property svn:ignore deleted
  • branches/cu-security-branch/src/common/misc/mkspace.c

    r7941 r8397  
    112112 
    113113int pvfs2_mkspace( 
    114     char *storage_space, 
     114    char *data_path, 
     115    char *meta_path, 
    115116    char *collection, 
    116117    TROVE_coll_id coll_id, 
     
    135136    TROVE_handle lost_and_found_dirdata_handle = TROVE_HANDLE_NULL; 
    136137 
    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); 
    138140    mkspace_print(verbose,"Collection   : %s\n",collection); 
    139141    mkspace_print(verbose,"ID           : %d\n",coll_id); 
     
    160162        ret = trove_initialize(TROVE_METHOD_DBPF,  
    161163                               NULL,  
    162                                storage_space,  
     164                               data_path, 
     165                               meta_path, 
    163166                               0); 
    164167        if (ret > -1) 
    165168        { 
    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); 
    172175        if (ret != 1) 
    173176        { 
     
    180183    ret = trove_initialize( 
    181184        TROVE_METHOD_DBPF, NULL,  
    182         storage_space, 0); 
     185        data_path, meta_path, 0); 
    183186    if (ret < 0) 
    184187    { 
     
    187190    } 
    188191 
    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); 
    191196 
    192197    /* try to look up collection used to store file system */ 
     
    637642 
    638643int pvfs2_rmspace( 
    639     char *storage_space, 
     644    char *data_path, 
     645    char *meta_path, 
    640646    char *collection, 
    641647    TROVE_coll_id coll_id, 
     
    652658        ret = trove_initialize( 
    653659            TROVE_METHOD_DBPF, NULL, 
    654             storage_space, 0); 
     660            data_path, meta_path, 0); 
    655661        if (ret == -1) 
    656662        { 
    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); 
    659665            return -1; 
    660666        } 
     
    674680    if (!remove_collection_only) 
    675681    { 
    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); 
    678684        /* 
    679685         * it is a bit weird to do a trove_finaliz() prior to blowing away 
     
    683689        trove_finalize(TROVE_METHOD_DBPF); 
    684690        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)) ? 
    687693                            "successfully" : "with errors")); 
    688694 
  • branches/cu-security-branch/src/common/misc/mkspace.h

    r3805 r8397  
    1414 
    1515int pvfs2_mkspace( 
    16     char *storage_space, 
     16    char *data_path, 
     17    char *meta_path, 
    1718    char *collection, 
    1819    TROVE_coll_id coll_id, 
     
    2425 
    2526int pvfs2_rmspace( 
    26     char *storage_space, 
     27    char *data_path, 
     28    char *meta_path, 
    2729    char *collection, 
    2830    TROVE_coll_id coll_id, 
  • branches/cu-security-branch/src/common/misc/msgpairarray.h

    r8330 r8397  
    4949    /* server address */ 
    5050    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; 
    5156 
    5257    /* req and encoded_req are used to send a request */ 
  • branches/cu-security-branch/src/common/misc/msgpairarray.sm

    r8330 r8397  
    9595    PINT_sm_msgpair_state *msg_p = NULL; 
    9696 
     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 
    97101    gossip_debug(GOSSIP_MSGPAIR_DEBUG, "(%p) msgpairarray state: init " 
    98102                 "(%d msgpair(s))\n", smcb, mop->count); 
     
    116120        msg_p->retry_count = 0; 
    117121        msg_p->complete = 0; 
     122 
    118123    } 
    119124    return SM_ACTION_COMPLETE; 
     
    233238                PINT_ENCODE_RESP, msg_p->req.op, msg_p->enc_type); 
    234239 
     240 
    235241            msg_p->encoded_resp_p = BMI_memalloc( 
    236242                msg_p->svr_addr, msg_p->max_resp_sz, BMI_RECV); 
     
    245251 
    246252        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; 
    247257 
    248258        gossip_debug(GOSSIP_MSGPAIR_DEBUG, "%s: sm %p msgpair %d: " 
     
    301311            { 
    302312                PINT_encode_release(&msg_p->encoded_req, PINT_ENCODE_REQ); 
     313                memset(&msg_p->encoded_req,0,sizeof(msg_p->encoded_req)); 
    303314                BMI_memfree(msg_p->svr_addr,msg_p->encoded_resp_p, 
    304315                            msg_p->max_resp_sz, BMI_RECV); 
     
    489500    gossip_debug(GOSSIP_MSGPAIR_DEBUG, "(%p) msgpairarray state: " 
    490501                 "completion_fn\n", smcb); 
     502    gossip_debug(GOSSIP_MIRROR_DEBUG,"Executing msgpairarray_completion_fn..\n"); 
    491503 
    492504    for (i = 0; i < mop->count; i++) 
     
    546558        if (msg_p->comp_fn != NULL) 
    547559        { 
     560            gossip_debug(GOSSIP_MIRROR_DEBUG,"\texecuting msg_p->comp_fn..\n"); 
    548561            /* If we call the completion function, store the result on 
    549562             * a per message pair basis.  Also store some non-zero 
     
    590603        } 
    591604 
     605        memset(&msg_p->encoded_req,0,sizeof(msg_p->encoded_req)); 
    592606        msg_p->encoded_resp_p = NULL; 
    593607        msg_p->max_resp_sz = 0; 
     
    601615        gossip_debug(GOSSIP_MSGPAIR_DEBUG, "%s: sm %p msgpair %d " 
    602616                     "marked complete\n", __func__, smcb, i); 
    603     } 
     617    }/*end for*/ 
    604618 
    605619    if (need_retry) { 
     
    783797    { 
    784798        PINT_encode_release(encoded_req_p, PINT_ENCODE_REQ); 
     799        memset(encoded_req_p,0,sizeof(*encoded_req_p)); 
    785800 
    786801        PINT_decode_release(decoded_resp_p, PINT_DECODE_RESP); 
     802        memset(decoded_resp_p,0,sizeof(*decoded_resp_p)); 
    787803 
    788804        BMI_memfree(*svr_addr_p, encoded_resp_p, max_resp_sz, BMI_RECV); 
     805        encoded_resp_p = NULL; 
    789806 
    790807        ret = 0; 
  • branches/cu-security-branch/src/common/misc/pint-cached-config.c

    r8330 r8397  
    17881788} 
    17891789 
     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 */ 
     1797int 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 
    17901836/* 
    17911837 * Local variables: 
  • branches/cu-security-branch/src/common/misc/pint-cached-config.h

    r8330 r8397  
    136136    struct server_configuration_s *config); 
    137137 
     138int PINT_cached_config_io_server_names( 
     139    char ***list,  
     140    int *size, 
     141    PVFS_fs_id fsid); 
     142 
    138143#endif /* __PINT_CACHED_CONFIG_H */ 
    139144 
  • branches/cu-security-branch/src/common/misc/pint-event.c

    r7941 r8397  
    6767static void PINT_event_tau_thread_init(char* gname); 
    6868static void PINT_event_tau_thread_fini(void); 
     69static void PINT_event_free( struct PINT_event *p ); 
     70static void PINT_group_free( strcut PINT_group *g ); 
    6971 
    7072#endif /* HAVE_TAU */ 
     73 
     74static 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 
     87static 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 
    71100 
    72101static int PINT_group_compare(void *key, struct qhash_head *link) 
     
    105134    if(!groups_table) 
    106135    { 
    107         qhash_finalize(events_table); 
     136        qhash_destroy_and_finalize( events_table, struct PINT_event, link,  
     137            PINT_event_free); 
    108138        return -PVFS_ENOMEM; 
    109139    } 
     
    112142    if(ret < 0) 
    113143    { 
    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 
    116149        return ret; 
    117150    } 
     
    131164} 
    132165 
     166void 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 
    133205void PINT_event_finalize(void) 
    134206{ 
    135  
    136207#if defined(HAVE_TAU) 
    137208    PINT_event_tau_fini(); 
    138209#endif 
    139210 
    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); 
    142217    return; 
    143218} 
  • branches/cu-security-branch/src/common/misc/pint-event.h

    r7941 r8397  
    99 
    1010#include "pvfs2-types.h" 
     11#include "quickhash.h" 
    1112 
    1213typedef PVFS_id_gen_t PINT_event_type; 
     
    3132 
    3233void PINT_event_finalize(void); 
     34void PINT_event_free_bucket_resources(struct qhash_table *qt 
     35                                     ,unsigned long distance_from_link); 
    3336 
    3437int PINT_event_enable(const char *events); 
  • branches/cu-security-branch/src/common/misc/pint-hint.c

    r7941 r8397  
    565565    while(h) 
    566566    { 
    567         if(!strcmp(hint->type_string, name)) 
     567        if(!strcmp(h->type_string, name)) 
    568568        { 
    569569            if(length) 
  • branches/cu-security-branch/src/common/misc/pint-mem.c

    r7941 r8397  
    88#include <errno.h> 
    99#include <stdlib.h> 
     10#include <string.h> 
    1011#ifdef HAVE_MALLOC_H 
    1112#include <malloc.h> 
    1213#endif 
    1314 
    14 #include "pint-mem.h" 
     15/* prototype definitions */ 
     16inline void* PINT_mem_aligned_alloc(size_t size, size_t alignment); 
     17inline void PINT_mem_aligned_free(void *ptr); 
    1518 
    1619/* PINT_mem_aligned_alloc() 
     
    3336        return NULL; 
    3437    } 
     38    memset(ptr, 0, size); 
    3539    return ptr; 
    3640} 
  • branches/cu-security-branch/src/common/misc/pint-util.c

    r7941 r8397  
    154154            if (dest->u.dir.hint.dist_params_len > 0) 
    155155            { 
    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); 
    157158                if (dest->u.dir.hint.dist_params == NULL) 
    158159                { 
     
    219220            } 
    220221 
     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 
    221257            if(src->mask & PVFS_ATTR_META_DIST) 
    222258            { 
     
    284320                } 
    285321            } 
     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            } 
    286330            if (attr->mask & PVFS_ATTR_META_DIST) 
    287331            { 
     
    307351        else if (attr->objtype == PVFS_TYPE_DIRECTORY) 
    308352        { 
    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)) 
    310355            { 
    311356                if (attr->u.dir.hint.dist_name) 
  • branches/cu-security-branch/src/common/misc/pvfs2-debug.c

    r8332 r8397  
    1111 
    1212#include "pvfs2-debug.h" 
    13  
    14 /* a private internal type */ 
    15 typedef struct  
    16 { 
    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_ALL 
    130  
    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)); 
    15813 
    15914static uint64_t debug_to_mask(__keyword_mask_t *mask_map,  
  • branches/cu-security-branch/src/common/misc/pvfs2-internal.h

    r8330 r8397  
    9494#define SPECIAL_METAFILE_HINT_KEYSTR    "meta_hint\0" 
    9595#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 
    96105 
    97106#define IO_MAX_REGIONS 64 
  • branches/cu-security-branch/src/common/misc/pvfs2-util.c

    r8394 r8397  
    438438        *tmp = 0; 
    439439        mntent->mnt_opts = strdup("rw"); 
     440        mntent->fs_id = PVFS_FS_ID_NULL; 
    440441        return &s_stat_tab_array[0]; 
    441442    } 
     
    10751076    /* Search for mntent by fsid */ 
    10761077    gen_mutex_lock(&s_stat_tab_mutex); 
    1077  
    10781078    for(i = 0; i < s_stat_tab_count; i++) 
    10791079    { 
     
    11101110 
    11111111    gen_mutex_unlock(&s_stat_tab_mutex); 
    1112  
    11131112    return -PVFS_EINVAL; 
    11141113} 
     
    17301729    if (sys_attrmask & PVFS_ATTR_SYS_DFILE_COUNT) 
    17311730    { 
    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; 
    17331736    } 
    17341737 
     
    18341837        sys_mask |= PVFS_ATTR_SYS_DFILE_COUNT; 
    18351838    } 
     1839    if (obj_mask & PVFS_ATTR_META_MIRROR_DFILES) 
     1840    { 
     1841        sys_mask |= PVFS_ATTR_SYS_MIRROR_COPIES_COUNT; 
     1842    } 
    18361843    if (obj_mask & PVFS_ATTR_META_DIST) 
    18371844    { 
  • branches/cu-security-branch/src/common/misc/server-config.c

    r8365 r8397  
    3535 
    3636static DOTCONF_CB(get_logstamp); 
    37 static DOTCONF_CB(get_storage_space); 
     37static DOTCONF_CB(get_storage_path); 
     38static DOTCONF_CB(get_data_path); 
     39static DOTCONF_CB(get_meta_path); 
    3840static DOTCONF_CB(enter_defaults_context); 
    3941static DOTCONF_CB(exit_defaults_context); 
     
    7981static DOTCONF_CB(get_bmi_module_list); 
    8082static DOTCONF_CB(get_flow_module_list); 
     83 
     84static DOTCONF_CB(get_root_squash); 
     85static DOTCONF_CB(get_root_squash_exceptions); 
    8186static DOTCONF_CB(get_read_only); 
     87static DOTCONF_CB(get_all_squash); 
     88static DOTCONF_CB(get_anon_gid); 
     89static DOTCONF_CB(get_anon_uid); 
     90 
    8291static DOTCONF_CB(get_handle_recycle_timeout_seconds); 
    8392static DOTCONF_CB(get_flow_buffer_size_bytes); 
     
    346355 
    347356     /* 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.. 
    350360      */ 
    351361     {"<ExportOptions>",ARG_NONE, enter_export_options_context, NULL,CTX_FILESYSTEM, 
     
    546556         CTX_DEFAULTS|CTX_SERVER_OPTIONS,"50"}, 
    547557 
    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  
    550567     * in the Defaults context. 
    551568     * 
     
    554571     * Example: 
    555572     * 
    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, 
    559603        CTX_DEFAULTS|CTX_SERVER_OPTIONS,NULL}, 
    560604 
     
    691735     * usec: [%H:%M:%S.%U] 
    692736     * 
    693      * datetime: [%m/%d %H:%M] 
     737     * datetime: [%m/%d/%Y %H:%M:%S] 
    694738     * 
    695739     * thread: [%H:%M:%S.%U (%lu)] 
     
    721765     * to the rest of the world. 
    722766     */ 
     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, ""}, 
    723788 
    724789    /* ReadOnly option specifies whether the exported file-system needs to 
     
    734799    {"ReadOnly", ARG_LIST,  get_read_only,    NULL, 
    735800        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"}, 
    736829 
    737830    /* The TROVE storage layer has a management component that deals with 
     
    10071100    } 
    10081101 
    1009     if (server_alias_name && !config_s->storage_path) 
     1102    if (server_alias_name && !config_s->data_path) 
    10101103    { 
    10111104        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); 
    10131113        return 1; 
    10141114    } 
     
    11091209 
    11101210 
    1111 DOTCONF_CB(get_storage_space) 
     1211DOTCONF_CB(get_storage_path) 
    11121212{ 
    11131213    struct server_configuration_s *config_s =  
     
    11181218        return NULL; 
    11191219    } 
    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 
     1238DOTCONF_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 
     1257DOTCONF_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 = 
    11251272        (cmd->data.str ? strdup(cmd->data.str) : NULL); 
    11261273    return NULL; 
     
    17391886} 
    17401887 
     1888DOTCONF_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 
     1936DOTCONF_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 
    17411980DOTCONF_CB(get_read_only) 
    17421981{ 
     
    17822021                cmd->arg_count); 
    17832022    } 
     2023    return NULL; 
     2024} 
     2025 
     2026DOTCONF_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 
     2073DOTCONF_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 
     2093DOTCONF_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; 
    17842110    return NULL; 
    17852111} 
     
    26702996        } 
    26712997 
    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; 
    26763008        } 
    26773009 
     
    29813313            free(fs->ro_netmasks); 
    29823314            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; 
    29833348        } 
    29843349        free(fs); 
     
    30973462        dest_fs->exp_flags    = src_fs->exp_flags; 
    30983463        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; 
    30993466        if (src_fs->ro_count > 0 && src_fs->ro_hosts) 
    31003467        { 
     
    31143481            memcpy(dest_fs->ro_netmasks, src_fs->ro_netmasks, src_fs->ro_count * sizeof(int)); 
    31153482        } 
     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; 
    31163519 
    31173520        dest_fs->fp_buffer_size = src_fs->fp_buffer_size; 
     
    31193522    } 
    31203523} 
     3524 
    31213525 
    31223526static host_alias_s *find_host_alias_ptr_by_alias( 
     
    41064510 
    41074511            ret = pvfs2_mkspace( 
    4108                 config->storage_path, cur_fs->file_system_name, 
     4512                config->data_path, config->meta_path, cur_fs->file_system_name, 
    41094513                cur_fs->coll_id, root_handle, cur_meta_handle_range, 
    41104514                cur_data_handle_range, create_collection_only, 1); 
     
    41614565                (remove_collection_only ? "collection" : 
    41624566                 "storage space")); 
    4163             ret = pvfs2_rmspace(config->storage_path, 
     4567            ret = pvfs2_rmspace(config->data_path, 
     4568                                config->meta_path, 
    41644569                                cur_fs->file_system_name, 
    41654570                                cur_fs->coll_id, 
  • branches/cu-security-branch/src/common/misc/server-config.h

    r8332 r8397  
    103103    int   *ro_netmasks; 
    104104 
     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 
    105120    int32_t small_file_size; 
    106121 
     
    125140} distribution_configuration; 
    126141 
    127 enum security_keyword 
    128 { 
    129     SECURITY_KEYWORD_EMAIL, 
    130     SECURITY_KEYWORD_EMAIL_REGEX, 
    131     SECURITY_KEYWORD_SUBJECT, 
    132     SECURITY_KEYWORD_SUBJECT_REGEX, 
    133 }; 
    134  
    135142typedef struct server_configuration_s 
    136143{ 
     
    139146    char *server_alias;             /* the command line server-alias parameter */ 
    140147    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 */ 
    142150    char *fs_config_filename;       /* the fs.conf file name            */ 
    143151    size_t fs_config_buflen;        /* the fs.conf file length          */ 
  • branches/cu-security-branch/src/common/misc/state-machine-fns.c

    r7941 r8397  
    431431{ 
    432432    return smcb->op == PVFS_SERVER_GET_CONFIG  
    433         || smcb->op == PVFS_SERVER_FETCH_CONFIG 
    434433        || smcb->op == PVFS_CLIENT_JOB_TIMER  
    435434        || smcb->op == PVFS_CLIENT_PERF_COUNT_TIMER  
  • branches/cu-security-branch/src/common/misc/state-machine.h

    r8330 r8397  
    5050    SM_RUN     = 9 
    5151}; 
     52 
     53/*define msgpairarray parameters for server-to-server requests*/ 
     54#define PINT_serv_init_msgarray_params(sm_p, __fsid)             \ 
     55do {                                                             \ 
     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)                                                       
    5273 
    5374/* these define things like stack size and so forth for the common 
     
    204225                        int *remaining); 
    205226 
    206 /* This macro is used in calls to PINT_sm_fram() */ 
     227/* This macro is used in calls to PINT_sm_frame() */ 
    207228#define PINT_FRAME_CURRENT 0 
     229#define PINT_FRAME_TOP 1 
    208230 
    209231struct PINT_state_machine_s pvfs2_void_sm; 
  • branches/cu-security-branch/src/common/misc/str-utils.c

    r8330 r8397  
    144144 
    145145    /* 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 */ 
    156159 
    157160    /* at this point, the string is back in its original state */ 
    158161 
    159162    /* 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 */ 
    162167 
    163168    *inout_segp = ptr; 
    164169 
    165170    /* 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; 
    172180    } 
    173181    return 0; 
     
    312320    for(i =0; i < pathlen; i++) 
    313321    { 
    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        } 
    322330    } 
    323331 
     
    356364    if (!comma_list || !tokens) 
    357365    { 
    358         return (0); 
     366        return (0); 
    359367    } 
    360368 
     
    363371    while ((holder = index(holder, ','))) 
    364372    { 
    365         tokencount++; 
    366         holder++; 
     373        tokencount++; 
     374        holder++; 
    367375    } 
    368376 
     
    380388    if (!(*tokens)) 
    381389    { 
    382         return 0; 
     390        return 0; 
    383391    } 
    384392 
    385393    if(1 == tokencount) 
    386394    { 
    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; 
    394402    } 
    395403 
     
    399407    for (i = 0; i < tokencount && holder; i++) 
    400408    { 
    401         holder2 = index(holder, ','); 
    402         if (!holder2) 
    403         { 
    404             holder2 = end; 
    405         } 
     409        holder2 = index(holder, ','); 
     410        if (!holder2) 
     411        { 
     412            holder2 = end; 
     413        } 
    406414        if (holder2 - holder == 0) { 
    407415            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'; 
    417425        assert(strlen((*tokens)[i]) != 0); 
    418         holder = holder2 + 1; 
    419     } 
    420  
    421 out: 
     426        holder = holder2 + 1; 
     427    } 
     428 
    422429    return (retval); 
    423430 
    424   failure: 
     431failure: 
    425432 
    426433    /* free up any memory we allocated if we failed */ 
    427434    if (*tokens) 
    428435    { 
    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); 
    437444    } 
    438445    return (0);