Whamcloud - gitweb
EX-4157 lipe: comment out ldiskfs functions for client-only lpcc_purge
authorLei Feng <flei@whamcloud.com>
Thu, 28 Oct 2021 09:06:36 +0000 (05:06 -0400)
committerAndreas Dilger <adilger@whamcloud.com>
Thu, 4 Nov 2021 17:21:10 +0000 (17:21 +0000)
Sometime the client system does not have ldiskfs libs, then lpcc_purge
fails to start on it because some ldiskfs symbols cannot be found.
So comment out these codes for a client-only building.

Change-Id: I4a38f1128b9e66d495f94ef7ebd91f26ea052b67
Signed-off-by: Lei Feng <flei@whamcloud.com>
Test-Parameters: trivial testlist=sanity-pcc env=ONLY=200-202,ONLY_REPEAT=50 \
                 clientextra_install_params="--packages lipe-lpcc"
Reviewed-on: https://review.whamcloud.com/45394
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: John L. Hammond <jhammond@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lipe/configure.ac
lipe/src/Makefile.am
lipe/src/policy.c
lipe/src/posix.c
lipe/src/posix.h

index 3e74216..3bd7dcb 100644 (file)
@@ -221,6 +221,9 @@ AC_ARG_ENABLE([server],
 AC_MSG_RESULT([$enable_server])
 AM_CONDITIONAL([BUILD_SERVER], [test x$enable_server = xyes])
 
+AS_IF([test "x$enable_server" = xyes ],
+       [AC_DEFINE(HAVE_LDISKFS, 1, [enable ldiskfs support])])
+
 # -------- check whether enable zfs support --------
 AC_MSG_CHECKING([whether enable zfs support])
 AC_ARG_ENABLE([zfs],
index 30d8eb8..0229c8b 100644 (file)
@@ -34,22 +34,26 @@ endif
 LIPE_SOURCES = debug.c debug.h \
                flist.c flist.h misc.c misc.h \
                lustre_ea.c lustre_ea.h \
-               lipe_ldiskfs.c lipe_ldiskfs.h \
                lipe_object_attrs.c \
                lipe_object_attrs.h \
                lipe_version.c \
                lipe_version.h \
                policy.c policy.h \
-               ldiskfs_read_ldd.c ldiskfs_read_ldd.h \
                general_policy.h general_policy.c \
-               lustre_ea_ldiskfs.c lustre_ea_ldiskfs.h \
                posix.c posix.h posix_ea.c posix_ea.h
 
 if BUILD_SERVER
 ext4_inode2path_SOURCES = debug.c debug.h ext4_inode2path.c
 
-LIPE_SOURCES += cmd.c cmd.h \
-               list.h
+LIPE_SOURCES += cmd.c \
+               cmd.h \
+               ldiskfs_read_ldd.c \
+               ldiskfs_read_ldd.h \
+               lipe_ldiskfs.c \
+               lipe_ldiskfs.h \
+               list.h \
+               lustre_ea_ldiskfs.c \
+               lustre_ea_ldiskfs.h
 endif
 
 LIPE_CFLAGS = -Wall -Werror -g -I/usr/include $(json_c_CFLAGS)
index 78221fa..debfa85 100644 (file)
 #include <linux/lustre/lustre_ostid.h>
 #include "debug.h"
 #include "general_policy.h"
-#include "ldiskfs_read_ldd.h"
-#include "lipe_ldiskfs.h"
 #include "lipe_scan2.h"
 #ifdef HAVE_ZFS
 # include "lipe_zfs.h"
 #endif
 #include "lustre_ea.h"
-#include "lustre_ea_ldiskfs.h"
+
+#ifdef HAVE_LDISKFS
+# include "ldiskfs_read_ldd.h"
+# include "lipe_ldiskfs.h"
+# include "lustre_ea_ldiskfs.h"
+#endif
+
 #include "policy.h"
 #include "posix.h"
 
@@ -2014,6 +2018,7 @@ int scan_threads_start(struct thread_info **pinfo,
                }
 
                switch (backfs_type) {
+#ifdef HAVE_LDISKFS
                case LBT_LUSTRE_ON_LDISKFS:
                case LBT_EXT4:
                        rc = pthread_create(&infos[i].ti_thread_id, &attr,
@@ -2021,6 +2026,7 @@ int scan_threads_start(struct thread_info **pinfo,
                        if (rc == 0)
                                tmp_pinfo->ti_started = true;
                        break;
+#endif
 #ifdef HAVE_ZFS
                case LBT_LUSTRE_ON_ZFS:
                case LBT_ZFS:
@@ -2203,7 +2209,6 @@ static int lipe_detect_directory(const char *dev)
 
 enum lipe_backfs_type lipe_detect_fs_type(const char *dev)
 {
-       ext2_filsys fs;
        int rc;
        enum lipe_backfs_type fs_type = LBT_UNKNOWN;
 
@@ -2211,9 +2216,12 @@ enum lipe_backfs_type lipe_detect_fs_type(const char *dev)
        if (rc == 1) {
                LDEBUG("directory is detected on [%s]\n", dev);
                return LBT_POSIX;
-       } else if (rc < 0) {
+       } else if (rc < 0)
                goto out;
-       }
+
+#ifdef HAVE_LDISKFS
+       /* check whether it is ldiskfs */
+       ext2_filsys fs;
 
        rc = ext2fs_open(dev, LDISKFS_OPENFS_FLAGS,
                         0, 0, unix_io_manager, &fs);
@@ -2230,7 +2238,9 @@ enum lipe_backfs_type lipe_detect_fs_type(const char *dev)
                }
                LINFO("Lustre on Ldiskfs is detected on device [%s]\n", dev);
                fs_type = LBT_LUSTRE_ON_LDISKFS;
-       } else {
+       } else
+#endif /* HAVE_LDISKFS */
+       {
 #ifdef HAVE_ZFS
                FILE *fp;
                char cmd[PATH_MAX];
@@ -2276,7 +2286,7 @@ enum lipe_backfs_type lipe_detect_fs_type(const char *dev)
                        LINFO("pure ZFS is detected on device [%s]\n", dev);
                }
 #else
-               LERROR("invalid device [%s], %s\n", dev, strerror(errno));
+               LERROR("unsupported device type [%s], %s\n", dev, strerror(errno));
 #endif
        }
 out:
@@ -2320,8 +2330,9 @@ int lipe_scan(struct lipe_instance *instance,
        case LBT_POSIX:
                rc = posix_scan(instance, policy, result, sum_counter_list,
                                sum_classify_list, NULL, num_threads, workspace,
-                               abort_failure);
+                               abort_failure, ldd_error);
                break;
+#if HAVE_LDISKFS
        case LBT_LUSTRE_ON_LDISKFS:
        case LBT_EXT4:
                rc = ldiskfs_scan(instance, policy, result, sum_counter_list,
@@ -2329,6 +2340,7 @@ int lipe_scan(struct lipe_instance *instance,
                                  abort_failure,
                                  ldd_error);
                break;
+#endif
 #ifdef HAVE_ZFS
        case LBT_LUSTRE_ON_ZFS:
        case LBT_ZFS:
@@ -2467,8 +2479,10 @@ int lipe_scan2(const char *device,
                                NULL /* sum_classify_list */,
                                thread_data, thread_count,
                                NULL /* workspace */,
-                               false /* abort_failure */);
+                               false /* abort_failure */,
+                               &ldd_error);
                break;
+#ifdef HAVE_LDISKFS
        case LBT_LUSTRE_ON_LDISKFS:
        case LBT_EXT4:
                rc = ldiskfs_scan(instance,
@@ -2481,6 +2495,7 @@ int lipe_scan2(const char *device,
                                  false /* abort_failure */,
                                  &ldd_error);
                break;
+#endif
 #ifdef HAVE_ZFS
        case LBT_LUSTRE_ON_ZFS:
        case LBT_ZFS:
index be926db..a95ff85 100644 (file)
@@ -324,7 +324,8 @@ int posix_scan(struct lipe_instance *instance,
               void **thread_data,
               int num_threads,
               const char *workspace,
-              bool abort_failure)
+              bool abort_failure,
+              bool *ldd_error)
 {
        int                      rc;
        struct thread_info      *infos = NULL;
index 981b3e8..25a5e41 100644 (file)
@@ -30,5 +30,6 @@ int posix_scan(struct lipe_instance *instance,
               void **thread_data,
               int num_threads,
               const char *workspace,
-              bool abort_failure);
+              bool abort_failure,
+              bool *ldd_error);
 #endif /* _LIPE_POSIX_H_ */