DLM: Replace nodeid_to_addr with kernel_getpeername
authorBob Peterson <rpeterso@redhat.com>
Mon, 18 Jan 2016 17:29:15 +0000 (12:29 -0500)
committerDavid Teigland <teigland@redhat.com>
Mon, 22 Feb 2016 20:02:11 +0000 (14:02 -0600)
This patch replaces the call to nodeid_to_addr with a call to
kernel_getpeername. This avoids taking a spinlock because it may
potentially be called from a softirq context.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
fs/dlm/lowcomms.c

index 3a37bd3f9637811c3b86e5c05be5aa47f32819c3..dc9ae6d670dc792b2ad31b848b008a6a79f46a0f 100644 (file)
@@ -469,8 +469,10 @@ static void lowcomms_error_report(struct sock *sk)
 {
        struct connection *con = sock2con(sk);
        struct sockaddr_storage saddr;
+       int buflen;
 
-       if (nodeid_to_addr(con->nodeid, &saddr, NULL, false)) {
+       if (con->sock == NULL ||
+           kernel_getpeername(con->sock, (struct sockaddr *)&saddr, &buflen)) {
                printk_ratelimited(KERN_ERR "dlm: node %d: socket error "
                                   "sending to node %d, port %d, "
                                   "sk_err=%d/%d\n", dlm_our_nodeid(),