[LU-14145] protect cli->cl_import with with_imp_locked() Created: 20/Nov/20  Updated: 21/Nov/20

Status: Open
Project: Lustre
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Jian Yu Assignee: Neil Brown
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Related
is related to LU-9855 Clean up obdclass preprocessor code Resolved
is related to LU-13503 allow setting larger max_mod_rpcs_in_... Resolved
Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

Protect cli->cl_import with with_imp_locked():

/* You must use these macros when you want to refer to
 * the import in a client obd_device for a lprocfs entry
 */
#define with_imp_locked(__obd, __imp, __rc)                             \
        for (down_read(&(__obd)->u.cli.cl_sem),                         \
             __imp = (__obd)->u.cli.cl_import,                          \
             __rc = __imp ? 0 : -ENODEV;                                \
             __imp ? 1 : (up_read(&(__obd)->u.cli.cl_sem), 0);          \
             __imp = NULL)


 Comments   
Comment by James A Simmons [ 20/Nov/20 ]

Note Neil has a patch for this at https://review.whamcloud.com/#/c/39595/

Comment by Jian Yu [ 21/Nov/20 ]

Thank you James.
The following code in obd_set_max_mod_rpcs_in_flight() is not covered in the above patch:

        ocd = &cli->cl_import->imp_connect_data;
Comment by James A Simmons [ 21/Nov/20 ]

His patch does improve things including handling nested locking, but I did mention in the patch's review other things that need to be covered such as  imp_connect_data and imp_generation access as well. Also lov_iocontrol() does no locking for cl_import access. So another patch is needed.

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