diff options
author | Jeff Darcy <jdarcy@redhat.com> | 2014-02-11 14:02:43 +0000 |
---|---|---|
committer | Jeff Darcy <jdarcy@redhat.com> | 2014-02-11 14:02:43 +0000 |
commit | 0d92798e88c5444fb2cc23663b4ea9a345887756 (patch) | |
tree | a71f336115753242e8690547f403405a3373ddf1 /libglusterfs | |
parent | 33939dcde38389373e7ed8b12c6e9916b39411d0 (diff) | |
parent | 408d50a64b7b3a9d6a4899060baa423ff126cc5f (diff) |
Merge remote-tracking branch 'upstream/master'
Conflicts:
xlators/mgmt/glusterd/src/Makefile.am
Change-Id: Ida5ec4aecc358cb2268bdfdb1a8c9bab750f9575
Diffstat (limited to 'libglusterfs')
-rw-r--r-- | libglusterfs/src/client_t.c | 66 | ||||
-rw-r--r-- | libglusterfs/src/client_t.h | 2 | ||||
-rw-r--r-- | libglusterfs/src/common-utils.h | 1 | ||||
-rw-r--r-- | libglusterfs/src/dict.c | 4 | ||||
-rw-r--r-- | libglusterfs/src/globals.h | 6 | ||||
-rw-r--r-- | libglusterfs/src/glusterfs.h | 7 | ||||
-rw-r--r-- | libglusterfs/src/list.h | 15 | ||||
-rw-r--r-- | libglusterfs/src/mem-types.h | 5 | ||||
-rw-r--r-- | libglusterfs/src/store.c | 5 | ||||
-rw-r--r-- | libglusterfs/src/xlator.c | 3 |
10 files changed, 65 insertions, 49 deletions
diff --git a/libglusterfs/src/client_t.c b/libglusterfs/src/client_t.c index 06447dc5d..1bf3de3f5 100644 --- a/libglusterfs/src/client_t.c +++ b/libglusterfs/src/client_t.c @@ -21,7 +21,6 @@ #include "config.h" #endif - static int gf_client_chain_client_entries (cliententry_t *entries, uint32_t startidx, uint32_t endcount) @@ -82,8 +81,9 @@ gf_client_clienttable_expand (clienttable_t *clienttable, uint32_t nr) memcpy (clienttable->cliententries, oldclients, cpy); } - gf_client_chain_client_entries (clienttable->cliententries, oldmax_clients, - clienttable->max_clients); + gf_client_chain_client_entries (clienttable->cliententries, + oldmax_clients, + clienttable->max_clients); /* Now that expansion is done, we must update the client list * head pointer so that the client allocation functions can continue @@ -149,6 +149,24 @@ gf_client_clienttable_destroy (clienttable_t *clienttable) } } + +/* + * a more comprehensive feature test is shown at + * http://lists.iptel.org/pipermail/semsdev/2010-October/005075.html + * this is sufficient for RHEL5 i386 builds + */ +#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) && !defined(__i386__) +# define INCREMENT_ATOMIC(lk,op) __sync_add_and_fetch(&op, 1) +# define DECREMENT_ATOMIC(lk,op) __sync_sub_and_fetch(&op, 1) +#else +/* These are only here for old gcc, e.g. on RHEL5 i386. + * We're not ever going to use this in an if stmt, + * but let's be pedantically correct for style points */ +# define INCREMENT_ATOMIC(lk,op) do { LOCK (&lk); ++op; UNLOCK (&lk); } while (0) +/* this is a gcc 'statement expression', it works with llvm/clang too */ +# define DECREMENT_ATOMIC(lk,op) ({ LOCK (&lk); --op; UNLOCK (&lk); op; }) +#endif + client_t * gf_client_get (xlator_t *this, struct rpcsvc_auth_data *cred, char *client_uid) { @@ -184,15 +202,8 @@ gf_client_get (xlator_t *this, struct rpcsvc_auth_data *cred, char *client_uid) memcmp (cred->authdata, client->auth.data, client->auth.len) == 0))) { -#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) - __sync_add_and_fetch(&client->ref.bind, 1); -#else - LOCK (&client->ref.lock); - { - ++client->ref.bind; - } - UNLOCK (&client->ref.lock); -#endif + INCREMENT_ATOMIC (client->ref.lock, + client->ref.bind); break; } } @@ -274,15 +285,7 @@ gf_client_put (client_t *client, gf_boolean_t *detached) if (detached) *detached = _gf_false; -#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) - bind_ref = __sync_sub_and_fetch(&client->ref.bind, 1); -#else - LOCK (&client->ref.lock); - { - bind_ref = --client->ref.bind; - } - UNLOCK (&client->ref.lock); -#endif + bind_ref = DECREMENT_ATOMIC (client->ref.lock, client->ref.bind); if (bind_ref == 0) unref = _gf_true; @@ -295,7 +298,6 @@ gf_client_put (client_t *client, gf_boolean_t *detached) } } - client_t * gf_client_ref (client_t *client) { @@ -304,15 +306,7 @@ gf_client_ref (client_t *client) return NULL; } -#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) - __sync_add_and_fetch(&client->ref.count, 1); -#else - LOCK (&client->ref.lock); - { - ++client->ref.count; - } - UNLOCK (&client->ref.lock); -#endif + INCREMENT_ATOMIC (client->ref.lock, client->ref.count); return client; } @@ -391,15 +385,7 @@ gf_client_unref (client_t *client) return; } -#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) - refcount = __sync_sub_and_fetch(&client->ref.count, 1); -#else - LOCK (&client->ref.lock); - { - refcount = --client->ref.count; - } - UNLOCK (&client->ref.lock); -#endif + refcount = DECREMENT_ATOMIC (client->ref.lock, client->ref.count); if (refcount == 0) { client_destroy (client); } diff --git a/libglusterfs/src/client_t.h b/libglusterfs/src/client_t.h index 548081896..4113b9da9 100644 --- a/libglusterfs/src/client_t.h +++ b/libglusterfs/src/client_t.h @@ -44,6 +44,8 @@ typedef struct _client_t { int flavour; size_t len; char *data; + char *username; + char *passwd; } auth; } client_t; diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h index 6f8436fcb..e3b019b9e 100644 --- a/libglusterfs/src/common-utils.h +++ b/libglusterfs/src/common-utils.h @@ -106,6 +106,7 @@ enum _gf_client_pid GF_CLIENT_PID_GSYNCD = -1, GF_CLIENT_PID_HADOOP = -2, GF_CLIENT_PID_DEFRAG = -3, + GF_CLIENT_PID_NO_ROOT_SQUASH = -4, }; typedef enum _gf_boolean gf_boolean_t; diff --git a/libglusterfs/src/dict.c b/libglusterfs/src/dict.c index e9fc1222d..7bc5d57b0 100644 --- a/libglusterfs/src/dict.c +++ b/libglusterfs/src/dict.c @@ -801,6 +801,8 @@ data_from_dynstr (char *value) data_t *data = get_new_data (); + if (!data) + return NULL; data->len = strlen (value) + 1; data->data = value; @@ -817,6 +819,8 @@ data_from_dynmstr (char *value) data_t *data = get_new_data (); + if (!data) + return NULL; data->len = strlen (value) + 1; data->data = value; data->is_stdalloc = 1; diff --git a/libglusterfs/src/globals.h b/libglusterfs/src/globals.h index 3085db21c..16ab96268 100644 --- a/libglusterfs/src/globals.h +++ b/libglusterfs/src/globals.h @@ -21,16 +21,18 @@ * * 3.3.0 - 1 * 3.4.0 - 2 - * 3.next (3.5?) - 3 + * 3.5.0 - 3 + * 3.next (3.6?) - 4 * * TODO: Change above comment once gluster version is finalised * TODO: Finalize the op-version ranges */ #define GD_OP_VERSION_MIN 1 /* MIN is the fresh start op-version, mostly should not change */ -#define GD_OP_VERSION_MAX 3 /* MAX VERSION is the maximum count in VME table, +#define GD_OP_VERSION_MAX 4 /* MAX VERSION is the maximum count in VME table, should keep changing with introduction of newer versions */ +#define GD_OP_VERSION_4 4 /* Op-Version 4 */ #include "xlator.h" diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h index 517e4270a..f537110d7 100644 --- a/libglusterfs/src/glusterfs.h +++ b/libglusterfs/src/glusterfs.h @@ -364,9 +364,10 @@ struct _cmd_args { int aux_gfid_mount; struct list_head xlator_options; /* list of xlator_option_t */ - /* fuse options */ - int fuse_direct_io_mode; - char *use_readdirp; + /* fuse options */ + int fuse_direct_io_mode; + char *use_readdirp; + int no_root_squash; int volfile_check; double fuse_entry_timeout; double fuse_negative_timeout; diff --git a/libglusterfs/src/list.h b/libglusterfs/src/list.h index 6fcf17f35..c9a2fb070 100644 --- a/libglusterfs/src/list.h +++ b/libglusterfs/src/list.h @@ -46,6 +46,21 @@ list_add_tail (struct list_head *new, struct list_head *head) static inline void +list_add_order (struct list_head *new, struct list_head *head, + int (*compare)(struct list_head *, struct list_head *)) +{ + struct list_head *pos = head->next; + + while ( pos != head ) { + if (compare(new, pos) <= 0) + break; + pos = pos->next; + } + + list_add_tail(new, pos); +} + +static inline void list_del (struct list_head *old) { old->prev->next = old->next; diff --git a/libglusterfs/src/mem-types.h b/libglusterfs/src/mem-types.h index 726d38eb6..26237fecb 100644 --- a/libglusterfs/src/mem-types.h +++ b/libglusterfs/src/mem-types.h @@ -119,6 +119,9 @@ enum gf_common_mem_types_ { gf_common_mt_syncopctx = 103, gf_common_mt_iobrefs = 104, gf_common_mt_gsync_status_t = 105, - gf_common_mt_end = 106 + gf_common_mt_uuid_t = 106, + gf_common_mt_vol_lock_obj_t = 107, + gf_common_mt_txn_opinfo_obj_t = 108, + gf_common_mt_end = 109 }; #endif diff --git a/libglusterfs/src/store.c b/libglusterfs/src/store.c index 5af23592b..66a5906a3 100644 --- a/libglusterfs/src/store.c +++ b/libglusterfs/src/store.c @@ -362,12 +362,11 @@ gf_store_handle_new (char *path, gf_store_handle_t **handle) goto out; spath = gf_strdup (path); - if (!spath) goto out; fd = open (path, O_RDWR | O_CREAT | O_APPEND, 0600); - if (fd <= 0) { + if (fd < 0) { gf_log ("", GF_LOG_ERROR, "Failed to open file: %s, error: %s", path, strerror (errno)); goto out; @@ -383,7 +382,7 @@ gf_store_handle_new (char *path, gf_store_handle_t **handle) ret = 0; out: - if (fd > 0) + if (fd >= 0) close (fd); if (ret == -1) { diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c index 9ce52407f..f3df8e2ae 100644 --- a/libglusterfs/src/xlator.c +++ b/libglusterfs/src/xlator.c @@ -149,10 +149,13 @@ xlator_volopt_dynload (char *xlator_type, void **dl_handle, } *dl_handle = handle; + handle = NULL; ret = 0; out: GF_FREE (name); + if (handle) + dlclose (handle); gf_log ("xlator", GF_LOG_DEBUG, "Returning %d", ret); return ret; |