Whamcloud - gitweb
LU-9859 libcfs: initialize bit_wait_table 74/38574/4
authorJames Simmons <jsimmons@infradead.org>
Fri, 19 Jul 2019 12:38:44 +0000 (08:38 -0400)
committerOleg Drokin <green@whamcloud.com>
Thu, 21 May 2020 06:08:06 +0000 (06:08 +0000)
With older platforms wait_event_var() is missing so we needed to
provide are own version. This included creating a local
bit_wait_table like the kernel has. That table was never properly
initialized so it can cause failures under the right conditions.

Test-Parameters: trivial

Lustre-commit: https://review.whamcloud.com/35567
Lustre-change: 916643c4b8d136c9c96afa5cd21d1eb6030d148c

Fixes: 372ef85512 ("LU-11089 obd: use wait_event_var() in lu_context_key_degister()")
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Change-Id: I310d37da7c1b54166224b367446cc905c02ab8bc
Reviewed-on: https://review.whamcloud.com/38574
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
libcfs/include/libcfs/linux/linux-wait.h
libcfs/libcfs/linux/linux-wait.c
libcfs/libcfs/module.c

index b0142c7..a497dce 100644 (file)
@@ -51,6 +51,7 @@ static inline void clear_and_wake_up_bit(int bit, void *word)
 #endif /* ! HAVE_CLEAR_AND_WAKE_UP_BIT */
 
 #ifndef HAVE_WAIT_VAR_EVENT
+extern void __init wait_bit_init(void);
 extern void init_wait_var_entry(struct wait_bit_queue_entry *wbq_entry,
                                void *var, int flags);
 extern void wake_up_var(void *var);
index dd08cac..5843d80 100644 (file)
@@ -104,4 +104,12 @@ void wake_up_var(void *var)
        __wake_up_bit(__var_waitqueue(var), var, -1);
 }
 EXPORT_SYMBOL(wake_up_var);
+
+void __init wait_bit_init(void)
+{
+       int i;
+
+       for (i = 0; i < WAIT_TABLE_SIZE; i++)
+               init_waitqueue_head(bit_wait_table + i);
+}
 #endif /* ! HAVE_WAIT_VAR_EVENT */
index ebbf85e..b0e9c94 100644 (file)
@@ -617,6 +617,9 @@ static int __init libcfs_init(void)
 {
        int rc;
 
+#ifndef HAVE_WAIT_VAR_EVENT
+       wait_bit_init();
+#endif
        rc = libcfs_debug_init(5 * 1024 * 1024);
        if (rc < 0) {
                printk(KERN_ERR "LustreError: libcfs_debug_init: %d\n", rc);