Skip to contentSkip to conversation

DLM: Replace nodeid_to_addr with kernel_getpeername

PATCH New Bob Peterson 1 participant 3 messages Jan 18, 2016 1 message not in the archive Distributed lock manager (DLM)

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 DLM: Replace nodeid_to_addr with kernel_getpeername

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

---

fs/dlm/lowcomms.c +2 -1
index 3a37bd3..a1a50f3 100644
@@ -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(),
#2 lore raw

PATCH 1/1 DLM: Replace nodeid_to_addr with kernel_getpeername

----- Original Message -----

Quoted 20 lines

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

---

fs/dlm/lowcomms.c +0 -0
index 3a37bd3..a1a50f3 100644

fs/dlm/lowcomms.c static void lowcomms_error_report(struct sock *sk) · line 477

Quoted 10 lines
fs/dlm/lowcomms.c +2 -1
@@ -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

#3 lore raw

PATCH 1/1 DLM: Replace nodeid_to_addr with kernel_getpeername

----- Original Message -----

Quoted 33 lines

----- Original Message -----

Quoted 20 lines

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

---

fs/dlm/lowcomms.c +0 -0
index 3a37bd3..a1a50f3 100644

fs/dlm/lowcomms.c static void lowcomms_error_report(struct sock *sk) · line 477

Quoted 10 lines
fs/dlm/lowcomms.c +2 -1
@@ -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,

Quoted 7 lines

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.

fs/dlm/lowcomms.c +3 -1
index 3a37bd3..dc9ae6d 100644
@@ -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(),