From: Andreas Dilger Date: Mon, 29 Mar 2021 13:12:50 +0000 (-0400) Subject: LU-13107 uapi: remove obsolete ioctls X-Git-Tag: 2.14.52~164 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=refs%2Fchanges%2F07%2F37107%2F6;ds=sidebyside LU-13107 uapi: remove obsolete ioctls Remove some very obsolete ioctl number definitions. Highlight that some of the ioctl codes conflict with upstream FSVerity ioctls that we may need to implement in the future. This does not necessarily mean the actual ioctl numbers will conflict (the "size" field can disambiguate them), but we should avoid this range when adding new ioctls. Migrate llapi_file_fget_lov_uuid() over to a new OBD_IOC_GETDTNAME ioctl number to fix one of the conflicting ioctl numbers. Signed-off-by: Andreas Dilger Change-Id: Ic330085b868dd6e284344b3fccd72dd958ecab07 Reviewed-on: https://review.whamcloud.com/37107 Tested-by: jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Jian Yu Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/uapi/linux/lustre/lustre_ioctl.h b/lustre/include/uapi/linux/lustre/lustre_ioctl.h index 927f585..bfd91cf 100644 --- a/lustre/include/uapi/linux/lustre/lustre_ioctl.h +++ b/lustre/include/uapi/linux/lustre/lustre_ioctl.h @@ -132,11 +132,6 @@ static inline __u32 obd_ioctl_packlen(struct obd_ioctl_data *data) */ #define OBD_IOC_DATA_TYPE long -/* IOC_LDLM_TEST _IOWR('f', 40, long) */ -/* IOC_LDLM_DUMP _IOWR('f', 41, long) */ -/* IOC_LDLM_REGRESS_START _IOWR('f', 42, long) */ -/* IOC_LDLM_REGRESS_STOP _IOWR('f', 43, long) */ - #define OBD_IOC_CREATE _IOWR('f', 101, OBD_IOC_DATA_TYPE) #define OBD_IOC_DESTROY _IOW('f', 104, OBD_IOC_DATA_TYPE) /* OBD_IOC_PREALLOCATE _IOWR('f', 105, OBD_IOC_DATA_TYPE) */ @@ -148,25 +143,20 @@ static inline __u32 obd_ioctl_packlen(struct obd_ioctl_data *data) #define OBD_IOC_STATFS _IOWR('f', 113, OBD_IOC_DATA_TYPE) #define OBD_IOC_SYNC _IOW('f', 114, OBD_IOC_DATA_TYPE) -/* OBD_IOC_READ2 _IOWR('f', 115, OBD_IOC_DATA_TYPE) */ -/* OBD_IOC_FORMAT _IOWR('f', 116, OBD_IOC_DATA_TYPE) */ -/* OBD_IOC_PARTITION _IOWR('f', 117, OBD_IOC_DATA_TYPE) */ -/* OBD_IOC_COPY _IOWR('f', 120, OBD_IOC_DATA_TYPE) */ -/* OBD_IOC_MIGR _IOWR('f', 121, OBD_IOC_DATA_TYPE) */ -/* OBD_IOC_PUNCH _IOWR('f', 122, OBD_IOC_DATA_TYPE) */ - -/* OBD_IOC_MODULE_DEBUG _IOWR('f', 124, OBD_IOC_DATA_TYPE) */ + #define OBD_IOC_BRW_READ _IOWR('f', 125, OBD_IOC_DATA_TYPE) #define OBD_IOC_BRW_WRITE _IOWR('f', 126, OBD_IOC_DATA_TYPE) #define OBD_IOC_NAME2DEV _IOWR('f', 127, OBD_IOC_DATA_TYPE) +#define OBD_IOC_GETDTNAME _IOR('f', 127, char[MAX_OBD_NAME]) +/* ioctl codes 128-143 are reserved for fsverity */ #define OBD_IOC_UUID2DEV _IOWR('f', 130, OBD_IOC_DATA_TYPE) -#define OBD_IOC_GETNAME _IOWR('f', 131, OBD_IOC_DATA_TYPE) +#define OBD_IOC_GETNAME_OLD _IOWR('f', 131, OBD_IOC_DATA_TYPE) #define OBD_IOC_GETMDNAME _IOR('f', 131, char[MAX_OBD_NAME]) -#define OBD_IOC_GETDTNAME OBD_IOC_GETNAME /* OBD_IOC_LOV_GET_CONFIG _IOWR('f', 132, OBD_IOC_DATA_TYPE) until 2.14 */ #define OBD_IOC_CLIENT_RECOVER _IOW('f', 133, OBD_IOC_DATA_TYPE) -/* was OBD_IOC_PING_TARGET _IOW('f', 136, OBD_IOC_DATA_TYPE) until 2.11 */ -/* OBD_IOC_DEC_FS_USE_COUNT _IO('f', 139) */ +/* ioctl codes 128-143 are reserved for fsverity */ +/* FS_IOC_ENABLE_VERITY _IOW('f', 133, struct fsverity_enable_arg) */ +/* FS_IOC_MEASURE_VERITY _IOW('f', 134, struct fsverity_digest) */ /* was OBD_IOC_NO_TRANSNO _IOW('f', 140, OBD_IOC_DATA_TYPE) until 2.14 */ #define OBD_IOC_SET_READONLY _IOW('f', 141, OBD_IOC_DATA_TYPE) #define OBD_IOC_ABORT_RECOVERY _IOR('f', 142, OBD_IOC_DATA_TYPE) @@ -174,7 +164,7 @@ enum obd_abort_recovery_flags { OBD_FLG_ABORT_RECOV_OST = 0x00008, /* LMD_FLG_ABORT_RECOV */ OBD_FLG_ABORT_RECOV_MDT = 0x40000, /* LMD_FLG_ABORT_RECOV_MDT */ }; -/* OBD_IOC_ROOT_SQUASH _IOWR('f', 143, OBD_IOC_DATA_TYPE) */ +/* ioctl codes 128-143 are reserved for fsverity */ #define OBD_GET_VERSION _IOWR('f', 144, OBD_IOC_DATA_TYPE) /* OBD_IOC_GSS_SUPPORT _IOWR('f', 145, OBD_IOC_DATA_TYPE) */ /* OBD_IOC_CLOSE_UUID _IOWR('f', 147, OBD_IOC_DATA_TYPE) */ diff --git a/lustre/include/uapi/linux/lustre/lustre_user.h b/lustre/include/uapi/linux/lustre/lustre_user.h index 7e79f3f..24867af 100644 --- a/lustre/include/uapi/linux/lustre/lustre_user.h +++ b/lustre/include/uapi/linux/lustre/lustre_user.h @@ -570,6 +570,7 @@ struct ll_ioc_lease_id { * *INFO - set/get lov_user_mds_data */ /* lustre_ioctl.h 101-150 */ +/* ioctl codes 128-143 are reserved for fsverity */ #define LL_IOC_GETFLAGS _IOR ('f', 151, long) #define LL_IOC_SETFLAGS _IOW ('f', 152, long) #define LL_IOC_CLRFLAGS _IOW ('f', 153, long) diff --git a/lustre/llite/dir.c b/lustre/llite/dir.c index 73444a7..7657dd5 100644 --- a/lustre/llite/dir.c +++ b/lustre/llite/dir.c @@ -1902,8 +1902,11 @@ out_quotactl: OBD_FREE(qctl, qctl_len); RETURN(rc); } - case OBD_IOC_GETDTNAME: - case OBD_IOC_GETMDNAME: + case OBD_IOC_GETNAME_OLD: + /* fall through */ + case OBD_IOC_GETDTNAME: + /* fall through */ + case OBD_IOC_GETMDNAME: RETURN(ll_get_obd_name(inode, cmd, arg)); case LL_IOC_FLUSHCTX: RETURN(ll_flush_ctx(inode)); diff --git a/lustre/llite/file.c b/lustre/llite/file.c index e0a902a..df25d52 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -3810,7 +3810,10 @@ out: RETURN(0); } + case OBD_IOC_GETNAME_OLD: + /* fall through */ case OBD_IOC_GETDTNAME: + /* fall through */ case OBD_IOC_GETMDNAME: RETURN(ll_get_obd_name(inode, cmd, arg)); case LL_IOC_HSM_STATE_GET: { diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index f2d433a..b5447d4 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -3194,7 +3194,7 @@ int ll_get_obd_name(struct inode *inode, unsigned int cmd, unsigned long arg) struct obd_device *obd; ENTRY; - if (cmd == OBD_IOC_GETDTNAME) + if (cmd == OBD_IOC_GETNAME_OLD || cmd == OBD_IOC_GETDTNAME) obd = class_exp2obd(sbi->ll_dt_exp); else if (cmd == OBD_IOC_GETMDNAME) obd = class_exp2obd(sbi->ll_md_exp); diff --git a/lustre/utils/liblustreapi.c b/lustre/utils/liblustreapi.c index d042424..0f85d29 100644 --- a/lustre/utils/liblustreapi.c +++ b/lustre/utils/liblustreapi.c @@ -2310,23 +2310,29 @@ out: int llapi_file_fget_lov_uuid(int fd, struct obd_uuid *lov_name) { - int rc = ioctl(fd, OBD_IOC_GETNAME, lov_name); + int rc; + rc = ioctl(fd, OBD_IOC_GETDTNAME, lov_name); + if (rc && errno == ENOTTY) + rc = ioctl(fd, OBD_IOC_GETNAME_OLD, lov_name); if (rc) { rc = -errno; llapi_error(LLAPI_MSG_ERROR, rc, "cannot get lov name"); } + return rc; } int llapi_file_fget_lmv_uuid(int fd, struct obd_uuid *lov_name) { - int rc = ioctl(fd, OBD_IOC_GETMDNAME, lov_name); + int rc; + rc = ioctl(fd, OBD_IOC_GETMDNAME, lov_name); if (rc) { rc = -errno; llapi_error(LLAPI_MSG_ERROR, rc, "error: can't get lmv name."); } + return rc; }