diff --git a/mars_client.c b/mars_client.c index 180b8864..ec0e7dc4 100644 --- a/mars_client.c +++ b/mars_client.c @@ -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"); diff --git a/mars_client.h b/mars_client.h index 0c70fdeb..08b998ee 100644 --- a/mars_client.h +++ b/mars_client.h @@ -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 diff --git a/sy_old/mars_light.c b/sy_old/mars_light.c index e4a5a648..d013e48b 100644 --- a/sy_old/mars_light.c +++ b/sy_old/mars_light.c @@ -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; diff --git a/sy_old/mars_proc.c b/sy_old/mars_proc.c index 32c5b062..9ee1f07e 100644 --- a/sy_old/mars_proc.c +++ b/sy_old/mars_proc.c @@ -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,