Skip to contentSkip to conversation

nfs-utils: nfsdctl: dont ignore rdma listener return

PATCH In review Olga Kornievskaia 5 participants 9 messages Feb 13, 2025 – Mar 19, 2025

Subsystems (2)
lore
Share & tools
lore

Olga Kornievskaia

author reviewer
#0 lore raw

PATCH 1/1 nfs-utils: nfsdctl: dont ignore rdma listener return

Don't ignore return code of adding rdma listener. If nfs.conf has asked for "rdma=y" but adding the listener fails, don't ignore the failure. Note in soft-rdma-provider environment (such as soft iwarp, soft roce), when no address-constraints are used, an "any" listener is created and rdma-enabling is done independently.

Fixes e3b72007ab31 ("nfs-utils: nfsdctl: cleanup listeners if some failed")
---
 utils/nfsdctl/nfsdctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
utils/nfsdctl/nfsdctl.c +2 -2
index 05fecc71..244910ef 100644
@@ -1388,7 +1388,7 @@ static int configure_listeners(void)
 			if (tcp)
 				ret = add_listener("tcp", n->field, port);
 			if (rdma)
-				add_listener("rdma", n->field, rdma_port);
+				ret = add_listener("rdma", n->field, rdma_port);
 			if (ret)
 				return ret;
 		}
@@ -1398,7 +1398,7 @@ static int configure_listeners(void)
 		if (tcp)
 			ret = add_listener("tcp", "", port);
 		if (rdma)
-			add_listener("rdma", "", rdma_port);
+			ret = add_listener("rdma", "", rdma_port);
 	}
 	return ret;
 }
Signature · 1 line
2.47.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Olga Kornievskaia

Don't ignore return code of adding rdma listener. If nfs.conf has asked for "rdma=y" but adding the listener fails, don't ignore the failure. Note in soft-rdma-provider environment (such as soft iwarp, soft roce), when no address-constraints are used, an "any" listener is created and rdma-enabling is done independently.

This behavior is confusing... I suggest that an nfs.conf man page update accompany the below code change.

Quoted 28 lines
Fixes e3b72007ab31 ("nfs-utils: nfsdctl: cleanup listeners if some failed")
---
 utils/nfsdctl/nfsdctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
utils/nfsdctl/nfsdctl.c +2 -2
index 05fecc71..244910ef 100644
@@ -1388,7 +1388,7 @@ static int configure_listeners(void)
 			if (tcp)
 				ret = add_listener("tcp", n->field, port);
 			if (rdma)
-				add_listener("rdma", n->field, rdma_port);
+				ret = add_listener("rdma", n->field, rdma_port);
 			if (ret)
 				return ret;
 		}
@@ -1398,7 +1398,7 @@ static int configure_listeners(void)
 		if (tcp)
 			ret = add_listener("tcp", "", port);
 		if (rdma)
-			add_listener("rdma", "", rdma_port);
+			ret = add_listener("rdma", "", rdma_port);
 	}
 	return ret;
 }
Signature · 1 line
Chuck Lever
author reviewer
#2 lore raw
Quoted 10 lines · Chuck Lever
Quoted 5 lines · Olga Kornievskaia

Don't ignore return code of adding rdma listener. If nfs.conf has asked for "rdma=y" but adding the listener fails, don't ignore the failure. Note in soft-rdma-provider environment (such as soft iwarp, soft roce), when no address-constraints are used, an "any" listener is created and rdma-enabling is done independently.

This behavior is confusing... I suggest that an nfs.conf man page update accompany the below code change.

Do you find only the rdma=y soft-rdma case confusing, or do you find that when listeners fail and we shouldn't start knfsd threads in general confusing?

It was always the case that if rdma=y is done, then any listener created for it does not check whether or not the underlying interface is already rdma-enabled. This hasn't changed. Nor does this patch change it.

Quoted 36 lines
Quoted 20 lines
Fixes e3b72007ab31 ("nfs-utils: nfsdctl: cleanup listeners if some failed")
---
 utils/nfsdctl/nfsdctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
utils/nfsdctl/nfsdctl.c +1 -1
index 05fecc71..244910ef 100644
@@ -1388,7 +1388,7 @@ static int configure_listeners(void)
                      if (tcp)
                              ret = add_listener("tcp", n->field, port);
                      if (rdma)
-                             add_listener("rdma", n->field, rdma_port);
+                             ret = add_listener("rdma", n->field, rdma_port);
                      if (ret)
                              return ret;
              }

utils/nfsdctl/nfsdctl.c static int configure_listeners(void) · line 1404

Quoted 8 lines
utils/nfsdctl/nfsdctl.c +1 -1
@@ -1398,7 +1398,7 @@ static int configure_listeners(void)
              if (tcp)
                      ret = add_listener("tcp", "", port);
              if (rdma)
-                     add_listener("rdma", "", rdma_port);
+                     ret = add_listener("rdma", "", rdma_port);
      }
      return ret;
 }

--
Chuck Lever

#3 lore raw
Quoted 12 lines · Olga Kornievskaia
Quoted 10 lines · Chuck Lever
Quoted 5 lines · Olga Kornievskaia

Don't ignore return code of adding rdma listener. If nfs.conf has asked for "rdma=y" but adding the listener fails, don't ignore the failure. Note in soft-rdma-provider environment (such as soft iwarp, soft roce), when no address-constraints are used, an "any" listener is created and rdma-enabling is done independently.

This behavior is confusing... I suggest that an nfs.conf man page update accompany the below code change.

Quoted 8 lines

Do you find only the rdma=y soft-rdma case confusing, or do you find that when listeners fail and we shouldn't start knfsd threads in general confusing?

It was always the case that if rdma=y is done, then any listener created for it does not check whether or not the underlying interface is already rdma-enabled. This hasn't changed. Nor does this patch change it.

Not saying the patch changes the behavior. But you have to admit the behavior is surprising and needs clear documentation.

Quoted 37 lines
Quoted 36 lines
Quoted 20 lines
Fixes e3b72007ab31 ("nfs-utils: nfsdctl: cleanup listeners if some failed")
---
 utils/nfsdctl/nfsdctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
utils/nfsdctl/nfsdctl.c +1 -1
index 05fecc71..244910ef 100644
@@ -1388,7 +1388,7 @@ static int configure_listeners(void)
                      if (tcp)
                              ret = add_listener("tcp", n->field, port);
                      if (rdma)
-                             add_listener("rdma", n->field, rdma_port);
+                             ret = add_listener("rdma", n->field, rdma_port);
                      if (ret)
                              return ret;
              }

utils/nfsdctl/nfsdctl.c static int configure_listeners(void) · line 1404

Quoted 8 lines
utils/nfsdctl/nfsdctl.c +1 -1
@@ -1398,7 +1398,7 @@ static int configure_listeners(void)
              if (tcp)
                      ret = add_listener("tcp", "", port);
              if (rdma)
-                     add_listener("rdma", "", rdma_port);
+                     ret = add_listener("rdma", "", rdma_port);
      }
      return ret;
 }

--
Chuck Lever

Signature · 1 line
Chuck Lever
#4 lore raw
Quoted 18 lines · Chuck Lever
Quoted 16 lines · Olga Kornievskaia
Quoted 10 lines · Chuck Lever
Quoted 5 lines · Olga Kornievskaia

Don't ignore return code of adding rdma listener. If nfs.conf has asked for "rdma=y" but adding the listener fails, don't ignore the failure. Note in soft-rdma-provider environment (such as soft iwarp, soft roce), when no address-constraints are used, an "any" listener is created and rdma-enabling is done independently.

This behavior is confusing... I suggest that an nfs.conf man page update accompany the below code change.

Do you find only the rdma=y soft-rdma case confusing, or do you find that when listeners fail and we shouldn't start knfsd threads in general confusing?

Quoted 7 lines
Quoted 4 lines

It was always the case that if rdma=y is done, then any listener created for it does not check whether or not the underlying interface is already rdma-enabled. This hasn't changed. Nor does this patch change it.

Not saying the patch changes the behavior. But you have to admit the behavior is surprising and needs clear documentation.

Sure we can document the behavior of the any listener on a soft rdma interface as it's used by the knfsd. But is it guaranteed not to change, as the behaviour is controlled by the RDMA core not NFS?

Quoted 42 lines
Quoted 28 lines
Quoted 28 lines
Quoted 25 lines
Fixes e3b72007ab31 ("nfs-utils: nfsdctl: cleanup listeners if some failed")
---
 utils/nfsdctl/nfsdctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
utils/nfsdctl/nfsdctl.c +2 -2
index 05fecc71..244910ef 100644
@@ -1388,7 +1388,7 @@ static int configure_listeners(void)
                      if (tcp)
                              ret = add_listener("tcp", n->field, port);
                      if (rdma)
-                             add_listener("rdma", n->field, rdma_port);
+                             ret = add_listener("rdma", n->field, rdma_port);
                      if (ret)
                              return ret;
              }
@@ -1398,7 +1398,7 @@ static int configure_listeners(void)
              if (tcp)
                      ret = add_listener("tcp", "", port);
              if (rdma)
-                     add_listener("rdma", "", rdma_port);
+                     ret = add_listener("rdma", "", rdma_port);
Quoted 9 lines
Quoted 8 lines

utils/nfsdctl/nfsdctl.c static int configure_listeners(void) · line 1404

Quoted 3 lines
utils/nfsdctl/nfsdctl.c +0 -0
      }
      return ret;
 }

--
Chuck Lever

--
Chuck Lever

#5 lore raw
Quoted 24 lines · Olga Kornievskaia
Quoted 23 lines · Chuck Lever
Quoted 20 lines · Olga Kornievskaia
Quoted 10 lines · Chuck Lever
Quoted 5 lines · Olga Kornievskaia

Don't ignore return code of adding rdma listener. If nfs.conf has asked for "rdma=y" but adding the listener fails, don't ignore the failure. Note in soft-rdma-provider environment (such as soft iwarp, soft roce), when no address-constraints are used, an "any" listener is created and rdma-enabling is done independently.

This behavior is confusing... I suggest that an nfs.conf man page update accompany the below code change.

Do you find only the rdma=y soft-rdma case confusing, or do you find that when listeners fail and we shouldn't start knfsd threads in general confusing?

It was always the case that if rdma=y is done, then any listener created for it does not check whether or not the underlying interface is already rdma-enabled. This hasn't changed. Nor does this patch change it.

Quoted 6 lines
Quoted 2 lines

Not saying the patch changes the behavior. But you have to admit the behavior is surprising and needs clear documentation.

Sure we can document the behavior of the any listener on a soft rdma interface as it's used by the knfsd. But is it guaranteed not to change, as the behaviour is controlled by the RDMA core not NFS?

I'm talking about documenting the opposite. Something like:

When "host=" is present, the network interface named by this configuration setting must be present (and when "rdma=y", that device must be RDMA-enabled) in order for server start-up to succeed.

Quoted 42 lines
Quoted 42 lines
Quoted 28 lines
Quoted 28 lines
Quoted 25 lines
Fixes e3b72007ab31 ("nfs-utils: nfsdctl: cleanup listeners if some failed")
---
 utils/nfsdctl/nfsdctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
utils/nfsdctl/nfsdctl.c +2 -2
index 05fecc71..244910ef 100644
@@ -1388,7 +1388,7 @@ static int configure_listeners(void)
                      if (tcp)
                              ret = add_listener("tcp", n->field, port);
                      if (rdma)
-                             add_listener("rdma", n->field, rdma_port);
+                             ret = add_listener("rdma", n->field, rdma_port);
                      if (ret)
                              return ret;
              }
@@ -1398,7 +1398,7 @@ static int configure_listeners(void)
              if (tcp)
                      ret = add_listener("tcp", "", port);
              if (rdma)
-                     add_listener("rdma", "", rdma_port);
+                     ret = add_listener("rdma", "", rdma_port);
Quoted 9 lines
Quoted 8 lines

utils/nfsdctl/nfsdctl.c static int configure_listeners(void) · line 1404

Quoted 3 lines
utils/nfsdctl/nfsdctl.c +0 -0
      }
      return ret;
 }

--
Chuck Lever

--
Chuck Lever

Signature · 1 line
Chuck Lever
#6 lore raw
Quoted 33 lines · Chuck Lever
Quoted 24 lines · Olga Kornievskaia
Quoted 23 lines · Chuck Lever
Quoted 20 lines · Olga Kornievskaia
Quoted 10 lines · Chuck Lever
Quoted 5 lines · Olga Kornievskaia

Don't ignore return code of adding rdma listener. If nfs.conf has asked for "rdma=y" but adding the listener fails, don't ignore the failure. Note in soft-rdma-provider environment (such as soft iwarp, soft roce), when no address-constraints are used, an "any" listener is created and rdma-enabling is done independently.

This behavior is confusing... I suggest that an nfs.conf man page update accompany the below code change.

Do you find only the rdma=y soft-rdma case confusing, or do you find that when listeners fail and we shouldn't start knfsd threads in general confusing?

It was always the case that if rdma=y is done, then any listener created for it does not check whether or not the underlying interface is already rdma-enabled. This hasn't changed. Nor does this patch change it.

Quoted 6 lines
Quoted 2 lines

Not saying the patch changes the behavior. But you have to admit the behavior is surprising and needs clear documentation.

Sure we can document the behavior of the any listener on a soft rdma interface as it's used by the knfsd. But is it guaranteed not to change, as the behaviour is controlled by the RDMA core not NFS?

Quoted 6 lines

I'm talking about documenting the opposite. Something like:

When "host=" is present, the network interface named by this configuration setting must be present (and when "rdma=y", that device must be RDMA-enabled) in order for server start-up to succeed.

Ah that case. Yes, I agree.

Quoted 46 lines
Quoted 39 lines
Quoted 39 lines
Quoted 37 lines
Quoted 36 lines
Quoted 20 lines
Fixes e3b72007ab31 ("nfs-utils: nfsdctl: cleanup listeners if some failed")
---
 utils/nfsdctl/nfsdctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
utils/nfsdctl/nfsdctl.c +1 -1
index 05fecc71..244910ef 100644
@@ -1388,7 +1388,7 @@ static int configure_listeners(void)
                      if (tcp)
                              ret = add_listener("tcp", n->field, port);
                      if (rdma)
-                             add_listener("rdma", n->field, rdma_port);
+                             ret = add_listener("rdma", n->field, rdma_port);
                      if (ret)
                              return ret;
              }

utils/nfsdctl/nfsdctl.c static int configure_listeners(void) · line 1404

Quoted 8 lines
utils/nfsdctl/nfsdctl.c +1 -1
@@ -1398,7 +1398,7 @@ static int configure_listeners(void)
              if (tcp)
                      ret = add_listener("tcp", "", port);
              if (rdma)
-                     add_listener("rdma", "", rdma_port);
+                     ret = add_listener("rdma", "", rdma_port);
      }
      return ret;
 }

--
Chuck Lever

Quoted 3 lines
Quoted 3 lines

--
Chuck Lever

--
Chuck Lever

maintainer Reviewed-by on v1 1/1
#7 lore raw
In reply to Olga Kornievskaia
Quoted 26 lines · Olga Kornievskaia

Don't ignore return code of adding rdma listener. If nfs.conf has asked for "rdma=y" but adding the listener fails, don't ignore the failure. Note in soft-rdma-provider environment (such as soft iwarp, soft roce), when no address-constraints are used, an "any" listener is created and rdma-enabling is done independently.

Fixes e3b72007ab31 ("nfs-utils: nfsdctl: cleanup listeners if some failed")
---
 utils/nfsdctl/nfsdctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
utils/nfsdctl/nfsdctl.c +1 -1
index 05fecc71..244910ef 100644
@@ -1388,7 +1388,7 @@ static int configure_listeners(void)
 			if (tcp)
 				ret = add_listener("tcp", n->field, port);
 			if (rdma)
-				add_listener("rdma", n->field, rdma_port);
+				ret = add_listener("rdma", n->field, rdma_port);
 			if (ret)
 				return ret;
 		}

utils/nfsdctl/nfsdctl.c static int configure_listeners(void) · line 1404

Quoted 8 lines
utils/nfsdctl/nfsdctl.c +1 -1
@@ -1398,7 +1398,7 @@ static int configure_listeners(void)
 		if (tcp)
 			ret = add_listener("tcp", "", port);
 		if (rdma)
-			add_listener("rdma", "", rdma_port);
+			ret = add_listener("rdma", "", rdma_port);
 	}
 	return ret;
 }

add_listener() is just adding the given listener to the nfsd_sockets array in memory. It's not consulting the kernel at that point. That won't happen until set_listeners() is called.

It does make sense to check the return code though, just in case we pass it some bogus arguments somehow. So...

#8 lore raw
In reply to Olga Kornievskaia
Quoted 8 lines · Olga Kornievskaia

Don't ignore return code of adding rdma listener. If nfs.conf has asked for "rdma=y" but adding the listener fails, don't ignore the failure. Note in soft-rdma-provider environment (such as soft iwarp, soft roce), when no address-constraints are used, an "any" listener is created and rdma-enabling is done independently.

Fixes e3b72007ab31 ("nfs-utils: nfsdctl: cleanup listeners if some failed")

Committed... (tag: nfs-utils-2-8-3-rc7)

steved.

Quoted 26 lines
---
  utils/nfsdctl/nfsdctl.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
utils/nfsdctl/nfsdctl.c +2 -2
index 05fecc71..244910ef 100644
@@ -1388,7 +1388,7 @@ static int configure_listeners(void)
  			if (tcp)
  				ret = add_listener("tcp", n->field, port);
  			if (rdma)
-				add_listener("rdma", n->field, rdma_port);
+				ret = add_listener("rdma", n->field, rdma_port);
  			if (ret)
  				return ret;
  		}
@@ -1398,7 +1398,7 @@ static int configure_listeners(void)
  		if (tcp)
  			ret = add_listener("tcp", "", port);
  		if (rdma)
-			add_listener("rdma", "", rdma_port);
+			ret = add_listener("rdma", "", rdma_port);
  	}
  	return ret;
  }