summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/server/src/server-protocol.c
diff options
context:
space:
mode:
authorAnand Avati <avati@gluster.com>2010-01-23 05:14:31 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-01-23 02:58:34 -0800
commita0b148ea4e2a0163548eeb89b7580be4adbb8070 (patch)
tree54ecf54695c9a891bb13d9542bf80fe443b4c725 /xlators/protocol/server/src/server-protocol.c
parent9c53d5daf403f6fbfde76dec121295a4c156b32e (diff)
Server backend storage hang should not cause the mount point to hang.
Submitted-by: Krishna Srinivas <krishna@gluster.com> NOTE: fixed compilation issues in posix.c introduced while merging storage/posix polls for FS/kernel being functional by issuing statvfs() call. In case statvfs expires the timer, storage/posix will send CHILD_DOWN to upper translator. Ultimately this will cause protocol/server to disconnect all clients connected and also cleans up the data structures. Hence if soft lockup or other kernel bug causes backend FS to hang, the clients will not be hung. Signed-off-by: Krishna Srinivas <krishna@gluster.com> Signed-off-by: Anand V. Avati <avati@blackhole.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/server/src/server-protocol.c')
-rw-r--r--xlators/protocol/server/src/server-protocol.c39
1 files changed, 37 insertions, 2 deletions
diff --git a/xlators/protocol/server/src/server-protocol.c b/xlators/protocol/server/src/server-protocol.c
index 0528699acbe..a7f6294f387 100644
--- a/xlators/protocol/server/src/server-protocol.c
+++ b/xlators/protocol/server/src/server-protocol.c
@@ -5654,6 +5654,8 @@ 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 ();
@@ -5695,7 +5697,7 @@ mop_setvolume (call_frame_t *frame, xlator_t *bound_xl,
}
- conn = server_connection_get (frame->this, process_uuid);
+ conn = server_connection_get (frame->this, process_uuid, trans);
if (trans->xl_private != conn)
trans->xl_private = conn;
@@ -5862,6 +5864,22 @@ 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) {
@@ -6550,6 +6568,8 @@ 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,
@@ -6635,6 +6655,15 @@ 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;
@@ -6736,6 +6765,12 @@ 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;
@@ -6756,7 +6791,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);
+ server_connection_cleanup (this, trans->xl_private, trans);
}
}
break;