summaryrefslogtreecommitdiffstats
path: root/xlators/protocol
diff options
context:
space:
mode:
authorHarshavardhana Ranganath <harsha@gluster.com>2010-01-26 09:06:18 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-01-26 07:23:16 -0800
commit5a574d96c392b19a92bb925b4b4dd268393831ea (patch)
treea3452c04ebaee4770f2fdfdc85beb6c1c043ef63 /xlators/protocol
parentffc36da0fd9a925aa2a23026b9244787d2c0a5fd (diff)
Revert "Server backend storage hang should not cause the mount point to hang."
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
Diffstat (limited to 'xlators/protocol')
-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
4 files changed, 14 insertions, 164 deletions
diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c
index a336406b17e..f627b6b530e 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 5c584b00aa7..867035d3334 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 8603d41585e..6603ea42c43 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 73e7f78911b..78bc138279a 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;