From: Bob Peterson Date: Mon, 18 Jan 2016 16:20:21 -0500 (EST) Subject: [Cluster-devel] [DLM PATCH] DLM: Replace nodeid_to_addr with kernel_getpeername In-Reply-To: <1517969718.11160571.1453147177633.JavaMail.zimbra@redhat.com> References: <936502812.11115094.1453142384871.JavaMail.zimbra@redhat.com> <1517969718.11160571.1453147177633.JavaMail.zimbra@redhat.com> Message-ID: <1501336857.11198597.1453152021910.JavaMail.zimbra@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit ----- Original Message ----- > ----- Original Message ----- > > Hi, > > > > 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. > > > > Regards, > > > > Bob Peterson > > Red Hat File Systems > > > > Signed-off-by: Bob Peterson > > --- > > diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c > > index 3a37bd3..a1a50f3 100644 > > --- a/fs/dlm/lowcomms.c > > +++ b/fs/dlm/lowcomms.c > > @@ -469,8 +469,9 @@ 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 (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(), > > > > > Hi, > > Self-NACK. A problem was found during testing. I'll post a replacement > shortly. > > Regards, > > Bob Peterson > Red Hat File Systems Hi, Here is the replacement patch I promised. Regards, Bob Peterson Red Hat File Systems --- DLM: Replace nodeid_to_addr with kernel_getpeername 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 diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index 3a37bd3..dc9ae6d 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c @@ -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(),