From 57170b23841ce2e001cd765ace2e06d813553e13 Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Thu, 14 Jun 2018 18:08:55 +0000 Subject: [PATCH] Revert "LU-8066 llite: replace ll_process_config with class_modify_config" This patch was landed by mistake. This reverts commit db67e686d9abcf750359820bfbdb754ab611bf5c. Change-Id: I2cbfe808eb7d5c448bdf06d4c36229813e6978d2 Reviewed-on: https://review.whamcloud.com/32721 Reviewed-by: Oleg Drokin Tested-by: Oleg Drokin --- lustre/conf/99-lustre.rules | 2 +- lustre/include/lustre_disk.h | 2 -- lustre/llite/llite_internal.h | 1 + lustre/llite/llite_lib.c | 26 ++++++++++++++++++++++++++ lustre/llite/lproc_llite.c | 7 ------- lustre/llite/super25.c | 2 ++ lustre/obdclass/obd_config.c | 39 +++++++++++++-------------------------- 7 files changed, 43 insertions(+), 36 deletions(-) diff --git a/lustre/conf/99-lustre.rules b/lustre/conf/99-lustre.rules index 62b5cb8..61cdbdf 100644 --- a/lustre/conf/99-lustre.rules +++ b/lustre/conf/99-lustre.rules @@ -4,4 +4,4 @@ KERNEL=="obd", MODE="0666" ACTION=="add|change", SUBSYSTEM=="block", RUN+="/usr/sbin/l_tunedisk /dev/%k" # set sysfs values on client -SUBSYSTEM=="lustre", ACTION=="change", ENV{PARAM}=="?*", RUN+="/usr/sbin/lctl set_param '$env{PARAM}=$env{SETTING}'" +SUBSYSTEM=="lustre", ACTION=="change", ENV{PARAM}=="?*", RUN+="/usr/sbin/lctl set_param $env{PARAM}=$env{SETTING}" diff --git a/lustre/include/lustre_disk.h b/lustre/include/lustre_disk.h index fe39f3b..c34a833 100644 --- a/lustre/include/lustre_disk.h +++ b/lustre/include/lustre_disk.h @@ -46,7 +46,6 @@ #include #include #include -#include #include #include #include @@ -120,7 +119,6 @@ struct lustre_sb_info { struct ll_sb_info *lsi_llsbi; /* add'l client sbi info */ struct dt_device *lsi_dt_dev; /* dt device to access disk fs*/ atomic_t lsi_mounts; /* references to the srv_mnt */ - struct kobject *lsi_kobj; char lsi_svname[MTI_NAME_MAXLEN]; /* lsi_osd_obdname format = 'lsi->ls_svname'-osd */ char lsi_osd_obdname[MTI_NAME_MAXLEN + 4]; diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index b598f7f..5c46e34 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -944,6 +944,7 @@ int ll_obd_statfs(struct inode *inode, void __user *arg); int ll_get_max_mdsize(struct ll_sb_info *sbi, int *max_mdsize); int ll_get_default_mdsize(struct ll_sb_info *sbi, int *default_mdsize); int ll_set_default_mdsize(struct ll_sb_info *sbi, int default_mdsize); +int ll_process_config(struct lustre_cfg *lcfg); enum { LUSTRE_OPC_MKDIR = 0, diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index 74779e7..a56ffb5 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -2456,6 +2456,32 @@ out_statfs: return rc; } +int ll_process_config(struct lustre_cfg *lcfg) +{ + struct super_block *sb; + unsigned long x; + int rc = 0; + char *ptr; + + /* The instance name contains the sb: lustre-client-aacfe000 */ + ptr = strrchr(lustre_cfg_string(lcfg, 0), '-'); + if (!ptr || !*(++ptr)) + return -EINVAL; + if (sscanf(ptr, "%lx", &x) != 1) + return -EINVAL; + sb = (struct super_block *)x; + /* This better be a real Lustre superblock! */ + LASSERT(s2lsi(sb)->lsi_lmd->lmd_magic == LMD_MAGIC); + + /* Note we have not called client_common_fill_super yet, so + proc fns must be able to handle that! */ + rc = class_process_proc_param(PARAM_LLITE, lprocfs_llite_obd_vars, + lcfg, sb); + if (rc > 0) + rc = 0; + return rc; +} + /* this function prepares md_op_data hint for passing it down to MD stack. */ struct md_op_data *ll_prep_md_op_data(struct md_op_data *op_data, struct inode *i1, struct inode *i2, diff --git a/lustre/llite/lproc_llite.c b/lustre/llite/lproc_llite.c index 7e2cb19..91f003c 100644 --- a/lustre/llite/lproc_llite.c +++ b/lustre/llite/lproc_llite.c @@ -1306,7 +1306,6 @@ LPROC_SEQ_FOPS_RO_TYPE(llite, uuid); int ll_debugfs_register_super(struct super_block *sb, const char *name) { - struct lustre_sb_info *lsi = s2lsi(sb); struct ll_sb_info *sbi = ll_s2sbi(sb); struct lprocfs_vars lvars[2]; int err, id, rc; @@ -1399,9 +1398,6 @@ int ll_debugfs_register_super(struct super_block *sb, const char *name) err = kset_register(&sbi->ll_kset); if (err) GOTO(out_ra_stats, err); - - lsi->lsi_kobj = kobject_get(&sbi->ll_kset.kobj); - RETURN(0); out_ra_stats: lprocfs_free_stats(&sbi->ll_ra_stats); @@ -1464,11 +1460,8 @@ out: void ll_debugfs_unregister_super(struct super_block *sb) { - struct lustre_sb_info *lsi = s2lsi(sb); struct ll_sb_info *sbi = ll_s2sbi(sb); - kobject_put(lsi->lsi_kobj); - kset_unregister(&sbi->ll_kset); wait_for_completion(&sbi->ll_kobj_unregister); diff --git a/lustre/llite/super25.c b/lustre/llite/super25.c index 381a579..32d1ec9 100644 --- a/lustre/llite/super25.c +++ b/lustre/llite/super25.c @@ -160,6 +160,7 @@ static int __init lustre_init(void) lustre_register_client_fill_super(ll_fill_super); lustre_register_kill_super_cb(ll_kill_super); + lustre_register_client_process_config(ll_process_config); RETURN(0); @@ -179,6 +180,7 @@ static void __exit lustre_exit(void) { lustre_register_client_fill_super(NULL); lustre_register_kill_super_cb(NULL); + lustre_register_client_process_config(NULL); llite_tunables_unregister(); diff --git a/lustre/obdclass/obd_config.c b/lustre/obdclass/obd_config.c index 66a96d8..64aca1a 100644 --- a/lustre/obdclass/obd_config.c +++ b/lustre/obdclass/obd_config.c @@ -948,13 +948,20 @@ void class_del_profiles(void) } EXPORT_SYMBOL(class_del_profiles); -/* We can't call lquota_process_config directly because +/* We can't call ll_process_config or lquota_process_config directly because * it lives in a module that must be loaded after this one. */ +static int (*client_process_config)(struct lustre_cfg *lcfg) = NULL; #ifdef HAVE_SERVER_SUPPORT static int (*quota_process_config)(struct lustre_cfg *lcfg) = NULL; #endif /* HAVE_SERVER_SUPPORT */ +void lustre_register_client_process_config(int (*cpc)(struct lustre_cfg *lcfg)) +{ + client_process_config = cpc; +} +EXPORT_SYMBOL(lustre_register_client_process_config); + /** * Rename the proc parameter in \a cfg with a new name \a new_name. * @@ -1200,32 +1207,12 @@ int class_process_config(struct lustre_cfg *lcfg) } case LCFG_PARAM: { char *tmp; - /* llite has no obd */ - if (!class_match_param(lustre_cfg_string(lcfg, 1), - PARAM_LLITE, NULL)) { - struct lustre_sb_info *lsi; - unsigned long addr; - ssize_t count; - - /* The instance name contains the sb: - * lustre-client-aacfe000 - */ - tmp = strrchr(lustre_cfg_string(lcfg, 0), '-'); - if (!tmp || !*(++tmp)) - GOTO(out, err = -EINVAL); - - if (sscanf(tmp, "%lx", &addr) != 1) - GOTO(out, err = -EINVAL); - - lsi = s2lsi((struct super_block *)addr); - /* This better be a real Lustre superblock! */ - LASSERT(lsi->lsi_lmd->lmd_magic == LMD_MAGIC); - - count = class_modify_config(lcfg, PARAM_LLITE, - lsi->lsi_kobj); - err = count < 0 ? count : 0; - GOTO(out, err); + if ((class_match_param(lustre_cfg_string(lcfg, 1), + PARAM_LLITE, NULL) == 0) && + client_process_config) { + err = (*client_process_config)(lcfg); + GOTO(out, err); } else if ((class_match_param(lustre_cfg_string(lcfg, 1), PARAM_SYS, &tmp) == 0)) { /* Global param settings */ -- 1.8.3.1