From 795920a0fd8f9a6f39f7dfa1a334c3564ba480c1 Mon Sep 17 00:00:00 2001 From: Bob Glossman Date: Tue, 13 Mar 2018 14:10:57 -0700 Subject: [PATCH] LU-10813 kernel: kernel update RHEL6.9 [2.6.32-696.23.1.el6] Update RHEL6.9 kernel to 2.6.32-696.23.1.el6 Test-Parameters: clientdistro=el6.9 mdsdistro=el6.9 \ ossdistro=el6.9 mdtfilesystemtype=ldiskfs \ ostfilesystemtype=ldiskfs testgroup=review-ldiskfs Signed-off-by: Bob Glossman Change-Id: Iea0e1fb4cccd4c68ac50eac11970028dca01ee6a Reviewed-on: https://review.whamcloud.com/31660 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Yang Sheng Reviewed-by: John L. Hammond --- lustre/ChangeLog | 4 +- .../kernel-2.6.32-2.6-rhel6.9-x86_64.config | 8 +- .../patches/module-load-deadlock-rhel6.9.patch | 342 +++++++++++++++++++++ lustre/kernel_patches/series/2.6-rhel6.9.series | 10 + .../kernel_patches/targets/2.6-rhel6.9.target.in | 4 +- lustre/kernel_patches/which_patch | 2 +- 6 files changed, 361 insertions(+), 9 deletions(-) create mode 100644 lustre/kernel_patches/patches/module-load-deadlock-rhel6.9.patch create mode 100644 lustre/kernel_patches/series/2.6-rhel6.9.series diff --git a/lustre/ChangeLog b/lustre/ChangeLog index f8650cd..1697d46 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -7,7 +7,7 @@ 2.6.32-504.30.3.el6 (RHEL6.6) 2.6.32-573.26.1.el6 (RHEL6.7) 2.6.32-642.15.1.el6 (RHEL6.8) - 2.6.32-696.18.7.el6 (RHEL6.9) + 2.6.32-696.23.1.el6 (RHEL6.9) 3.10.0-693.21.1.el7 (RHEL7.4) 3.0.101-0.47.71 (SLES11 SP3) 3.0.101-107 (SLES11 SP4) @@ -20,7 +20,7 @@ 2.6.32-504.30.3.el6 (RHEL6.6) 2.6.32-573.26.1.el6 (RHEL6.7) 2.6.32-642.15.1.el6 (RHEL6.8) - 2.6.32-696.18.7.el6 (RHEL6.9) + 2.6.32-696.23.1.el6 (RHEL6.9) 3.10.0-693.21.1.el7 (RHEL7.4) 3.0.101-0.47.71 (SLES11 SP3) 3.0.101-107 (SLES11 SP4) diff --git a/lustre/kernel_patches/kernel_configs/kernel-2.6.32-2.6-rhel6.9-x86_64.config b/lustre/kernel_patches/kernel_configs/kernel-2.6.32-2.6-rhel6.9-x86_64.config index 0d89dc5..08ab9e4 100644 --- a/lustre/kernel_patches/kernel_configs/kernel-2.6.32-2.6-rhel6.9-x86_64.config +++ b/lustre/kernel_patches/kernel_configs/kernel-2.6.32-2.6-rhel6.9-x86_64.config @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit # Linux kernel version: 2.6.32 -# Thu Jan 4 08:24:47 2018 +# Tue Mar 13 14:41:29 2018 # CONFIG_64BIT=y # CONFIG_X86_32 is not set @@ -255,6 +255,7 @@ CONFIG_X86_X2APIC=y CONFIG_SPARSE_IRQ=y CONFIG_NUMA_IRQ_DESC=y CONFIG_X86_MPPARSE=y +CONFIG_RETPOLINE=y CONFIG_X86_EXTENDED_PLATFORM=y # CONFIG_X86_VSMP is not set CONFIG_X86_UV=y @@ -1159,6 +1160,7 @@ CONFIG_EXTRA_FIRMWARE="" # CONFIG_DEBUG_DEVRES is not set CONFIG_SYS_HYPERVISOR=y CONFIG_DMA_SHARED_BUFFER=y +CONFIG_GENERIC_CPU_VULNERABILITIES=y CONFIG_CONNECTOR=y CONFIG_PROC_EVENTS=y CONFIG_MTD=y @@ -4513,15 +4515,13 @@ CONFIG_KEYS_DEBUG_PROC_KEYS=y CONFIG_SECURITY=y CONFIG_SECURITYFS=y CONFIG_SECURITY_NETWORK=y -CONFIG_KAISER=y +CONFIG_PAGE_TABLE_ISOLATION=y CONFIG_SECURITY_NETWORK_XFRM=y # CONFIG_SECURITY_PATH is not set CONFIG_SECURITY_FILE_CAPABILITIES=y # CONFIG_SECURITY_ROOTPLUG is not set CONFIG_INTEL_TXT=y CONFIG_LSM_MMAP_MIN_ADDR=65535 -CONFIG_SPEC_CTRL=y -CONFIG_ARCH_SPEC_CTRL=y CONFIG_SECURITY_SELINUX=y CONFIG_SECURITY_SELINUX_BOOTPARAM=y CONFIG_SECURITY_SELINUX_BOOTPARAM_VALUE=1 diff --git a/lustre/kernel_patches/patches/module-load-deadlock-rhel6.9.patch b/lustre/kernel_patches/patches/module-load-deadlock-rhel6.9.patch new file mode 100644 index 0000000..0041612 --- /dev/null +++ b/lustre/kernel_patches/patches/module-load-deadlock-rhel6.9.patch @@ -0,0 +1,342 @@ +module: Fix a few concurrent module loading races + +Concurrently starting multiple OSTs on a single OSS frequently +triggers 30s deadlocks on module_mutex. This RHEL 6 kernel bug +applies to any module that results in additional request_module() +calls in its init callback. In Lustre, at least ptlrpc and libcfs are +affected. This patch adapts fixes from the following upstream +commits: + + 9bea7f2 module: fix bne2 "gave up waiting for init of module + libcrc32c" + be593f4 module: verify_export_symbols under the lock + 3bafeb6 module: move find_module check to end + 80a3d1b module: move sysfs exposure to end of load_module + +diff -rNup linux-2.6.32-431.20.3.el6.orig/kernel/module.c linux-2.6.32-431.20.3.el6/kernel/module.c +--- linux-2.6.32-431.20.3.el6.orig/kernel/module.c 2014-06-07 05:42:39.000000000 +0800 ++++ linux-2.6.32-431.20.3.el6/kernel/module.c 2014-07-28 00:04:43.000000000 +0800 +@@ -658,6 +658,33 @@ static int already_uses(struct module *a + } + + /* Module a uses b */ ++static int ref_module(struct module *a, struct module *b) ++{ ++ struct module_use *use; ++ int err; ++ ++ if (b == NULL || already_uses(a, b)) ++ return 0; ++ ++ /* If module isn't available, we fail. */ ++ err = strong_try_module_get(b); ++ if (err) ++ return err; ++ ++ DEBUGP("Allocating new usage for %s.\n", a->name); ++ use = kmalloc(sizeof(*use), GFP_ATOMIC); ++ if (!use) { ++ printk("%s: out of memory loading\n", a->name); ++ module_put(b); ++ return -ENOMEM; ++ } ++ ++ use->module_which_uses = a; ++ list_add(&use->list, &b->modules_which_use_me); ++ return 0; ++} ++ ++/* Module a uses b */ + int use_module(struct module *a, struct module *b) + { + struct module_use *use; +@@ -707,7 +734,6 @@ static void module_unload_free(struct mo + module_put(i); + list_del(&use->list); + kfree(use); +- sysfs_remove_link(i->holders_dir, mod->name); + /* There can be at most one match. */ + break; + } +@@ -962,6 +988,11 @@ static inline void module_unload_free(st + { + } + ++static inline int ref_module(struct module *a, struct module *b) ++{ ++ return strong_try_module_get(b); ++} ++ + int use_module(struct module *a, struct module *b) + { + return strong_try_module_get(b) == 0; +@@ -1130,24 +1161,60 @@ static inline int same_magic(const char + static const struct kernel_symbol *resolve_symbol(Elf_Shdr *sechdrs, + unsigned int versindex, + const char *name, +- struct module *mod) ++ struct module *mod, ++ char ownername[]) + { + struct module *owner; + const struct kernel_symbol *sym; + const unsigned long *crc; ++ int err; + ++ mutex_lock(&module_mutex); + sym = find_symbol(name, &owner, &crc, + !(mod->taints & (1 << TAINT_PROPRIETARY_MODULE)), true); +- /* use_module can fail due to OOM, +- or module initialization or unloading */ +- if (sym) { +- if (!check_version(sechdrs, versindex, name, mod, crc, owner) +- || !use_module(mod, owner)) +- sym = NULL; ++ if (!sym) ++ goto unlock; ++ ++ if (!check_version(sechdrs, versindex, name, mod, crc, owner)) { ++ sym = ERR_PTR(-EINVAL); ++ goto getname; + } ++ ++ err = ref_module(mod, owner); ++ if (err) { ++ sym = ERR_PTR(err); ++ goto getname; ++ } ++ ++getname: ++ /* We must make copy under the lock if we failed to get ref. */ ++ strncpy(ownername, module_name(owner), MODULE_NAME_LEN); ++unlock: ++ mutex_unlock(&module_mutex); + return sym; + } + ++static const struct kernel_symbol *resolve_symbol_wait(Elf_Shdr *sechdrs, ++ unsigned int versindex, ++ const char *name, ++ struct module *mod) ++{ ++ const struct kernel_symbol *ksym; ++ char ownername[MODULE_NAME_LEN]; ++ ++ mutex_unlock(&module_mutex); ++ if (wait_event_interruptible_timeout(module_wq, ++ !IS_ERR(ksym = resolve_symbol(sechdrs, versindex, name, ++ mod, ownername)) || ++ PTR_ERR(ksym) != -EBUSY, ++ msecs_to_jiffies(30 * MSEC_PER_SEC)) <= 0) { ++ printk(KERN_WARNING "%s: gave up waiting for init of module %s.\n", ++ mod->name, ownername); ++ } ++ mutex_lock(&module_mutex); ++ return ksym; ++} ++ + /* + * /sys/module/foo/sections stuff + * J. Corbet +@@ -1375,6 +1442,30 @@ static inline void remove_notes_attrs(st + #endif + + #ifdef CONFIG_SYSFS ++static void add_usage_links(struct module *mod) ++{ ++#ifdef CONFIG_MODULE_UNLOAD ++ struct module_use *use; ++ int nowarn; ++ ++ list_for_each_entry(use, &mod->modules_which_use_me, list) { ++ nowarn = sysfs_create_link(use->module_which_uses->holders_dir, ++ &mod->mkobj.kobj, mod->name); ++ } ++#endif ++} ++ ++static void del_usage_links(struct module *mod) ++{ ++#ifdef CONFIG_MODULE_UNLOAD ++ struct module_use *use; ++ ++ list_for_each_entry(use, &mod->modules_which_use_me, list) ++ sysfs_remove_link(use->module_which_uses->holders_dir, mod->name); ++#endif ++} ++ ++ + int module_add_modinfo_attrs(struct module *mod) + { + struct module_attribute *attr; +@@ -1456,6 +1547,10 @@ int mod_sysfs_setup(struct module *mod, + { + int err; + ++ err = mod_sysfs_init(mod); ++ if (err) ++ goto out; ++ + mod->holders_dir = kobject_create_and_add("holders", &mod->mkobj.kobj); + if (!mod->holders_dir) { + err = -ENOMEM; +@@ -1470,6 +1565,8 @@ int mod_sysfs_setup(struct module *mod, + if (err) + goto out_unreg_param; + ++ add_usage_links(mod); ++ + kobject_uevent(&mod->mkobj.kobj, KOBJ_ADD); + return 0; + +@@ -1479,6 +1576,7 @@ out_unreg_holders: + kobject_put(mod->holders_dir); + out_unreg: + kobject_put(&mod->mkobj.kobj); ++out: + return err; + } + +@@ -1493,10 +1591,15 @@ static void mod_sysfs_fini(struct module + { + } + ++static void del_usage_links(struct module *mod) ++{ ++} ++ + #endif /* CONFIG_SYSFS */ + + static void mod_kobject_remove(struct module *mod) + { ++ del_usage_links(mod); + module_remove_modinfo_attrs(mod); + module_param_sysfs_remove(mod); + kobject_put(mod->mkobj.drivers_dir); +@@ -1576,6 +1679,8 @@ EXPORT_SYMBOL_GPL(__symbol_get); + /* + * Ensure that an exported symbol [global namespace] does not already exist + * in the kernel or in some other module's exported symbol table. ++ * ++ * You must hold the module_mutex. + */ + static int verify_export_symbols(struct module *mod) + { +@@ -1641,21 +1746,23 @@ static int simplify_symbols(Elf_Shdr *se + break; + + case SHN_UNDEF: +- ksym = resolve_symbol(sechdrs, versindex, +- strtab + sym[i].st_name, mod); ++ ksym = resolve_symbol_wait(sechdrs, versindex, ++ strtab + sym[i].st_name, ++ mod); + /* Ok if resolved. */ +- if (ksym) { ++ if (ksym && !IS_ERR(ksym)) { + sym[i].st_value = ksym->value; + break; + } + + /* Ok if weak. */ +- if (ELF_ST_BIND(sym[i].st_info) == STB_WEAK) ++ if (!ksym && ELF_ST_BIND(sym[i].st_info) == STB_WEAK) + break; + +- printk(KERN_WARNING "%s: Unknown symbol %s\n", +- mod->name, strtab + sym[i].st_name); +- ret = -ENOENT; ++ printk(KERN_WARNING "%s: Unknown symbol %s (err %li)\n", ++ mod->name, strtab + sym[i].st_name, ++ PTR_ERR(ksym)); ++ ret = PTR_ERR(ksym) ?: -ENOENT; + break; + + default: +@@ -2240,11 +2347,6 @@ static noinline struct module *load_modu + goto free_mod; + } + +- if (find_module(mod->name)) { +- err = -EEXIST; +- goto free_mod; +- } +- + mod->state = MODULE_STATE_COMING; + + /* Allow arches to frob section contents and sizes. */ +@@ -2338,20 +2440,15 @@ static noinline struct module *load_modu + /* Now we've moved module, initialize linked lists, etc. */ + module_unload_init(mod); + +- /* add kobject, so we can reference it. */ +- err = mod_sysfs_init(mod); +- if (err) +- goto free_unload; +- + #ifdef CONFIG_RETPOLINE + { + extern void spectre_v2_report_unsafe_module(struct module *mod); + + if (!get_modinfo(sechdrs, infoindex, "retpoline")) + spectre_v2_report_unsafe_module(mod); + } + #endif + + /* Set up license info based on the info section */ + set_license(mod, get_modinfo(sechdrs, infoindex, "license")); + +@@ -2461,11 +2558,6 @@ static noinline struct module *load_modu + goto cleanup; + } + +- /* Find duplicate symbols */ +- err = verify_export_symbols(mod); +- if (err < 0) +- goto cleanup; +- + /* Set up and sort exception table */ + mod->extable = section_objs(hdr, sechdrs, secstrings, "__ex_table", + sizeof(*mod->extable), &mod->num_exentries); +@@ -2521,6 +2613,16 @@ static noinline struct module *load_modu + * function to insert in a way safe to concurrent readers. + * The mutex protects against concurrent writers. + */ ++ if (find_module(mod->name)) { ++ err = -EEXIST; ++ goto already_exists; ++ } ++ ++ /* Find duplicate symbols */ ++ err = verify_export_symbols(mod); ++ if (err < 0) ++ goto already_exists; ++ + list_add_rcu(&mod->list, &modules); + + err = parse_args(mod->name, mod->args, mod->kp, mod->num_kp, NULL); +@@ -2530,6 +2632,7 @@ static noinline struct module *load_modu + err = mod_sysfs_setup(mod, mod->kp, mod->num_kp); + if (err < 0) + goto unlink; ++ + add_sect_attrs(mod, hdr->e_shnum, secstrings, sechdrs); + add_notes_attrs(mod, hdr->e_shnum, secstrings, sechdrs); + +@@ -2544,15 +2647,13 @@ static noinline struct module *load_modu + unlink: + /* Unlink carefully: kallsyms could be walking list. */ + list_del_rcu(&mod->list); ++ already_exists: + synchronize_sched(); + module_arch_cleanup(mod); + ddebug: + dynamic_debug_remove(debug); + cleanup: + free_modinfo(mod); +- kobject_del(&mod->mkobj.kobj); +- kobject_put(&mod->mkobj.kobj); +- free_unload: + module_unload_free(mod); + #if defined(CONFIG_MODULE_UNLOAD) && defined(CONFIG_SMP) + percpu_modfree(mod->refptr); diff --git a/lustre/kernel_patches/series/2.6-rhel6.9.series b/lustre/kernel_patches/series/2.6-rhel6.9.series new file mode 100644 index 0000000..9f8109d --- /dev/null +++ b/lustre/kernel_patches/series/2.6-rhel6.9.series @@ -0,0 +1,10 @@ +mpt-fusion-max-sge-rhel6.patch +raid5-mmp-unplug-dev-rhel6.patch +dev_read_only-2.6.32-rhel6.patch +blkdev_tunables-2.6-rhel6.patch +bh_lru_size_increase.patch +quota-replace-dqptr-sem-el6.8.patch +quota-avoid-dqget-calls.patch +jbd2-log_wait_for_space-2.6-rhel6.patch +module-load-deadlock-rhel6.9.patch +kallsyms-rhel6.patch diff --git a/lustre/kernel_patches/targets/2.6-rhel6.9.target.in b/lustre/kernel_patches/targets/2.6-rhel6.9.target.in index 29ca54a..5f9f43e 100644 --- a/lustre/kernel_patches/targets/2.6-rhel6.9.target.in +++ b/lustre/kernel_patches/targets/2.6-rhel6.9.target.in @@ -1,8 +1,8 @@ lnxmaj="2.6.32" -lnxrel="696.20.1.el6" +lnxrel="696.23.1.el6" KERNEL_SRPM=kernel-${lnxmaj}-${lnxrel}.src.rpm -SERIES=2.6-rhel6.8.series +SERIES=2.6-rhel6.9.series EXTRA_VERSION=${lnxrel}_lustre.@VERSION@ LUSTRE_VERSION=@VERSION@ diff --git a/lustre/kernel_patches/which_patch b/lustre/kernel_patches/which_patch index 8980905..a13ae12 100644 --- a/lustre/kernel_patches/which_patch +++ b/lustre/kernel_patches/which_patch @@ -17,7 +17,7 @@ PATCH SERIES FOR SERVER KERNELS: 2.6-rhel6.series 2.6.32-504.30.3.el6 (RHEL 6.6) 2.6-rhel6.series 2.6.32-573.26.1.el6 (RHEL 6.7) 2.6-rhel6.8.series 2.6.32-642.15.1.el6 (RHEL 6.8) -2.6-rhel6.8.series 2.6.32-696.20.1.el6 (RHEL 6.9) +2.6-rhel6.9.series 2.6.32-696.23.1.el6 (RHEL 6.9) 3.10-rhel7.series 3.10.0-693.21.1.el7 (RHEL 7.4) 3.0-sles11sp3.series 3.0.101-0.47.71 (SLES11 SP3) 3.0-sles11sp3.series 3.0.101-107 (SLES11 SP4) -- 1.8.3.1