[Pvfs2-cvs] commit by kunkel in pvfs2/src/common/misc:
msgpairarray.sm pint-cached-config.c pint-cached-config.h
pint-util.c pint-util.h pvfs2-internal.h server-config-mgr.c
server-config.c server-config.h
CVS commit program
cvs at parl.clemson.edu
Tue Aug 29 06:41:15 EDT 2006
Update of /projects/cvsroot/pvfs2/src/common/misc
In directory parlweb1:/tmp/cvs-serv30492/src/common/misc
Modified Files:
Tag: kunkel-branch
msgpairarray.sm pint-cached-config.c pint-cached-config.h
pint-util.c pint-util.h pvfs2-internal.h server-config-mgr.c
server-config.c server-config.h
Log Message:
Backmerge with HEAD
Index: msgpairarray.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/msgpairarray.sm,v
diff -p -u -r1.35.6.1 -r1.35.6.2
--- msgpairarray.sm 26 Aug 2006 13:37:45 -0000 1.35.6.1
+++ msgpairarray.sm 29 Aug 2006 10:41:15 -0000 1.35.6.2
@@ -38,7 +38,6 @@
#include "pint-cached-config.h"
#include "job.h"
#include "gossip.h"
-#include "pint-servreq.h"
#include "PINT-reqproto-encode.h"
#include "pvfs2-util.h"
#include "pint-util.h"
Index: pint-cached-config.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/pint-cached-config.c,v
diff -p -u -r1.17.4.4 -r1.17.4.5
--- pint-cached-config.c 22 Aug 2006 10:54:18 -0000 1.17.4.4
+++ pint-cached-config.c 29 Aug 2006 10:41:15 -0000 1.17.4.5
@@ -14,13 +14,85 @@
#include "pvfs2-attr.h"
#include "pint-sysint-utils.h"
#include "bmi.h"
-#include "dotconf.h"
#include "trove.h"
#include "server-config.h"
#include "quickhash.h"
#include "extent-utils.h"
#include "pint-cached-config.h"
+/* maps bmi address to handle ranges/extents */
+struct bmi_host_extent_table_s
+{
+ char *bmi_address;
+
+ /* ptrs are type struct extent */
+ PINT_llist *extent_list;
+};
+
+struct config_fs_cache_s
+{
+ struct qlist_head hash_link;
+ struct filesystem_configuration_s *fs;
+
+ /* ptrs are struct bmi_host_extent_table_s */
+ PINT_llist *bmi_host_extent_tables;
+
+ /* index into fs->meta_handle_ranges obj (see server-config.h) */
+ PINT_llist *meta_server_cursor;
+
+ /* index into fs->data_handle_ranges obj (see server-config.h) */
+ PINT_llist *data_server_cursor;
+
+ /*
+ the following fields are used to cache arrays of unique physical
+ server addresses, of particular use to the mgmt interface
+ */
+ phys_server_desc_s* io_server_array;
+ int io_server_count;
+ phys_server_desc_s* meta_server_array;
+ int meta_server_count;
+ phys_server_desc_s* server_array;
+ int server_count;
+
+};
+
+#define map_handle_range_to_extent_list(hrange_list) \
+do { cur = hrange_list; \
+ while(cur) { \
+ cur_mapping = PINT_llist_head(cur); \
+ if (!cur_mapping) break; \
+ assert(cur_mapping->alias_mapping); \
+ assert(cur_mapping->alias_mapping->host_alias); \
+ assert(cur_mapping->handle_range); \
+ cur_host_extent_table = malloc( \
+ sizeof(struct bmi_host_extent_table_s)); \
+ if (!cur_host_extent_table) { \
+ ret = -ENOMEM; \
+ break; \
+ } \
+ cur_host_extent_table->bmi_address = \
+ PINT_config_get_host_addr_ptr( \
+ config,cur_mapping->alias_mapping->host_alias); \
+ assert(cur_host_extent_table->bmi_address); \
+ cur_host_extent_table->extent_list = \
+ PINT_create_extent_list(cur_mapping->handle_range); \
+ if (!cur_host_extent_table->extent_list) { \
+ free(cur_host_extent_table); \
+ ret = -ENOMEM; \
+ break; \
+ } \
+ /* \
+ add this host to extent list mapping to \
+ config cache object's host extent table \
+ */ \
+ ret = PINT_llist_add_to_tail( \
+ cur_config_fs_cache->bmi_host_extent_tables, \
+ cur_host_extent_table); \
+ assert(ret == 0); \
+ cur = PINT_llist_next(cur); \
+ } } while(0)
+
+
struct qhash_table *PINT_fsid_config_cache_table = NULL;
/* these are based on code from src/server/request-scheduler.c */
@@ -1330,12 +1402,12 @@ static int hash_fsid(void *fsid, int tab
*/
static int hash_fsid_compare(void *key, struct qlist_head *link)
{
- config_fs_cache_s *fs_info = NULL;
+ struct config_fs_cache_s *fs_info = NULL;
PVFS_fs_id *real_fsid = (PVFS_fs_id *)key;
assert(PINT_fsid_config_cache_table);
- fs_info = qlist_entry(link, config_fs_cache_s, hash_link);
+ fs_info = qlist_entry(link, struct config_fs_cache_s, hash_link);
if ((PVFS_fs_id)fs_info->fs->coll_id == *real_fsid)
{
return 1;
Index: pint-cached-config.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/pint-cached-config.h,v
diff -p -u -r1.7.22.2 -r1.7.22.3
--- pint-cached-config.h 22 Aug 2006 10:54:18 -0000 1.7.22.2
+++ pint-cached-config.h 29 Aug 2006 10:41:15 -0000 1.7.22.3
@@ -11,7 +11,6 @@
#include "pvfs2-storage.h"
#include "pvfs2-mgmt.h"
#include "bmi.h"
-#include "dotconf.h"
#include "trove.h"
#include "server-config.h"
@@ -121,42 +120,6 @@ int PINT_cached_config_get_handle_timeou
int PINT_cached_config_reinitialize(
struct server_configuration_s *config);
-
-#define map_handle_range_to_extent_list(hrange_list) \
-do { cur = hrange_list; \
- while(cur) { \
- cur_mapping = PINT_llist_head(cur); \
- if (!cur_mapping) break; \
- assert(cur_mapping->alias_mapping); \
- assert(cur_mapping->alias_mapping->host_alias); \
- assert(cur_mapping->handle_range); \
- cur_host_extent_table = (bmi_host_extent_table_s *)malloc( \
- sizeof(bmi_host_extent_table_s)); \
- if (!cur_host_extent_table) { \
- ret = -ENOMEM; \
- break; \
- } \
- cur_host_extent_table->bmi_address = \
- PINT_config_get_host_addr_ptr( \
- config,cur_mapping->alias_mapping->host_alias); \
- assert(cur_host_extent_table->bmi_address); \
- cur_host_extent_table->extent_list = \
- PINT_create_extent_list(cur_mapping->handle_range); \
- if (!cur_host_extent_table->extent_list) { \
- free(cur_host_extent_table); \
- ret = -ENOMEM; \
- break; \
- } \
- /* \
- add this host to extent list mapping to \
- config cache object's host extent table \
- */ \
- ret = PINT_llist_add_to_tail( \
- cur_config_fs_cache->bmi_host_extent_tables, \
- cur_host_extent_table); \
- assert(ret == 0); \
- cur = PINT_llist_next(cur); \
- } } while(0)
#endif /* __PINT_CACHED_CONFIG_H */
Index: pint-util.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/pint-util.c,v
diff -p -u -r1.10.4.2 -r1.10.4.3
--- pint-util.c 24 Jul 2006 17:20:22 -0000 1.10.4.2
+++ pint-util.c 29 Aug 2006 10:41:15 -0000 1.10.4.3
@@ -25,6 +25,7 @@
#include "gen-locks.h"
#include "gossip.h"
#include "pvfs2-debug.h"
+#include "bmi-byteswap.h"
static int current_tag = 1;
static gen_mutex_t current_tag_lock = GEN_MUTEX_INITIALIZER;
@@ -302,7 +303,7 @@ void PINT_free_object_attr(PVFS_object_a
* checks to see if the type of access described by "access_type" is permitted
* for user "uid" of group "gid" on the object with attributes "attr"
*
- * returns 0 on success, -PVFS_EPERM if permission is not granted
+ * returns 0 on success, -PVFS_EACCES if permission is not granted
*/
int PINT_check_mode(
PVFS_object_attr *attr,
@@ -451,8 +452,9 @@ int PINT_check_mode(
gossip_debug(GOSSIP_PERMISSIONS_DEBUG, " - no\n");
}
+ gossip_debug(GOSSIP_PERMISSIONS_DEBUG, "******PINT_check_mode: denying access\n");
/* default case: access denied */
- return -PVFS_EPERM;
+ return -PVFS_EACCES;
}
/* PINT_check_group()
@@ -556,6 +558,144 @@ static int PINT_check_group(uid_t uid, g
return(-PVFS_ENOENT);
}
+/* Checks if a given user is part of any groups that matches the file gid */
+static int in_group_p(PVFS_uid uid, PVFS_gid gid, PVFS_gid attr_group)
+{
+ if (attr_group == gid)
+ return 1;
+ if (PINT_check_group(uid, attr_group) == 0)
+ return 1;
+ return 0;
+}
+
+/*
+ * Return 0 if requesting clients is granted want access to the object
+ * by the acl. Returns -PVFS_E... otherwise.
+ */
+int PINT_check_acls(void *acl_buf, size_t acl_size,
+ PVFS_object_attr *attr,
+ PVFS_uid uid, PVFS_gid gid, int want)
+{
+ pvfs2_acl_entry pe, *pa;
+ int i = 0, found = 0, count = 0;
+ uint32_t perm_mask = (PVFS_ATTR_COMMON_UID |
+ PVFS_ATTR_COMMON_GID |
+ PVFS_ATTR_COMMON_PERM);
+
+ if (acl_size == 0)
+ {
+ gossip_debug(GOSSIP_PERMISSIONS_DEBUG, "no acl's present.. denying access\n");
+ return -PVFS_EACCES;
+ }
+
+ /* keyval for ACLs includes a \0. so subtract the thingie */
+ acl_size--;
+ gossip_debug(GOSSIP_PERMISSIONS_DEBUG, "PINT_check_acls: read keyval size "
+ " %d (%d acl entries)\n",
+ (int) acl_size,
+ (int) (acl_size / sizeof(pvfs2_acl_entry)));
+ gossip_debug(GOSSIP_PERMISSIONS_DEBUG, "uid = %d, gid = %d, want = %d\n",
+ uid, gid, want);
+
+ assert((attr->mask & perm_mask) == perm_mask);
+ assert(acl_buf);
+ assert(acl_size % sizeof(pvfs2_acl_entry) == 0);
+ count = acl_size / sizeof(pvfs2_acl_entry);
+
+ for (i = 0; i < count; i++)
+ {
+ pa = (pvfs2_acl_entry *) acl_buf + i;
+ /*
+ NOTE: Remember that keyval is encoded as lebf, so convert it
+ to host representation
+ */
+ pe.p_tag = bmitoh32(pa->p_tag);
+ pe.p_perm = bmitoh32(pa->p_perm);
+ pe.p_id = bmitoh32(pa->p_id);
+ pa = &pe;
+ gossip_debug(GOSSIP_PERMISSIONS_DEBUG, "Decoded ACL entry %d "
+ "(p_tag %d, p_perm %d, p_id %d)\n",
+ i, pa->p_tag, pa->p_perm, pa->p_id);
+ switch(pa->p_tag)
+ {
+ case PVFS2_ACL_USER_OBJ:
+ /* (May have been checked already) */
+ if (attr->owner == uid)
+ goto check_perm;
+ break;
+ case PVFS2_ACL_USER:
+ if (pa->p_id == uid)
+ goto mask;
+ break;
+ case PVFS2_ACL_GROUP_OBJ:
+ if (in_group_p(uid, gid, attr->group))
+ {
+ found = 1;
+ if ((pa->p_perm & want) == want)
+ goto mask;
+ }
+ break;
+ case PVFS2_ACL_GROUP:
+ if (in_group_p(uid, gid, pa->p_id)) {
+ found = 1;
+ if ((pa->p_perm & want) == want)
+ goto mask;
+ }
+ break;
+ case PVFS2_ACL_MASK:
+ break;
+ case PVFS2_ACL_OTHER:
+ if (found)
+ {
+ gossip_debug(GOSSIP_PERMISSIONS_DEBUG, "(1) PINT_check_acls:"
+ "returning access denied\n");
+ return -PVFS_EACCES;
+ }
+ else
+ goto check_perm;
+ default:
+ gossip_debug(GOSSIP_PERMISSIONS_DEBUG, "(2) PINT_check_acls: "
+ "returning EIO\n");
+ return -PVFS_EIO;
+ }
+ }
+ gossip_debug(GOSSIP_PERMISSIONS_DEBUG, "(3) PINT_check_acls: returning EIO\n");
+ return -PVFS_EIO;
+mask:
+ /* search the remaining entries */
+ i = i + 1;
+ for (; i < count; i++)
+ {
+ pvfs2_acl_entry me, *mask_obj = (pvfs2_acl_entry *) acl_buf + i;
+
+ /*
+ NOTE: Again, since pvfs2_acl_entry is in lebf, we need to
+ convert it to host endian format
+ */
+ me.p_tag = bmitoh32(mask_obj->p_tag);
+ me.p_perm = bmitoh32(mask_obj->p_perm);
+ me.p_id = bmitoh32(mask_obj->p_id);
+ mask_obj = &me;
+ gossip_debug(GOSSIP_PERMISSIONS_DEBUG, "Decoded (mask) ACL entry %d "
+ "(p_tag %d, p_perm %d, p_id %d)\n",
+ i, mask_obj->p_tag, mask_obj->p_perm, mask_obj->p_id);
+ if (mask_obj->p_tag == PVFS2_ACL_MASK)
+ {
+ if ((pa->p_perm & mask_obj->p_perm & want) == want)
+ return 0;
+ gossip_debug(GOSSIP_PERMISSIONS_DEBUG, "(4) PINT_check_acls:"
+ "returning access denied (mask)\n");
+ return -PVFS_EACCES;
+ }
+ }
+
+check_perm:
+ if ((pa->p_perm & want) == want)
+ return 0;
+ gossip_debug(GOSSIP_PERMISSIONS_DEBUG, "(5) PINT_check_acls: returning"
+ "access denied\n");
+ return -PVFS_EACCES;
+}
/*
* Local variables:
Index: pint-util.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/pint-util.h,v
diff -p -u -r1.9.16.1 -r1.9.16.2
--- pint-util.h 18 Aug 2006 05:12:03 -0000 1.9.16.1
+++ pint-util.h 29 Aug 2006 10:41:15 -0000 1.9.16.2
@@ -75,6 +75,9 @@ typedef struct PINT_time_marker_s PINT_t
PVFS_msg_tag_t PINT_util_get_next_tag(void);
+int PINT_check_acls(void *acl_buf, size_t acl_size,
+ PVFS_object_attr *attr,
+ PVFS_uid uid, PVFS_gid gid, int want);
int PINT_copy_object_attr(PVFS_object_attr *dest, PVFS_object_attr *src);
void PINT_free_object_attr(PVFS_object_attr *attr);
void PINT_time_mark(PINT_time_marker* out_marker);
Index: pvfs2-internal.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/pvfs2-internal.h,v
diff -p -u -r1.3.2.1 -r1.3.2.2
--- pvfs2-internal.h 25 Jul 2006 19:20:42 -0000 1.3.2.1
+++ pvfs2-internal.h 29 Aug 2006 10:41:15 -0000 1.3.2.2
@@ -46,7 +46,6 @@
#define METAFILE_DIST_KEYSTR "md"
#define SYMLINK_TARGET_KEYSTR "st"
-
#define IO_MAX_REGIONS 64
/*
* Must be a multiple of pagesize (reused for O_DIRECT)
Index: server-config-mgr.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/server-config-mgr.c,v
diff -p -u -r1.14.24.2 -r1.14.24.3
--- server-config-mgr.c 24 Jul 2006 17:20:22 -0000 1.14.24.2
+++ server-config-mgr.c 29 Aug 2006 10:41:15 -0000 1.14.24.3
@@ -119,7 +119,8 @@ int PINT_server_config_mgr_finalize(void
assert(config);
assert(config->server_config);
- config->server_config = NULL;
+ PINT_config_release(config->server_config);
+ free(config->server_config);
gen_mutex_destroy(config->server_config_mutex);
free(config);
}
Index: server-config.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/server-config.c,v
diff -p -u -r1.85.2.5 -r1.85.2.6
--- server-config.c 18 Aug 2006 05:12:03 -0000 1.85.2.5
+++ server-config.c 29 Aug 2006 10:41:15 -0000 1.85.2.6
@@ -14,7 +14,7 @@
#include <assert.h>
#include <ctype.h>
-#include "dotconf.h"
+#include "src/common/dotconf/dotconf.h"
#include "server-config.h"
#include "pvfs2.h"
#include "job.h"
@@ -601,6 +601,14 @@ static const configoption_t options[] =
{"FlowBuffersPerFlow", ARG_INT,
get_flow_buffers_per_flow, NULL, CTX_FILESYSTEM,"8"},
+ /* buffer size to use for bulk data transfers */
+ {"FlowBufferSizeBytes", ARG_INT,
+ get_flow_buffer_size_bytes, NULL, CTX_FILESYSTEM,"262144"},
+
+ /* number of buffers to use for bulk data transfers */
+ {"FlowBuffersPerFlow", ARG_INT,
+ get_flow_buffers_per_flow, NULL, CTX_FILESYSTEM,"8"},
+
/* The TROVE storage layer has a management component that deals with
* allocating handle values for new metafiles and datafiles. The underlying
* trove module can be given a hint to tell it how long to wait before
@@ -1228,6 +1236,9 @@ DOTCONF_CB(get_logfile)
{
struct server_configuration_s *config_s =
(struct server_configuration_s *)cmd->context;
+ /* free whatever was added in set_defaults phase */
+ if (config_s->logfile)
+ free(config_s->logfile);
config_s->logfile = (cmd->data.str ? strdup(cmd->data.str) : NULL);
return NULL;
}
@@ -1660,6 +1671,8 @@ DOTCONF_CB(get_db_cache_type)
"be either \"sys\" or \"mmap\"\n";
}
+ if (config_s->db_cache_type)
+ free(config_s->db_cache_type);
config_s->db_cache_type = strdup(cmd->data.str);
if(!config_s->db_cache_type)
{
@@ -2053,6 +2066,12 @@ void PINT_config_release(struct server_c
free(config_s->bmi_modules);
config_s->bmi_modules = NULL;
}
+
+ if (config_s->flow_modules)
+ {
+ free(config_s->flow_modules);
+ config_s->flow_modules = NULL;
+ }
#ifdef USE_TRUSTED
if (config_s->allowed_network)
{
@@ -2083,6 +2102,12 @@ void PINT_config_release(struct server_c
PINT_llist_free(config_s->host_aliases,free_host_alias);
config_s->host_aliases = NULL;
}
+
+ if (config_s->db_cache_type)
+ {
+ free(config_s->db_cache_type);
+ config_s->db_cache_type = NULL;
+ }
}
}
@@ -2332,17 +2357,9 @@ static void copy_filesystem(
malloc(sizeof(struct host_handle_mapping_s));
assert(new_h_mapping);
- new_h_mapping->alias_mapping = (struct host_alias_s *)
- malloc(sizeof(struct host_alias_s));
- assert(new_h_mapping->alias_mapping);
-
- new_h_mapping->alias_mapping->host_alias =
- strdup(cur_h_mapping->alias_mapping->host_alias);
- assert(new_h_mapping->alias_mapping->host_alias);
-
- new_h_mapping->alias_mapping->bmi_address =
- strdup(cur_h_mapping->alias_mapping->bmi_address);
- assert(new_h_mapping->alias_mapping->bmi_address);
+ /* these are pointers into another struct with a different
+ * lifetime, do not copy */
+ new_h_mapping->alias_mapping = cur_h_mapping->alias_mapping;
new_h_mapping->handle_range =
strdup(cur_h_mapping->handle_range);
@@ -2371,17 +2388,7 @@ static void copy_filesystem(
malloc(sizeof(struct host_handle_mapping_s));
assert(new_h_mapping);
- new_h_mapping->alias_mapping = (struct host_alias_s *)
- malloc(sizeof(struct host_alias_s));
- assert(new_h_mapping->alias_mapping);
-
- new_h_mapping->alias_mapping->host_alias =
- strdup(cur_h_mapping->alias_mapping->host_alias);
- assert(new_h_mapping->alias_mapping->host_alias);
-
- new_h_mapping->alias_mapping->bmi_address =
- strdup(cur_h_mapping->alias_mapping->bmi_address);
- assert(new_h_mapping->alias_mapping->bmi_address);
+ new_h_mapping->alias_mapping = cur_h_mapping->alias_mapping;
new_h_mapping->handle_range =
strdup(cur_h_mapping->handle_range);
Index: server-config.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/server-config.h,v
diff -p -u -r1.51.2.3 -r1.51.2.4
--- server-config.h 18 Aug 2006 05:12:03 -0000 1.51.2.3
+++ server-config.h 29 Aug 2006 10:41:15 -0000 1.51.2.4
@@ -147,7 +147,7 @@ typedef struct server_configuration_s
int db_cache_size_bytes; /* cache size to use in berkeley db
if zero, use defaults */
char * db_cache_type;
-
+
int trove_io_thread_count;
int trove_alt_aio_mode; /* enables experimental alternative AIO
* implementation for some types of
More information about the Pvfs2-cvs
mailing list