Skip to contentSkip to conversation

nfsd: don't assume service is running when setting thread count to 0

PATCH In review Scott Mayhew 2 participants 2 messages Jun 8 – Jun 16

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

PATCH 1/1 nfsd: don't assume service is running when setting thread count to 0

Newer kernels return -EIO if you try to write to /proc/fs/nfsd/threads and there are no active listeners.

---
 utils/nfsd/nfsd.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
utils/nfsd/nfsd.c +10 -6
index 365e145d..c95d32f4 100644
@@ -311,12 +311,16 @@ main(int argc, char **argv)
 				argv[0], count);
 			count = 1;
 		} else if (count == 0) {
-			/*
-			 * don't bother setting anything else if the threads
-			 * are coming down anyway.
-			 */
-			socket_up = 1;
-			goto set_threads;
+			if (nfssvc_inuse()) {
+				/*
+				 * don't bother setting anything else if the threads
+				 * are coming down anyway.
+				 */
+				socket_up = 1;
+				goto set_threads;
+			} else {
+				goto out;
+			}
 		}
 	}
 
Signature · 1 line
2.54.0
#1 lore raw
Quoted 4 lines · Scott Mayhew

Newer kernels return -EIO if you try to write to /proc/fs/nfsd/threads and there are no active listeners.

Committed...

steved.

Quoted 31 lines
---
  utils/nfsd/nfsd.c | 16 ++++++++++------
  1 file changed, 10 insertions(+), 6 deletions(-)
utils/nfsd/nfsd.c +10 -6
index 365e145d..c95d32f4 100644
@@ -311,12 +311,16 @@ main(int argc, char **argv)
  				argv[0], count);
  			count = 1;
  		} else if (count == 0) {
-			/*
-			 * don't bother setting anything else if the threads
-			 * are coming down anyway.
-			 */
-			socket_up = 1;
-			goto set_threads;
+			if (nfssvc_inuse()) {
+				/*
+				 * don't bother setting anything else if the threads
+				 * are coming down anyway.
+				 */
+				socket_up = 1;
+				goto set_threads;
+			} else {
+				goto out;
+			}
  		}
  	}