light: fix client shutdown on slow network

On slow networks, the generic net_io_timeout is too long if you are
impatiently waiting for disconnect.

Change the io_timeout of the individual client brick to a short value.
This commit is contained in:
Thomas Schoebel-Theuer 2014-09-27 09:32:20 +02:00
parent 1295c43a7a
commit 917d5ae2d2
2 changed files with 16 additions and 0 deletions

View File

@ -477,6 +477,11 @@ static int sender_thread(void *data)
struct client_mref_aspect *mref_a;
struct mref_object *mref;
if (brick->power.io_timeout > 0) {
_do_timeout(output, &output->wait_list, false);
_do_timeout(output, &output->mref_list, false);
}
if (unlikely(output->recv_error != 0 || !mars_socket_is_alive(&output->socket))) {
MARS_DBG("recv_error = %d do_kill = %d\n", output->recv_error, do_kill);
if (do_kill) {

View File

@ -1487,6 +1487,11 @@ int __make_copy(
goto done;
}
cc.output[i] = aio->outputs[0];
/* When switching off, use a short timeout for aborting.
* Important on very slow networks (since a large number
* of requests may be pending).
*/
aio->power.io_timeout = switch_copy ? 0 : 1;
}
cc.copy_path = copy_path;
@ -3612,6 +3617,12 @@ done:
(fetch_brick->copy_last == fetch_brick->copy_end &&
(rot->fetch_next_is_available > 0 ||
rot->fetch_round++ > 3)))) {
int i;
for (i = 0; i < 4; i++) {
if (fetch_brick->inputs[i] && fetch_brick->inputs[i]->brick)
fetch_brick->inputs[i]->brick->power.io_timeout = 1;
}
status = mars_kill_brick((void*)fetch_brick);
if (status < 0) {
MARS_ERR("could not kill fetch_brick, status = %d\n", status);