Whamcloud - gitweb
LU-17489 utils: fix 'lfs getname' ioctl breakage 67/53867/3
authorAndreas Dilger <adilger@whamcloud.com>
Wed, 31 Jan 2024 00:06:36 +0000 (17:06 -0700)
committerOleg Drokin <green@whamcloud.com>
Thu, 15 Feb 2024 07:00:24 +0000 (07:00 +0000)
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 <adilger@whamcloud.com>
Change-Id: I944acd498a42ba4882c8391e27f4156cb63ebbe5
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/53867
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/utils/liblustreapi.c
lustre/utils/liblustreapi_ioctl.c

index 2bfdfa8..0834fec 100644 (file)
@@ -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");
index 73cab49..296f3f9 100644 (file)
@@ -40,8 +40,8 @@
 #include <lustre/lustreapi.h>
 #include <libcfs/util/ioctl.h>
 #include <linux/lustre/lustre_ioctl.h>
-#include <lustre_ioctl_old.h>
 #include <linux/lustre/lustre_ver.h>
+#include <lustre_ioctl_old.h>
 
 #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