[LU-6202] clean up ioctl handling Created: 03/Feb/15  Updated: 10/Sep/20

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

Type: Bug Priority: Minor
Reporter: Andreas Dilger Assignee: James A Simmons
Resolution: Unresolved Votes: 0
Labels: medium

Issue Links:
Related
is related to LU-9128 remove OBD_OCD_VERSION-ed out code Resolved
is related to LU-5969 Create an LGPL version of liblustreapi Open
is related to LU-6401 Untangle lustre userland and kernel h... Resolved
is related to LU-137 ioctl passthrough mechanism for Lustr... Resolved
is related to LU-9680 Improve the user land to kernel space... In Progress
is related to LU-13107 clean up lctl commands Resolved
Severity: 3
Rank (Obsolete): 17336

 Description   

There are a large number of ioctl cleanups that are needed for Lustre. A start is in http://review.whamcloud.com/10139 but there is more that could be done. The biggest offender is anything using struct libcfs_ioctl_data, which is a horrible structure that passes pointers from userspace to the kernel. Anything using that struct is a candidate for cleanup.

The complexity is that Lustre ioctls are done in /dev/lnet or /dev/obd and may address any device in the stack (LNDs, OBD devices, etc). At a minimum, the libcfs_ioctl_data should be cleaned up to be a properly packed structure without internal pointers, but better would be proper ioctl structures that do not try to be all things to all users.

It seems unlikely that we need to keep the lctl device configuration interface anymore (attach, detach, setup, cleanup, dump_cfg, etc), so all userspace commands/structures related to that could be removed.

Some code (e.g. jt_obd_dump_log()) is obsolete due to liblustre removal and could also be removed outright.

llapi_get_version() can read the version from /proc/fs/lustre/version via llapi_get_param() or similar, instead of using an ioctl.

There is probably more, and possibly this needs to be split into several bugs, but at least it is a starting point for such cleanups.



 Comments   
Comment by James A Simmons [ 22/Apr/17 ]

The review by Andreas for the patch to make lustre_ioctl.h a proper UAPI pointed out several IOCTLs that are obsolete. I'm placing the list here so its not lost. Besides the cleanup in lustre_ioctl.h the utilites and kernel code have to scanned to make sure we don't have source code left overs.

There are a bunch of ioctl definitions that could be removed completely, rather than continuing to shuffle them around.

I suspect there are even some un-commented ioctls that could be removed, but that is more work to check.

lustre/include/uapi/linux/lustre_ioctl.h
Line 141:

All of these IOC_LDLM_* ioctls are obsolete since 1.5 and can be removed.

Line 157:

Hasn't been used since pre-1.0, should just be deleted. Same for OBD_IOC_FORMAT, OBD_IOC_PARTITION, OBD_IOC_COPY, OBD_IOC_MIGR, OBD_IOC_PUNCH, and OBD_IOC_MODULE_DEBUG

Line 176:

Can just be removed, per above.

Line 180:

Obsolete since 1.5, can be removed.

Line 182:

Has never been used.

Line 183:

Obsolete since before 1.4.

Line 184:

Just removed in 2.10, keep this one.

Line 199:

Obsolete since 1.5, along with OBD_IOC_ENDRECORD, OBD_IOC_PARSE, and OBD_IOC_DORECORD.

 

Comment by Gerrit Updater [ 04/Oct/18 ]

James Simmons (uja.ornl@yahoo.com) uploaded a new patch: https://review.whamcloud.com/33284
Subject: LU-6202 libcfs: replace libcfs_register_ioctl with a blocking notifier_chain
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: eded4e93a52aead577a26e11ec3a05961d07428f

Comment by James A Simmons [ 04/Oct/18 ]

This first patch moves libcfs_register_ioctl to the blocking notifier_chain the kernel uses. From their we can move the obd_iocontrol() handling to this as well. The benefit of this approach is that we can register ioctls of the backend filesystem with the blocking notifier_chain to meet the LU-137 work.

Comment by Gerrit Updater [ 10/Oct/18 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/33284/
Subject: LU-6202 libcfs: replace libcfs_register_ioctl with a blocking notifier_chain
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: fba98579efc4fe3bb69309041b60d7723475b5e2

Comment by Gerrit Updater [ 20/Nov/18 ]

Andreas Dilger (adilger@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/33691
Subject: LU-6202 misc: delete OBD_IOC_PING_TARGT ioctl
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: b7f0d6d02f839f3c4757b2048ea7fe226f568c73

Comment by Gerrit Updater [ 20/Nov/18 ]

Andreas Dilger (adilger@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/33692
Subject: LU-6202 misc: remove LIBCFS_IOC_DEBUG_MASK ioctl
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: e1bc122bfa88b06f873ed2ff5a4cedef308a9660

Comment by Gerrit Updater [ 20/Nov/18 ]

Andreas Dilger (adilger@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/33693
Subject: LU-6202 utils: remove obsolete l_ioctl2() wrapper
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 941ba3ecb03ffcede12527961a59548cf9f8ec36

Comment by Gerrit Updater [ 20/Nov/18 ]

Andreas Dilger (adilger@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/33695
Subject: LU-6202 utils: allow device_list for non-root users
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: dc2798a989f809f55757aae40d85950aa70afd1b

Comment by Gerrit Updater [ 01/Apr/19 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/33691/
Subject: LU-6202 misc: delete OBD_IOC_PING_TARGET ioctl
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: d17d6ef74e522a4b57f2824161788a69f32bd5e7

Comment by Gerrit Updater [ 01/Apr/19 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/33692/
Subject: LU-6202 misc: remove LIBCFS_IOC_DEBUG_MASK ioctl
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 70f932c7bfc590c03309bd2a83db20dd6ef5a8d4

Comment by Gerrit Updater [ 30/Jul/19 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/33693/
Subject: LU-6202 utils: remove obsolete l_ioctl2() wrapper
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: b3f3486723084f14493b3866803274576ed9e269

Comment by Andreas Dilger [ 30/Aug/19 ]

James Simmons (jsimmons@infradead.org) uploaded a new patch: https://review.whamcloud.com/35993
Subject: LU-6202 obd: separate client and server specific fields from struct obd_device
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: a00b3db4147dbf95433c3b7c1bc0ebe5329b63d8

Comment by Gerrit Updater [ 09/Apr/20 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/35993/
Subject: LU-6202 obd: replace OBD_IOC_NO_TRANSNO with sysfs file
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 6706bfa81998c999012909e4cfcd1d3dbc347075

Generated at Sat Feb 10 01:58:08 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.