Whamcloud - gitweb
LU-10973 lutf: Fix order of linking for python modules 78/46478/15
authorJames Simmons <jsimmons@infradead.org>
Sun, 31 Jul 2022 14:06:08 +0000 (10:06 -0400)
committerOleg Drokin <green@whamcloud.com>
Wed, 13 Dec 2023 12:18:46 +0000 (12:18 +0000)
LUTF normally works but in some test cases at startup we got:

ImportError: lustre/test/lutrf/src/_lnetconfig.so:
undefined symbol: lustre_lnet_del_ni

If you check the symbol is there. The issue is the linking order.
We need to put the generated module name before all its
dependencies.

Also, remove cfs_expr_list_match from string.h, move the definition
to nidstrings.c, and make it static.

Test-Parameters: @lnet
Change-Id: Ia57fbd9d5795d845ea14bc1416f968383afcba2b
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Timothy Day <timday@amazon.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/46478
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Reviewed-by: Frank Sehr <fsehr@whamcloud.com>
Reviewed-by: Cyril Bordage <cbordage@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
libcfs/include/libcfs/util/string.h
libcfs/libcfs/util/nidstrings.c
libcfs/libcfs/util/string.c
lustre/tests/lutf/src/Makefile.am

index 3ad5a95..dcfe29e 100644 (file)
@@ -128,7 +128,6 @@ int cfs_str2num_check(char *str, int nob, unsigned *num,
                      unsigned min, unsigned max);
 int cfs_human_readable2long(unsigned long *sizep, char *str);
 int cfs_expr2str(struct list_head *list, char *str, size_t size);
-int cfs_expr_list_match(__u32 value, struct cfs_expr_list *expr_list);
 int cfs_expr_list_print(char *buffer, int count,
                        struct cfs_expr_list *expr_list);
 int cfs_expr_list_parse(char *str, int len, unsigned min, unsigned max,
index c9e31a4..636fa36 100644 (file)
@@ -481,6 +481,26 @@ cfs_ip_addr_range_gen(__u32 *ip_list, int count, struct list_head *ip_addr_expr)
 }
 
 /**
+ * Matches value (\a value) against ranges expression list \a expr_list.
+ *
+ * \retval 1 if \a value matches
+ * \retval 0 otherwise
+ */
+static int
+cfs_expr_list_match(__u32 value, struct cfs_expr_list *expr_list)
+{
+       struct cfs_range_expr   *expr;
+
+       list_for_each_entry(expr, &expr_list->el_exprs, re_link) {
+               if (value >= expr->re_lo && value <= expr->re_hi &&
+                   ((value - expr->re_lo) % expr->re_stride) == 0)
+                       return 1;
+       }
+
+       return 0;
+}
+
+/**
  * Matches address (\a addr) against address set encoded in \a list.
  *
  * \retval 1 if \a addr matches
index 205f3c3..b3e3209 100644 (file)
@@ -271,26 +271,6 @@ cfs_expr_list_print(char *buffer, int count, struct cfs_expr_list *expr_list)
 }
 
 /**
- * Matches value (\a value) against ranges expression list \a expr_list.
- *
- * \retval 1 if \a value matches
- * \retval 0 otherwise
- */
-int
-cfs_expr_list_match(__u32 value, struct cfs_expr_list *expr_list)
-{
-       struct cfs_range_expr   *expr;
-
-       list_for_each_entry(expr, &expr_list->el_exprs, re_link) {
-               if (value >= expr->re_lo && value <= expr->re_hi &&
-                   ((value - expr->re_lo) % expr->re_stride) == 0)
-                       return 1;
-       }
-
-       return 0;
-}
-
-/**
  * Convert express list (\a expr_list) to an array of all matched values
  *
  * \retval N N is total number of all matched values
index 8c4d7d0..85273a2 100644 (file)
@@ -103,7 +103,7 @@ dlc_glue:
        echo "building liblnetconfig_wrap.c"
        $(CC) $(SWIG_COMPFLAGS) $(PYTHON_CPPFLAGS) $(DLC_INCLUDES) $(LIBLNETCONFIG_WRAP_I) $(CYAML_SRC)
        echo "linking _lnetconfig.so"
-       $(CC) $(LIBLNETCONFIG) -lyaml -llnetconfig -Wl,--whole-archive $(LIBCFS) $(CYAML_OBJ) -Wl,--no-whole-archive -shared -o _lnetconfig.so $(LIBLNETCONFIG_WRAP_OBJ) $(PYTHON_EXTRA_LIBS) $(PYTHON_LIBS)
+       $(CC) -shared -o _lnetconfig.so $(LIBCFS) -lyaml $(LIBLNETCONFIG) -llnetconfig $(CYAML_OBJ) $(LIBLNETCONFIG_WRAP_OBJ) $(PYTHON_EXTRA_LIBS) $(PYTHON_LIBS)
 
 install-exec-local:
        $(mkinstalldirs) $(DESTDIR)$(libdir)