From a7313f1db8ad2b29ebbab72eab63bfd449e94725 Mon Sep 17 00:00:00 2001 From: adilger Date: Mon, 16 May 2005 18:22:42 +0000 Subject: [PATCH] Branch b1_4 Decrease the ldlm_timeout if obd_timeout is dropped. It doesn't really make sense to have AST timeouts longer than the RPC timeouts, but is mostly only noticable in our regression tests (recovery-small.sh test 10 in particular). b=6172 --- lustre/obdclass/genops.c | 3 +-- lustre/obdclass/obd_config.c | 4 ++++ lustre/obdclass/sysctl.c | 38 +++++++++++++++++++++++++++----------- 3 files changed, 32 insertions(+), 13 deletions(-) diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c index a93256d..4908339 100644 --- a/lustre/obdclass/genops.c +++ b/lustre/obdclass/genops.c @@ -65,8 +65,7 @@ static struct obd_type *class_search_type(char *name) spin_lock(&obd_types_lock); list_for_each(tmp, &obd_types) { type = list_entry(tmp, struct obd_type, typ_chain); - if (strlen(type->typ_name) == strlen(name) && - strcmp(type->typ_name, name) == 0) { + if (strcmp(type->typ_name, name) == 0) { spin_unlock(&obd_types_lock); return type; } diff --git a/lustre/obdclass/obd_config.c b/lustre/obdclass/obd_config.c index 91535d7..6c4b758 100644 --- a/lustre/obdclass/obd_config.c +++ b/lustre/obdclass/obd_config.c @@ -606,6 +606,10 @@ int class_process_config(struct lustre_cfg *lcfg) CDEBUG(D_IOCTL, "changing lustre timeout from %d to %d\n", obd_timeout, lcfg->lcfg_num); obd_timeout = max(lcfg->lcfg_num, 1U); + if (ldlm_timeout >= obd_timeout) + ldlm_timeout = max(obd_timeout / 3, 1U); + else if (ldlm_timeout < 10 && obd_timeout >= ldlm_timeout * 4) + ldlm_timeout = min(obd_timeout / 3, 30U); GOTO(out, err = 0); } case LCFG_SET_UPCALL: { diff --git a/lustre/obdclass/sysctl.c b/lustre/obdclass/sysctl.c index e4704f2..1bf8a27 100644 --- a/lustre/obdclass/sysctl.c +++ b/lustre/obdclass/sysctl.c @@ -58,31 +58,47 @@ enum { }; #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,8) -int proc_fail_loc(ctl_table *table, int write, struct file *filp, - void *buffer, size_t *lenp) +#define ll_proc_dointvec(table,write,filp,buffer,lenp,ppos) \ + proc_dointvec(table,write,filp,buffer,lenp) +#define LL_PROC_PROTO(name) \ + name(ctl_table *table, int write, struct file *filp, \ + void *buffer, size_t *lenp) #else -int proc_fail_loc(ctl_table *table, int write, struct file *filp, +#define ll_proc_dointvec(table,write,filp,buffer,lenp,ppos) \ + proc_dointvec(table,write,filp,buffer,lenp,ppos); +#define LL_PROC_PROTO(name) \ + name(ctl_table *table, int write, struct file *filp, \ void *buffer, size_t *lenp, loff_t *ppos) #endif + +int LL_PROC_PROTO(proc_fail_loc) { int rc; int old_fail_loc = obd_fail_loc; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,8) - rc = proc_dointvec(table,write,filp,buffer,lenp); -#else - rc = proc_dointvec(table,write,filp,buffer,lenp,ppos); -#endif + rc = ll_proc_dointvec(table, write, filp, buffer, lenp, ppos); if (old_fail_loc != obd_fail_loc) wake_up(&obd_race_waitq); return rc; } +int LL_PROC_PROTO(proc_set_timeout) +{ + int rc; + + rc = ll_proc_dointvec(table, write, filp, buffer, lenp, ppos); + if (ldlm_timeout >= obd_timeout) + ldlm_timeout = max(obd_timeout / 3, 1U); + else if (ldlm_timeout < 10 && obd_timeout >= ldlm_timeout * 4) + ldlm_timeout = min(obd_timeout / 3, 30U); + return rc; +} + static ctl_table obd_table[] = { {OBD_FAIL_LOC, "fail_loc", &obd_fail_loc, sizeof(int), 0644, NULL, - &proc_dointvec}, - {OBD_TIMEOUT, "timeout", &obd_timeout, sizeof(int), 0644, NULL, &proc_fail_loc}, + {OBD_TIMEOUT, "timeout", &obd_timeout, sizeof(int), 0644, NULL, + &proc_set_timeout}, {OBD_DUMP_ON_TIMEOUT, "dump_on_timeout", &obd_dump_on_timeout, sizeof(int), 0644, NULL, &proc_dointvec}, /* XXX need to lock so we avoid update races with recovery upcall! */ @@ -93,7 +109,7 @@ static ctl_table obd_table[] = { {OBD_SYNCFILTER, "filter_sync_on_commit", &obd_sync_filter, sizeof(int), 0644, NULL, &proc_dointvec}, {OBD_LDLM_TIMEOUT, "ldlm_timeout", &ldlm_timeout, sizeof(int), 0644, - NULL, &proc_dointvec}, + NULL, &proc_set_timeout}, { 0 } }; -- 1.8.3.1