[LU-13826] fix compatibility for LL_IOC_MDC_GETINFO Created: 28/Jul/20  Updated: 09/Dec/20  Resolved: 09/Dec/20

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.14.0, Lustre 2.12.6
Fix Version/s: Lustre 2.14.0

Type: Bug Priority: Major
Reporter: Andreas Dilger Assignee: Qian Yingjin
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Related
is related to LU-11367 integrate LSOM with lfs find Resolved
is related to LU-10934 integrate statx() API with Lustre Resolved
Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

In master the LL_IOC_MDC_GETINFO definition changed when patch https://review.whamcloud.com/36674 "LU-10934 llite: integrate statx() API with Lustre" landed:

b2_10$ git grep '#define LL_IOC_MDC_GETINFO'
master:lustre/include/lustre/lustre_user.h:#define LL_IOC_MDC_GETINFO      _IOWR(IOC_MDC_TYPE, 23, struct lov_user_mds_data *)
master$ git grep '#define LL_IOC_MDC_GETINFO' 
lustre/include/uapi/linux/lustre/lustre_user.h:#define LL_IOC_MDC_GETINFO_OLD	_IOWR(IOC_MDC_TYPE, 23, struct lov_user_mds_data_v1 *)
lustre/include/uapi/linux/lustre/lustre_user.h:#define LL_IOC_MDC_GETINFO	_IOWR(IOC_MDC_TYPE, 23, struct lov_user_mds_data)

Which is obviously bad. It's also subtly bad in that the second ioctl depends on how lov_user_mds_data is defined, and it contains a different struct statx with different field names, so while the IOC numbers/structs are ABI compatible, it is not API compatible and applications using this header will break. For added confusion, this changed in 2.12.4 vs. 2.12.3. If we add a newer structure and update the definition as we have then should definition of LL_IOC_MDC_GETINFO change as well?

The suggestion is that we do:

#define LL_IOC_MDC_GETINFO_V1 _IOWR(IOC_MDC_TYPE, 23, struct lov_user_mds_data_v1 *)
#define LL_IOC_MDC_GETINFO_V2 _IOWR(IOC_MDC_TYPE, 23, struct lov_user_mds_data_v2)

in master and b2_12. Then we can use the explicitly versioned constants everywhere for the in-tree code, and declare LL_IOC_MDC_GETINFO in a compatible way, but external applications can select the version that they want explicitly.



 Comments   
Comment by Andreas Dilger [ 28/Jul/20 ]

Alternately, applications could/should use llapi_get_lum_file_fd(3) or llapi_get_lum_dir_fd(3) (added in 2.12.4 and 2.13) to avoid the low-level details of the ioctl interface.

Comment by Gerrit Updater [ 04/Dec/20 ]

Yingjin Qian (qian@ddn.com) uploaded a new patch: https://review.whamcloud.com/40858
Subject: LU-13826 utils: fix compatibility for LL_IOC_MDC_GETINFO
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 26bf875db85e27cddfadf0c08ec26491166f62d7

Comment by Gerrit Updater [ 09/Dec/20 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/40858/
Subject: LU-13826 utils: fix compatibility for LL_IOC_MDC_GETINFO
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 449c648793d2fc4e8eee3a2dd918379b75cc81e2

Comment by Peter Jones [ 09/Dec/20 ]

Landed for 2.14

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