From d502883826c1d567a866f0ac41fa12c1e7e31c81 Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Tue, 30 Jan 2024 17:06:36 -0700 Subject: [PATCH] LU-17489 utils: fix 'lfs getname' ioctl breakage The removal of the explicit ioctl(OBD_IOC_GETNAME_OLD) fallback in llapi_file_fget_lov_uuid() caused 'lfs getname' to break when running against an 2.14 mountpoint missing OBD_IOC_GETDTNAME. Change this to call llapi_ioctl(OBD_IOC_GETDTNAME) which handles this compatibility mapping internally. Also fix the include header ordering to ensure LUSTRE_VERSION_CODE is defined before including lustre_ioctl_old.h. Test-Parameters: trivial Fixes: 0f38a0b9db ("LU-13107 uapi: remove obsolete ioctls") Signed-off-by: Andreas Dilger Change-Id: I944acd498a42ba4882c8391e27f4156cb63ebbe5 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/53867 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Jian Yu Reviewed-by: Arshad Hussain Reviewed-by: Oleg Drokin --- lustre/utils/liblustreapi.c | 2 +- lustre/utils/liblustreapi_ioctl.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lustre/utils/liblustreapi.c b/lustre/utils/liblustreapi.c index 2bfdfa8..0834fec 100644 --- a/lustre/utils/liblustreapi.c +++ b/lustre/utils/liblustreapi.c @@ -2089,7 +2089,7 @@ int llapi_file_fget_lov_uuid(int fd, struct obd_uuid *lov_name) { int rc; - rc = ioctl(fd, OBD_IOC_GETDTNAME, lov_name); + rc = llapi_ioctl(fd, OBD_IOC_GETDTNAME, lov_name); if (rc) { rc = -errno; llapi_error(LLAPI_MSG_ERROR, rc, "cannot get lov name"); diff --git a/lustre/utils/liblustreapi_ioctl.c b/lustre/utils/liblustreapi_ioctl.c index 73cab49..296f3f9 100644 --- a/lustre/utils/liblustreapi_ioctl.c +++ b/lustre/utils/liblustreapi_ioctl.c @@ -40,8 +40,8 @@ #include #include #include -#include #include +#include #include "lustreapi_internal.h" @@ -167,7 +167,7 @@ int llapi_ioctl(int fd, unsigned int cmd, void *buf) * Version in comment is to allow finding this code for later removal. */ #ifdef OBD_IOC_GETNAME_OLD /* < OBD_OCD_VERSION(2, 18, 53, 0) */ - case OBD_IOC_GETMDNAME: + case OBD_IOC_GETDTNAME: oldcmd = OBD_IOC_GETNAME_OLD; break; #endif -- 1.8.3.1