summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarshavardhana Ranganath <harsha@gluster.com>2010-01-26 09:05:41 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-01-26 07:23:19 -0800
commitc15449aaaeb725c49af3817e07ea33c6c09c8c15 (patch)
treed20d46e586109f335e6ea044cc4d4696ecb87310
parent936eac4cec6cf57ab22688cb8f3222d385818c97 (diff)
Revert "Server backend storage hang should not cause the mount point to hang."v3.0.2rc1
This reverts commit a0b148ea4e2a0163548eeb89b7580be4adbb8070. Signed-off-by: Harshavardhana <harsha@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 272 (Server backend storage hang should not cause the mount point to hang) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=272
-rw-r--r--libglusterfs/src/xlator.c4
-rw-r--r--xlators/protocol/server/src/server-helpers.c126
-rw-r--r--xlators/protocol/server/src/server-helpers.h6
-rw-r--r--xlators/protocol/server/src/server-protocol.c39
-rw-r--r--xlators/protocol/server/src/server-protocol.h7
-rw-r--r--xlators/storage/posix/src/posix.c141
-rw-r--r--xlators/storage/posix/src/posix.h11
7 files changed, 23 insertions, 311 deletions
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c
index 650a844..44494a9 100644
--- a/libglusterfs/src/xlator.c
+++ b/libglusterfs/src/xlator.c
@@ -870,6 +870,10 @@ xlator_tree_init (xlator_t *xl)
*/
ret = xlator_init_rec (top);
+ if (ret == 0 && top->notify) {
+ top->notify (top, GF_EVENT_PARENT_UP, NULL);
+ }
+
return ret;
}
diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c
index a336406..f627b6b 100644
--- a/xlators/protocol/server/src/server-helpers.c
+++ b/xlators/protocol/server/src/server-helpers.c
@@ -645,14 +645,13 @@ out:
int
-server_connection_cleanup (xlator_t *this, server_connection_t *conn, transport_t *trans)
+server_connection_cleanup (xlator_t *this, server_connection_t *conn)
{
char do_cleanup = 0;
struct _lock_table *ltable = NULL;
fdentry_t *fdentries = NULL;
uint32_t fd_count = 0;
- int ret = 0;
- int i = 0;
+ int ret = 0;
if (conn == NULL) {
goto out;
@@ -660,12 +659,6 @@ server_connection_cleanup (xlator_t *this, server_connection_t *conn, transport_
pthread_mutex_lock (&conn->lock);
{
- for (i = 0; i < TRANSPORTS_PER_SERVER_CONN; i++) {
- if (conn->transports[i] == trans) {
- conn->transports[i] = NULL;
- transport_unref (trans);
- }
- }
conn->active_transports--;
if (conn->active_transports == 0) {
if (conn->ltable) {
@@ -857,12 +850,11 @@ out:
server_connection_t *
-server_connection_get (xlator_t *this, const char *id, transport_t *trans)
+server_connection_get (xlator_t *this, const char *id)
{
- server_connection_t *conn = NULL;
- server_connection_t *trav = NULL;
- server_conf_t *conf = NULL;
- int i = 0;
+ server_connection_t *conn = NULL;
+ server_connection_t *trav = NULL;
+ server_conf_t *conf = NULL;
conf = this->private;
@@ -884,33 +876,13 @@ server_connection_get (xlator_t *this, const char *id, transport_t *trans)
pthread_mutex_init (&conn->lock, NULL);
- list_add (&conn->list, &conf->conns);
- }
- if (conn->active_transports == TRANSPORTS_PER_SERVER_CONN) {
- gf_log (this->name, GF_LOG_DEBUG,
- "Maximum number of connections allowed is %d",
- TRANSPORTS_PER_SERVER_CONN);
- goto unlock;
- }
-
- for (i = 0; i < TRANSPORTS_PER_SERVER_CONN; i++) {
- if (!conn->transports[i])
- break;
- }
-
- if (i == TRANSPORTS_PER_SERVER_CONN) {
- gf_log (this->name, GF_LOG_DEBUG,
- "Could not find a vacant slot");
- goto unlock;
- }
-
- conn->transports[i] = transport_ref (trans);
+ list_add (&conn->list, &conf->conns);
+ }
conn->ref++;
conn->active_transports++;
- }
-unlock:
- pthread_mutex_unlock (&conf->mutex);
+ }
+ pthread_mutex_unlock (&conf->mutex);
return conn;
}
@@ -946,81 +918,3 @@ server_connection_put (xlator_t *this, server_connection_t *conn)
out:
return;
}
-
-void
-server_child_down (xlator_t *this, xlator_t *bound_xl)
-{
- server_conf_t *conf = NULL;
- server_connection_t *trav = NULL;
- transport_t *trans = NULL;
- int subvol_idx = 0;
- int i = 0;
- xlator_list_t *xltrav = NULL;
-
- conf = this->private;
-
- if (conf == NULL)
- return;
-
- xltrav = this->children;
-
- while (xltrav) {
- if (xltrav->xlator == bound_xl)
- break;
- xltrav = xltrav->next;
- subvol_idx++;
- }
- gf_log (this->name, GF_LOG_DEBUG,
- "subvolume %s(%d) went down", bound_xl->name, subvol_idx);
-
- conf->subvol_list[subvol_idx] = 0;
-
- pthread_mutex_lock (&conf->mutex);
- {
- list_for_each_entry (trav, &conf->conns, list) {
- if (bound_xl == trav->bound_xl) {
- gf_log (this->name, GF_LOG_DEBUG,
- "disonnecting conn=%p", trav);
- for (i = 0; i < TRANSPORTS_PER_SERVER_CONN; i++)
- {
- trans = trav->transports[i];
- if (trans == NULL)
- continue;
- gf_log (this->name, GF_LOG_DEBUG,
- "disconnecting %p(%d)",
- trans, i);
- transport_disconnect (trans);
- }
- }
- }
- }
- pthread_mutex_unlock (&conf->mutex);
-}
-
-void
-server_child_up (xlator_t *this, xlator_t *bound_xl)
-{
- server_conf_t *conf = NULL;
- int subvol_idx = 0;
- xlator_list_t *xltrav = NULL;
-
- conf = this->private;
-
- if (conf == NULL)
- return;
-
- xltrav = this->children;
-
- while (xltrav) {
- if (bound_xl == xltrav->xlator) {
- break;
- }
- subvol_idx++;
- xltrav = xltrav->next;
- }
-
- gf_log (this->name, GF_LOG_DEBUG,
- "subvolume %s(%d) came up", bound_xl->name, subvol_idx);
-
- conf->subvol_list[subvol_idx] = 1;
-}
diff --git a/xlators/protocol/server/src/server-helpers.h b/xlators/protocol/server/src/server-helpers.h
index 5c584b0..867035d 100644
--- a/xlators/protocol/server/src/server-helpers.h
+++ b/xlators/protocol/server/src/server-helpers.h
@@ -69,10 +69,4 @@ gf_direntry_to_bin (dir_entry_t *head, char *bufferp);
void
server_print_request (call_frame_t *frame);
-void
-server_child_up (xlator_t *this, xlator_t *bound_xl);
-
-void
-server_child_down (xlator_t *this, xlator_t *bound_xl);
-
#endif /* __SERVER_HELPERS_H__ */
diff --git a/xlators/protocol/server/src/server-protocol.c b/xlators/protocol/server/src/server-protocol.c
index 8603d41..6603ea4 100644
--- a/xlators/protocol/server/src/server-protocol.c
+++ b/xlators/protocol/server/src/server-protocol.c
@@ -5657,8 +5657,6 @@ mop_setvolume (call_frame_t *frame, xlator_t *bound_xl,
char *volfile_key = NULL;
uint32_t checksum = 0;
int32_t lru_limit = 1024;
- xlator_list_t *xltrav = NULL;
- int subvol_idx = 0;
params = dict_new ();
reply = dict_new ();
@@ -5700,7 +5698,7 @@ mop_setvolume (call_frame_t *frame, xlator_t *bound_xl,
}
- conn = server_connection_get (frame->this, process_uuid, trans);
+ conn = server_connection_get (frame->this, process_uuid);
if (trans->xl_private != conn)
trans->xl_private = conn;
@@ -5867,22 +5865,6 @@ mop_setvolume (call_frame_t *frame, xlator_t *bound_xl,
ret = dict_set_uint64 (reply, "transport-ptr",
((uint64_t) (long) trans));
- xltrav = frame->this->children;
- while (xltrav) {
- if (xltrav->xlator == xl)
- break;
- xltrav = xltrav->next;
- subvol_idx++;
- }
-
- if (conf->subvol_list[subvol_idx] == 0) {
- gf_log (xl->name, GF_LOG_DEBUG,
- "subvolume %d down (filesystem not accesible), failed to setvolume", subvol_idx);
- op_ret = -1;
- op_errno = ENOTCONN;
- goto fail;
- }
-
fail:
dict_len = dict_serialized_length (reply);
if (dict_len < 0) {
@@ -6571,8 +6553,6 @@ init (xlator_t *this)
server_conf_t *conf = NULL;
data_t *data = NULL;
data_t *trace = NULL;
- int i = 0;
- xlator_list_t *xltrav = NULL;
if (this->children == NULL) {
gf_log (this->name, GF_LOG_ERROR,
@@ -6658,15 +6638,6 @@ init (xlator_t *this)
}
}
- xltrav = this->children;
-
- while (xltrav) {
- i++;
- xltrav = xltrav->next;
- }
-
- conf->subvol_list = calloc (i, sizeof (char));
-
#ifndef GF_DARWIN_HOST_OS
{
struct rlimit lim;
@@ -6768,12 +6739,6 @@ notify (xlator_t *this, int32_t event, void *data, ...)
}
switch (event) {
- case GF_EVENT_CHILD_DOWN:
- server_child_down (this, data);
- break;
- case GF_EVENT_CHILD_UP:
- server_child_up (this, data);
- break;
case GF_EVENT_POLLIN:
ret = protocol_server_pollin (this, trans);
break;
@@ -6794,7 +6759,7 @@ notify (xlator_t *this, int32_t event, void *data, ...)
* FIXME: shouldn't we check for return value?
* what should be done if cleanup fails?
*/
- server_connection_cleanup (this, trans->xl_private, trans);
+ server_connection_cleanup (this, trans->xl_private);
}
}
break;
diff --git a/xlators/protocol/server/src/server-protocol.h b/xlators/protocol/server/src/server-protocol.h
index 73e7f78..78bc138 100644
--- a/xlators/protocol/server/src/server-protocol.h
+++ b/xlators/protocol/server/src/server-protocol.h
@@ -37,7 +37,6 @@
#define DEFAULT_BLOCK_SIZE 4194304 /* 4MB */
#define DEFAULT_VOLUME_FILE_PATH CONFDIR "/glusterfs.vol"
-#define TRANSPORTS_PER_SERVER_CONN 2
typedef struct _server_state server_state_t;
@@ -65,7 +64,6 @@ struct _server_connection {
char *id;
int ref;
int active_transports;
- transport_t *transports[TRANSPORTS_PER_SERVER_CONN];
pthread_mutex_t lock;
char disconnected;
fdtable_t *fdtable;
@@ -77,7 +75,7 @@ typedef struct _server_connection server_connection_t;
server_connection_t *
-server_connection_get (xlator_t *this, const char *id, transport_t *trans);
+server_connection_get (xlator_t *this, const char *id);
void
server_connection_put (xlator_t *this, server_connection_t *conn);
@@ -86,7 +84,7 @@ int
server_connection_destroy (xlator_t *this, server_connection_t *conn);
int
-server_connection_cleanup (xlator_t *this, server_connection_t *conn, transport_t *trans);
+server_connection_cleanup (xlator_t *this, server_connection_t *conn);
int
server_nop_cbk (call_frame_t *frame, void *cookie,
@@ -109,7 +107,6 @@ typedef struct {
pthread_mutex_t mutex;
struct list_head conns;
gf_boolean_t verify_volfile_checksum;
- char *subvol_list;
gf_boolean_t trace;
} server_conf_t;
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index 6b8aa5a..ae47dff 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -4701,119 +4701,6 @@ posix_inode (xlator_t *this)
return 0;
}
-void
-posix_fsping_timer_expired (void *data)
-{
- xlator_t *this = NULL;
- struct posix_private *priv = NULL;
-
- this = data;
- priv = this->private;
-
- pthread_mutex_lock (&priv->mutex);
- {
- if (priv->fsping_timer) {
- gf_timer_call_cancel (this->ctx,
- priv->fsping_timer);
- priv->fsping_timer = NULL;
- }
-
- if (priv->fs_state) {
- priv->fs_state = 0;
- default_notify (this, GF_EVENT_CHILD_DOWN, NULL);
- }
- }
- pthread_mutex_unlock (&priv->mutex);
-}
-
-void
-posix_fsping (void *arg);
-
-void *
-posix_fsping_statvfs (void *arg)
-{
- int ret = -1;
- xlator_t *this = NULL;
- char *root_path = NULL;
- struct statvfs buf = {0, };
- struct posix_private *priv = NULL;
- struct timeval delta = {0, };
-
- this = arg;
- priv = this->private;
- root_path = POSIX_BASE_PATH (this);
-
- ret = statvfs (root_path, &buf);
-
- pthread_mutex_lock (&priv->mutex);
- {
- if (priv->fsping_timer) {
- gf_timer_call_cancel (this->ctx,
- priv->fsping_timer);
- priv->fsping_timer = NULL;
- }
- if (ret == 0) {
- if (priv->fs_state == 0) {
- priv->fs_state = 1;
- default_notify (this, GF_EVENT_CHILD_UP,
- NULL);
- }
- } else {
- if (priv->fs_state) {
- priv->fs_state = 0;
- default_notify (this, GF_EVENT_CHILD_DOWN,
- NULL);
- }
- }
- }
- pthread_mutex_unlock (&priv->mutex);
-
- delta.tv_sec = POSIX_FSPING_SLEEP_TIME;
- priv->fsping_timer =
- gf_timer_call_after (this->ctx,
- delta,
- posix_fsping,
- (void *) this);
- if (priv->fsping_timer == NULL) {
- gf_log (this->name, GF_LOG_ERROR,
- "unable to register timer");
- }
- return NULL;
-}
-
-void
-posix_fsping (void *arg)
-{
- xlator_t *this = NULL;
- struct posix_private *priv = NULL;
- struct timeval delta = {0, };
-
- this = arg;
- priv = this->private;
-
- delta.tv_sec = priv->fsping_timeout;
- delta.tv_usec = 0;
-
- if (priv->fsping_timer) {
- gf_timer_call_cancel (this->ctx,
- priv->fsping_timer);
- }
- priv->fsping_timer =
- gf_timer_call_after (this->ctx,
- delta,
- posix_fsping_timer_expired,
- (void *) this);
-
- if (priv->fsping_timer == NULL) {
- gf_log (this->name, GF_LOG_ERROR,
- "unable to register timer");
- /*FIXME: handle error*/
- }
- pthread_create (&priv->fsping,
- NULL,
- posix_fsping_statvfs,
- this);
-}
int32_t
posix_rchecksum (call_frame_t *frame, xlator_t *this,
@@ -4891,15 +4778,12 @@ notify (xlator_t *this,
void *data,
...)
{
- struct posix_private *priv = NULL;
-
- priv = this->private;
-
switch (event)
{
case GF_EVENT_PARENT_UP:
{
- posix_fsping ((void *)this);
+ /* Tell the parent that posix xlator is up */
+ default_notify (this, GF_EVENT_CHILD_UP, data);
}
break;
default:
@@ -4923,9 +4807,9 @@ init (xlator_t *this)
data_t * dir_data = NULL;
data_t * tmp_data = NULL;
uint64_t time64 = 0;
- int dict_ret = -1;
- int fsping_timeout = -1;
- int32_t janitor_sleep;
+
+ int dict_ret = 0;
+ int32_t janitor_sleep;
dir_data = dict_get (this->options, "directory");
@@ -5022,7 +4906,6 @@ init (xlator_t *this)
strcat (_private->trash_path, "/" GF_REPLICATE_TRASH_DIR);
LOCK_INIT (&_private->lock);
- pthread_mutex_init (&_private->mutex, NULL);
ret = gethostname (_private->hostname, 256);
if (ret < 0) {
@@ -5038,17 +4921,6 @@ init (xlator_t *this)
_private->max_write = 1;
}
- _private->fsping_timeout = POSIX_FSPING_TIMEOUT;
- dict_ret = dict_get_int32 (this->options,
- "fsping-timeout",
- &fsping_timeout);
-
- if (dict_ret == 0) {
- _private->fsping_timeout = fsping_timeout;
- }
- gf_log (this->name, GF_LOG_DEBUG,
- "fsping-timeout set to %d", _private->fsping_timeout);
-
_private->export_statfs = 1;
tmp_data = dict_get (this->options, "export-statfs-size");
if (tmp_data) {
@@ -5182,7 +5054,6 @@ fini (xlator_t *this)
{
struct posix_private *priv = this->private;
sys_lremovexattr (priv->base_path, "trusted.glusterfs.test");
- pthread_mutex_destroy (&priv->mutex);
FREE (priv);
return;
}
@@ -5259,8 +5130,6 @@ struct volume_options options[] = {
.type = GF_OPTION_TYPE_BOOL },
{ .key = {"span-devices"},
.type = GF_OPTION_TYPE_INT },
- { .key = {"fsping-timeout"},
- .type = GF_OPTION_TYPE_INT },
{ .key = {"background-unlink"},
.type = GF_OPTION_TYPE_BOOL },
{ .key = {"janitor-sleep-duration"},
diff --git a/xlators/storage/posix/src/posix.h b/xlators/storage/posix/src/posix.h
index 92fe8e2..f92e256 100644
--- a/xlators/storage/posix/src/posix.h
+++ b/xlators/storage/posix/src/posix.h
@@ -29,7 +29,6 @@
#include <unistd.h>
#include <sys/types.h>
#include <dirent.h>
-#include <pthread.h>
#include <time.h>
#ifdef linux
@@ -51,7 +50,6 @@
#include "xlator.h"
#include "inode.h"
#include "compat.h"
-#include "timer.h"
/**
* posix_fd - internal structure common to file and directory fd's
@@ -72,7 +70,6 @@ struct posix_private {
int32_t base_path_length;
gf_lock_t lock;
- pthread_mutex_t mutex;
char hostname[256];
/* Statistics, provides activity of the server */
@@ -120,11 +117,6 @@ struct posix_private {
int num_devices_to_span;
dev_t *st_device;
- pthread_t fsping;
- gf_timer_t *fsping_timer;
- int fsping_timeout;
- int fs_state;
-
/* a global generation number sequence is used to assign generation numbers in
sequence.
*/
@@ -137,9 +129,6 @@ struct posix_private {
char * trash_path;
};
-#define POSIX_FSPING_SLEEP_TIME 10
-#define POSIX_FSPING_TIMEOUT 10
-
#define POSIX_BASE_PATH(this) (((struct posix_private *)this->private)->base_path)
#define POSIX_BASE_PATH_LEN(this) (((struct posix_private *)this->private)->base_path_length)