[LU-16291] make kobj_type constant Created: 03/Nov/22  Updated: 29/Nov/23  Resolved: 13/Dec/22

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: None
Fix Version/s: Lustre 2.16.0, Lustre 2.15.3

Type: Bug Priority: Minor
Reporter: Jian Yu Assignee: Jian Yu
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Related
is related to LU-16221 RHEL 9.1 support Resolved
Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

Kernel v5.16-rc2-28-gee6d3dd4ed48:

commit ee6d3dd4ed48ab24b74bab3c3977b8218518247d
Author:     Wedson Almeida Filho <wedsonaf@google.com>
AuthorDate: Fri Dec 24 23:13:45 2021 +0000
Commit:     Greg Kroah-Hartman <gregkh@linuxfoundation.org>
CommitDate: Mon Dec 27 10:40:00 2021 +0100

    driver core: make kobj_type constant.
    
    This way instances of kobj_type (which contain function pointers) can be
    stored in .rodata, which means that they cannot be [easily/accidentally]
    modified at runtime.
    
    Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com>
    Link: https://lore.kernel.org/r/20211224231345.777370-1-wedsonaf@google.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Lustre build failed:

lustre/obdclass/obd_config.c: In function 'class_modify_config':
lustre/obdclass/obd_config.c:1639:13: error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
13:36:52  1639 |         typ = get_ktype(kobj);
13:36:52       |             ^
13:36:52 cc1: all warnings being treated as errors


 Comments   
Comment by Jian Yu [ 03/Nov/22 ]

Hi stancheff, I'm not sure if you already have a patch for this issue. I'm working on it based on your patch series.

Comment by Shaun Tancheff [ 03/Nov/22 ]

I did encounter that in LU-16120, however the larger change introduced some regressions so smaller fix for just "const struct kobj_type *" would be good.

I think you will not need a compile test, just add const to the declaration in class_modify_config().

Comment by Jian Yu [ 03/Nov/22 ]

Got it, thank you, Shaun.

Comment by Gerrit Updater [ 04/Nov/22 ]

"Jian Yu <yujian@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/49043
Subject: LU-16291 build: make kobj_type constant
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 826d15e85168cbb82420e2d06460c074440f3804

Comment by Gerrit Updater [ 10/Nov/22 ]

"Jian Yu <yujian@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/49123
Subject: LU-16291 build: make kobj_type constant
Project: fs/lustre-release
Branch: b2_15
Current Patch Set: 1
Commit: 0949e43dd3eb9150dae9b64770390112901d247b

Comment by Gerrit Updater [ 13/Dec/22 ]

"Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/49043/
Subject: LU-16291 build: make kobj_type constant
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: d1dbf26afd6676e02a2a00e635b9ad1fe14cf68e

Comment by Peter Jones [ 13/Dec/22 ]

Landed for 2.16

Comment by Gerrit Updater [ 08/Mar/23 ]

"Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/49123/
Subject: LU-16291 build: make kobj_type constant
Project: fs/lustre-release
Branch: b2_15
Current Patch Set:
Commit: 88783c0f8e05178090548960e051a624a1c6561a

Comment by Gerrit Updater [ 28/Nov/23 ]

"Jian Yu <yujian@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/53263
Subject: LU-16291 build: make kobj_type constant
Project: fs/lustre-release
Branch: b2_12
Current Patch Set: 1
Commit: 062c7d6e9a40c6f6a84a2fc2709f462859e42400

Comment by Gerrit Updater [ 29/Nov/23 ]

"Jian Yu <yujian@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/53277
Subject: LU-16291 build: make kobj_type constant
Project: fs/lustre-release
Branch: b2_14
Current Patch Set: 1
Commit: 20ba62e209463d3a07f088884a860b6879d885de

Generated at Sat Feb 10 03:25:42 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.