From: Andreas Dilger Date: Fri, 17 Feb 2023 20:07:12 +0000 (-0700) Subject: EX-6916 build: fix default_groups handling in ofd X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=cf60eb78a712b7b9f26bec9807b87a2cc868de74;p=fs%2Flustre-release.git EX-6916 build: fix default_groups handling in ofd The ofd_procfs_add_brw_stats_symlink() function was missed during the original kobj_type default_groups change on master because it is disabled by a LUSTRE_VERSION_CODE > 2.14.53 check. This causes a crash at mount time due to accessing the (now) uninitialized default_attrs fields that are still available in RHEL8.7 kernels. Call Trace: ofd_device_alloc+0xcb/0x180 [ofd] obd_setup+0x10f/0x2c0 [obdclass] class_setup+0x575/0x750 [obdclass] class_process_config+0xe68/0x1a40 [obdclass] class_config_llog_handler+0x92e/0x1410 [obdclass] llog_process_thread+0xf16/0x1a30 [obdclass] llog_process_thread_daemonize+0x9b/0xe0 [obdclass] kthread+0x10b/0x130 ret_from_fork+0x1f/0x40 Update to using the interop accessor functions provided by LU-16120. Test-Parameters: trivial testlist=runtests serverdistro=el8.7 Fixes: db7be91e0a ("LU-16120 build: Add support for kobj_type default_groups") Signed-off-by: Andreas Dilger Change-Id: I0117dc4541230ffc9ff6d366773d859d2fce7057 Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/50055 Tested-by: jenkins Tested-by: Andreas Dilger Reviewed-by: Andreas Dilger --- diff --git a/lustre/ofd/ofd_dev.c b/lustre/ofd/ofd_dev.c index bb1ae40..113ea45 100644 --- a/lustre/ofd/ofd_dev.c +++ b/lustre/ofd/ofd_dev.c @@ -727,28 +727,14 @@ static void ofd_procfs_add_brw_stats_symlink(struct ofd_device *ofd) struct obd_device *obd = ofd_obd(ofd); struct obd_device *osd_obd = ofd->ofd_osd_exp->exp_obd; const struct kobj_type *osd_type; - int i; osd_type = get_ktype(&ofd->ofd_osd->dd_kobj); - for (i = 0; osd_type->default_attrs[i]; i++) { - if (strcmp(osd_type->default_attrs[i]->name, - "read_cache_enable") == 0) { - ofd->ofd_read_cache_enable = - osd_type->default_attrs[i]; - } - - if (strcmp(osd_type->default_attrs[i]->name, - "readcache_max_filesize") == 0) { - ofd->ofd_read_cache_max_filesize = - osd_type->default_attrs[i]; - } - - if (strcmp(osd_type->default_attrs[i]->name, - "writethrough_cache_enable") == 0) { - ofd->ofd_write_cache_enable = - osd_type->default_attrs[i]; - } - } + ofd->ofd_read_cache_enable = + get_attr_by_name(osd_type, "read_cache_enable"); + ofd->ofd_read_cache_max_filesize = + get_attr_by_name(osd_type, "readcache_max_filesize"); + ofd->ofd_write_cache_enable = + get_attr_by_name(osd_type, "writethrough_cache_enable"); if (obd->obd_proc_entry == NULL) return;