net: make network timeout configurable

This commit is contained in:
Thomas Schoebel-Theuer 2012-08-14 16:12:59 +02:00 committed by Thomas Schoebel-Theuer
parent 118d6f8c84
commit 3336b513ce
4 changed files with 21 additions and 5 deletions

View File

@ -385,9 +385,13 @@ void _do_timeout(struct client_output *output, struct list_head *anchor, bool fo
mref_a = container_of(tmp, struct client_mref_aspect, io_head);
mref = mref_a->object;
if (!force &&
(brick->io_timeout <= 0 || !time_is_before_jiffies(mref_a->submit_jiffies + brick->io_timeout * HZ))) {
break;
if (!force) {
int io_timeout = brick->io_timeout;
if (io_timeout <= 0)
io_timeout = global_net_io_timeout;
if (io_timeout <= 0 || !time_is_before_jiffies(mref_a->submit_jiffies + io_timeout * HZ)) {
break;
}
}
MARS_DBG("signalling IO error at pos = %lld len = %d\n", mref->ref_pos, mref->ref_len);
@ -705,6 +709,9 @@ struct mars_limiter client_limiter = {
};
EXPORT_SYMBOL_GPL(client_limiter);
int global_net_io_timeout = CONFIG_MARS_NETIO_TIMEOUT;
EXPORT_SYMBOL_GPL(global_net_io_timeout);
int __init init_mars_client(void)
{
MARS_INF("init_client()\n");

View File

@ -6,7 +6,7 @@
#include "lib_limiter.h"
extern struct mars_limiter client_limiter;
extern int global_net_io_timeout;
#define CLIENT_HASH_MAX 256

View File

@ -219,7 +219,7 @@ int _set_client_params(struct mars_brick *_brick, void *private)
{
struct client_brick *client_brick = (void*)_brick;
struct client_cookie *clc = private;
client_brick->io_timeout = CONFIG_MARS_NETIO_TIMEOUT;
client_brick->io_timeout = 0;
client_brick->limit_mode = clc ? clc->limit_mode : false;
MARS_INF("name = '%s' path = '%s'\n", _brick->brick_name, _brick->brick_path);
return 1;

View File

@ -181,6 +181,15 @@ ctl_table mars_table[] = {
.proc_handler = &proc_dointvec,
.strategy = &sysctl_intvec,
},
{
.ctl_name = CTL_UNNUMBERED,
.procname = "net_io_timeout",
.data = &global_net_io_timeout,
.maxlen = sizeof(int),
.mode = 0600,
.proc_handler = &proc_dointvec,
.strategy = &sysctl_intvec,
},
#ifdef CONFIG_MARS_LOADAVG_LIMIT
{
.ctl_name = CTL_UNNUMBERED,