Whamcloud - gitweb
LU-15807 ksocklnd: fix irq lock inversion while calling sk_data_ready() 15/48715/5
authorJames Simmons <jsimmons@infradead.org>
Sun, 2 Oct 2022 13:45:42 +0000 (09:45 -0400)
committerOleg Drokin <green@whamcloud.com>
Tue, 25 Oct 2022 17:27:27 +0000 (17:27 +0000)
sk->sk_data_ready() of sctp socket can be called from both BH and non-BH
contexts, but ksocklnd version of sk_data_ready, ksocknal_data_ready()
does not handle the BH case. Change how ksnd_global_lock is taken in
this case.

Test-Parameters: trivial testlist=sanity-lnet
Test-Parameters: testgroup=review-ldiskfs-arm testlist=sanity-lnet
Change-Id: I07fade0da4cdfe095edc7a17e4f65012d6f92942
Signed-off-by: James Simmons <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/48715
Reviewed-by: Chris Horn <chris.horn@hpe.com>
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Reviewed-by: Frank Sehr <fsehr@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
lnet/klnds/socklnd/socklnd_lib.c

index 46cb3c6..605777a 100644 (file)
@@ -577,7 +577,7 @@ ksocknal_data_ready(struct sock *sk, int n)
 
         /* interleave correctly with closing sockets... */
         LASSERT(!in_irq());
-       read_lock(&ksocknal_data.ksnd_global_lock);
+       read_lock_bh(&ksocknal_data.ksnd_global_lock);
 
        conn = sk->sk_user_data;
        if (conn == NULL) {     /* raced with ksocknal_terminate_conn */
@@ -590,7 +590,7 @@ ksocknal_data_ready(struct sock *sk, int n)
        } else
                ksocknal_read_callback(conn);
 
-       read_unlock(&ksocknal_data.ksnd_global_lock);
+       read_unlock_bh(&ksocknal_data.ksnd_global_lock);
 }
 
 static void