From: Lei Feng Date: Thu, 28 Oct 2021 09:06:36 +0000 (-0400) Subject: EX-4157 lipe: comment out ldiskfs functions for client-only lpcc_purge X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=e774698118570f075c49f9ffb571b5678db4d7cd;p=fs%2Flustre-release.git EX-4157 lipe: comment out ldiskfs functions for client-only lpcc_purge 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 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 Tested-by: Maloo Reviewed-by: John L. Hammond Reviewed-by: Andreas Dilger --- diff --git a/lipe/configure.ac b/lipe/configure.ac index 3e74216..3bd7dcb 100644 --- a/lipe/configure.ac +++ b/lipe/configure.ac @@ -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], diff --git a/lipe/src/Makefile.am b/lipe/src/Makefile.am index 30d8eb8..0229c8b 100644 --- a/lipe/src/Makefile.am +++ b/lipe/src/Makefile.am @@ -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) diff --git a/lipe/src/policy.c b/lipe/src/policy.c index 78221fa..debfa85 100644 --- a/lipe/src/policy.c +++ b/lipe/src/policy.c @@ -16,14 +16,18 @@ #include #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: diff --git a/lipe/src/posix.c b/lipe/src/posix.c index be926db9..a95ff85 100644 --- a/lipe/src/posix.c +++ b/lipe/src/posix.c @@ -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; diff --git a/lipe/src/posix.h b/lipe/src/posix.h index 981b3e8..25a5e41 100644 --- a/lipe/src/posix.h +++ b/lipe/src/posix.h @@ -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_ */