Skip to contentSkip to conversation

NLM: Set address family before calling nlm_host_rebooted()

PATCH In review Chuck Lever 2 participants 6 messages Oct 23, 2008 – Oct 31, 2008 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NLM: Set address family before calling nlm_host_rebooted()

The nlm_host_rebooted() function uses nlm_cmp_addr() to find an nsm_handle that matches the rebooted peer. In order for this to work, the passed-in address must have a proper address family.

---

Bruce - since we dropped the remaining NSM IPv6 patches for 2.6.28, I think we need to add this one to make sure lock recovery continues to work.

Please consider this one for 2.6.28.

 fs/lockd/svc4proc.c |    1 +
 fs/lockd/svcproc.c  |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)
fs/lockd/svc4proc.c +1 -0
index 014f6ce..4dfdcbc 100644
@@ -434,6 +434,7 @@ nlm4svc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp,
 	 * reclaim all locks we hold on this server.
 	 */
 	memset(&saddr, 0, sizeof(saddr));
+	saddr.sin_family = AF_INET;
 	saddr.sin_addr.s_addr = argp->addr;
 	nlm_host_rebooted(&saddr, argp->mon, argp->len, argp->state);
 
fs/lockd/svcproc.c +1 -0
index 548b0bb..3ca89e2 100644
@@ -466,6 +466,7 @@ nlmsvc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp,
 	 * reclaim all locks we hold on this server.
 	 */
 	memset(&saddr, 0, sizeof(saddr));
+	saddr.sin_family = AF_INET;
 	saddr.sin_addr.s_addr = argp->addr;
 	nlm_host_rebooted(&saddr, argp->mon, argp->len, argp->state);
 

A message that is not in the archive (sent off-list or not yet received): 20081023044245.15258.55293.stgit-07a7zB5ZJzbwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org

#2 lore raw
Quoted 7 lines · Chuck Lever

The nlm_host_rebooted() function uses nlm_cmp_addr() to find an nsm_handle that matches the rebooted peer. In order for this to work, the passed-in address must have a proper address family.

---

Thanks!

Quoted 3 lines

Bruce - since we dropped the remaining NSM IPv6 patches for 2.6.28, I think we need to add this one to make sure lock recovery continues to work.

So this is a regression? (If so, when was it introduced?)

Have you tested lock recovery? I'll see if I can get some sort of lock recovery test running as part of my default regression tests this weekend.... It seems to be something that hasn't been watched closely enough.

--b.

Quoted 36 lines

Please consider this one for 2.6.28.

 fs/lockd/svc4proc.c |    1 +
 fs/lockd/svcproc.c  |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)
fs/lockd/svc4proc.c +1 -0
index 014f6ce..4dfdcbc 100644
@@ -434,6 +434,7 @@ nlm4svc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp,
 	 * reclaim all locks we hold on this server.
 	 */
 	memset(&saddr, 0, sizeof(saddr));
+	saddr.sin_family = AF_INET;
 	saddr.sin_addr.s_addr = argp->addr;
 	nlm_host_rebooted(&saddr, argp->mon, argp->len, argp->state);
 
fs/lockd/svcproc.c +1 -1
index 548b0bb..3ca89e2 100644
@@ -466,6 +466,7 @@ nlmsvc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp,
 	 * reclaim all locks we hold on this server.
 	 */
 	memset(&saddr, 0, sizeof(saddr));
+	saddr.sin_family = AF_INET;
 	saddr.sin_addr.s_addr = argp->addr;
 	nlm_host_rebooted(&saddr, argp->mon, argp->len, argp->state);
 
 
--

To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 9 lines · J. Bruce Fields
Quoted 7 lines · Chuck Lever

The nlm_host_rebooted() function uses nlm_cmp_addr() to find an nsm_handle that matches the rebooted peer. In order for this to work, the passed-in address must have a proper address family.

---

Quoted 7 lines

Thanks!

Quoted 3 lines

Bruce - since we dropped the remaining NSM IPv6 patches for 2.6.28, I think we need to add this one to make sure lock recovery continues to work.

So this is a regression? (If so, when was it introduced?)

I think this was introduced when AF_INET6 support was added to nlm_cmp_addr() in commit 781b61a6. Before that commit, nlm_cmp_addr() didn't care about the address family; it compared only the sin_addr.s_addr field for equality.

This is a regression in the sense that it probably broke lock recovery in .28, but I don't think this is a problem in any released kernel.

Quoted 4 lines

Have you tested lock recovery? I'll see if I can get some sort of lock recovery test running as part of my default regression tests this weekend.... It seems to be something that hasn't been watched closely enough.

Sankar has a lock recovery test. He didn't report a problem with lock recovery with the full set of patches I had for 2.6.28. He never tested what is actually in .28 now, which is missing those NSM patches.

I'm preparing my latest patches for him to try out soon.

Quoted 41 lines

--b.

Quoted 38 lines

Please consider this one for 2.6.28.

fs/lockd/svc4proc.c |    1 +
fs/lockd/svcproc.c  |    1 +
2 files changed, 2 insertions(+), 0 deletions(-)
fs/lockd/svc4proc.c +1 -0
index 014f6ce..4dfdcbc 100644
@@ -434,6 +434,7 @@ nlm4svc_proc_sm_notify(struct svc_rqst *rqstp,  
 struct nlm_reboot *argp,
 	 * reclaim all locks we hold on this server.
 	 */
 	memset(&saddr, 0, sizeof(saddr));
+	saddr.sin_family = AF_INET;
 	saddr.sin_addr.s_addr = argp->addr;
 	nlm_host_rebooted(&saddr, argp->mon, argp->len, argp->state);
fs/lockd/svcproc.c +1 -1
index 548b0bb..3ca89e2 100644
@@ -466,6 +466,7 @@ nlmsvc_proc_sm_notify(struct svc_rqst *rqstp,  
 struct nlm_reboot *argp,
 	 * reclaim all locks we hold on this server.
 	 */
 	memset(&saddr, 0, sizeof(saddr));
+	saddr.sin_family = AF_INET;
 	saddr.sin_addr.s_addr = argp->addr;
 	nlm_host_rebooted(&saddr, argp->mon, argp->len, argp->state);
 
 
--

To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
Chuck Lever
chuck[dot]lever[at]oracle[dot]com

A message that is not in the archive (sent off-list or not yet received): BF3BC6B3-D58F-43B1-AACD-284DDFA291DC-MouhYhfBpPxXrIkS9f7CXA@public.gmane.org

#5 lore raw
Quoted 19 lines · Chuck Lever
Quoted 10 lines · J. Bruce Fields
Quoted 8 lines · Chuck Lever

The nlm_host_rebooted() function uses nlm_cmp_addr() to find an nsm_handle that matches the rebooted peer. In order for this to work,
the passed-in address must have a proper address family.

---

Quoted 7 lines

Thanks!

Quoted 3 lines

Bruce - since we dropped the remaining NSM IPv6 patches for 2.6.28, I think we need to add this one to make sure lock recovery continues to work.

So this is a regression? (If so, when was it introduced?)

Quoted 7 lines

I think this was introduced when AF_INET6 support was added to nlm_cmp_addr() in commit 781b61a6. Before that commit, nlm_cmp_addr() didn't care about the address family; it compared only the sin_addr.s_addr field for equality.

This is a regression in the sense that it probably broke lock recovery in .28, but I don't think this is a problem in any released kernel.

OK, thanks, I've queed this up for 2.6.28, as below.

Quoted 7 lines
Quoted 6 lines

Have you tested lock recovery? I'll see if I can get some sort of lock
recovery test running as part of my default regression tests this weekend.... It seems to be something that hasn't been watched closely enough.

Quoted 5 lines

Sankar has a lock recovery test. He didn't report a problem with lock recovery with the full set of patches I had for 2.6.28. He never tested what is actually in .28 now, which is missing those NSM patches.

I'm preparing my latest patches for him to try out soon.

(Though confirmation that it's been tested would certainly be reassuring--all it takes is grabbing a lock, rebooting a server, verifying that the lock is reclaimed, and also doing the same with a client and making sure locks are dropped.)

--b.

commit d7dc61d0a70371b1c6557ea8ffbc60fff94c8168

Author: Chuck Lever <[email protected]>
Date:   Thu Oct 23 00:50:35 2008 -0400

NLM: Set address family before calling nlm_host_rebooted()

The nlm_host_rebooted() function uses nlm_cmp_addr() to find an nsm_handle that matches the rebooted peer. In order for this to work, the passed-in address must have a proper address family.

This fixes a post-2.6.28 regression introduced by commit 781b61a6, which added AF_INET6 support to nlm_cmp_addr(). Before that commit, nlm_cmp_addr() didn't care about the address family; it compared only the sin_addr.s_addr field for equality.

fs/lockd/svc4proc.c +1 -0
index 014f6ce..4dfdcbc 100644
@@ -434,6 +434,7 @@ nlm4svc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp,
 	 * reclaim all locks we hold on this server.
 	 */
 	memset(&saddr, 0, sizeof(saddr));
+	saddr.sin_family = AF_INET;
 	saddr.sin_addr.s_addr = argp->addr;
 	nlm_host_rebooted(&saddr, argp->mon, argp->len, argp->state);
 
fs/lockd/svcproc.c +1 -0
index 548b0bb..3ca89e2 100644
@@ -466,6 +466,7 @@ nlmsvc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp,
 	 * reclaim all locks we hold on this server.
 	 */
 	memset(&saddr, 0, sizeof(saddr));
+	saddr.sin_family = AF_INET;
 	saddr.sin_addr.s_addr = argp->addr;
 	nlm_host_rebooted(&saddr, argp->mon, argp->len, argp->state);
 
#6 lore raw
Quoted 41 lines · J. Bruce Fields
Quoted 19 lines · Chuck Lever
Quoted 10 lines · J. Bruce Fields
Quoted 8 lines · Chuck Lever

The nlm_host_rebooted() function uses nlm_cmp_addr() to find an nsm_handle that matches the rebooted peer. In order for this to work,
the passed-in address must have a proper address family.

---

Quoted 7 lines

Thanks!

Quoted 3 lines

Bruce - since we dropped the remaining NSM IPv6 patches for 2.6.28, I think we need to add this one to make sure lock recovery continues to work.

So this is a regression? (If so, when was it introduced?)

Quoted 7 lines

I think this was introduced when AF_INET6 support was added to nlm_cmp_addr() in commit 781b61a6. Before that commit, nlm_cmp_addr() didn't care about the address family; it compared only the sin_addr.s_addr field for equality.

This is a regression in the sense that it probably broke lock recovery in .28, but I don't think this is a problem in any released kernel.

OK, thanks, I've queed this up for 2.6.28, as below.

Quoted 11 lines
Quoted 6 lines

Have you tested lock recovery? I'll see if I can get some sort of lock
recovery test running as part of my default regression tests this weekend.... It seems to be something that hasn't been watched closely enough.

Sankar has a lock recovery test. He didn't report a problem with lock recovery with the full set of patches I had for 2.6.28. He never tested what is actually in .28 now, which is missing those NSM patches.

Quoted 6 lines
Quoted 1 line

I'm preparing my latest patches for him to try out soon.

(Though confirmation that it's been tested would certainly be reassuring--all it takes is grabbing a lock, rebooting a server, verifying that the lock is reclaimed, and also doing the same with a client and making sure locks are dropped.)

I tested a 2.6.28-rc2 kernel on the server side with and without the fix. I rebooted the client with "echo b > /proc/sysrq_trigger" for this test.

If the server doesn't have the fix, I see the "never saw host x.x.x.x" message on the server after the client reboots. If the fix is applied, I see the "nlm_host_rebooted (x.x.x.x)" message on the server after the client reboots.

So, confirmed that this is a bug in 2.6.28-rc2, and confirmed that the below patch addresses the problem. The NSM logic is the same on the client and the server, so I didn't test a server reboot.

Quoted 49 lines

--b.

commit d7dc61d0a70371b1c6557ea8ffbc60fff94c8168

Author: Chuck Lever <[email protected]>
Date:   Thu Oct 23 00:50:35 2008 -0400

NLM: Set address family before calling nlm_host_rebooted()

The nlm_host_rebooted() function uses nlm_cmp_addr() to find an nsm_handle that matches the rebooted peer. In order for this to
work,
the passed-in address must have a proper address family.

This fixes a post-2.6.28 regression introduced by commit
781b61a6, which
added AF_INET6 support to nlm_cmp_addr(). Before that commit, nlm_cmp_addr() didn't care about the address family; it compared
only
the sin_addr.s_addr field for equality.

fs/lockd/svc4proc.c +1 -0
index 014f6ce..4dfdcbc 100644
@@ -434,6 +434,7 @@ nlm4svc_proc_sm_notify(struct svc_rqst *rqstp,  
 struct nlm_reboot *argp,
 	 * reclaim all locks we hold on this server.
 	 */
 	memset(&saddr, 0, sizeof(saddr));
+	saddr.sin_family = AF_INET;
 	saddr.sin_addr.s_addr = argp->addr;
 	nlm_host_rebooted(&saddr, argp->mon, argp->len, argp->state);
fs/lockd/svcproc.c +1 -0
index 548b0bb..3ca89e2 100644
@@ -466,6 +466,7 @@ nlmsvc_proc_sm_notify(struct svc_rqst *rqstp,  
 struct nlm_reboot *argp,
 	 * reclaim all locks we hold on this server.
 	 */
 	memset(&saddr, 0, sizeof(saddr));
+	saddr.sin_family = AF_INET;
 	saddr.sin_addr.s_addr = argp->addr;
 	nlm_host_rebooted(&saddr, argp->mon, argp->len, argp->state);
Signature · 2 lines
Chuck Lever
chuck[dot]lever[at]oracle[dot]com

A message that is not in the archive (sent off-list or not yet received): A34BAC35-D8FB-4DD2-8A1F-6780FD0914C5-MouhYhfBpPxXrIkS9f7CXA@public.gmane.org

#8 lore raw
Quoted 4 lines · Chuck Lever

I tested a 2.6.28-rc2 kernel on the server side with and without the fix. I rebooted the client with "echo b > /proc/sysrq_trigger" for this test.

Quoted 8 lines

If the server doesn't have the fix, I see the "never saw host x.x.x.x" message on the server after the client reboots. If the fix is applied, I see the "nlm_host_rebooted (x.x.x.x)" message on the server after the client reboots.

So, confirmed that this is a bug in 2.6.28-rc2, and confirmed that the below patch addresses the problem. The NSM logic is the same on the client and the server, so I didn't test a server reboot.

Excellent, thanks very much!

(Though for the future as a regular regression test from a script, I think we'd want to test for a lock after reboot with a GETLK rather than looking for dprintk's in the logs.)

--b.