Skip to contentSkip to conversation

nfsd: check client tracker initialization result

PATCH In review Stanislav Kinsbursky 2 participants 5 messages Feb 28, 2013 – Mar 6, 2013

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

PATCH 1/1 nfsd: check client tracker initialization result

Function nfsd4_client_tracking_init() can return error.

---
 fs/nfsd/nfs4state.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
fs/nfsd/nfs4state.c +8 -1
index f194f86..fc4b81b 100644
@@ -69,6 +69,7 @@ static u64 current_sessionid = 1;
 
 /* forward declarations */
 static int check_for_locks(struct nfs4_file *filp, struct nfs4_lockowner *lowner);
+void nfs4_state_shutdown_net(struct net *net);
 
 /* Locking: */
 
@@ -4942,7 +4943,9 @@ nfs4_state_start_net(struct net *net)
 	ret = nfs4_state_create_net(net);
 	if (ret)
 		return ret;
-	nfsd4_client_tracking_init(net);
+	ret = nfsd4_client_tracking_init(net);
+	if (ret)
+		goto out_tracking;
 	nn->boot_time = get_seconds();
 	locks_start_grace(net, &nn->nfsd4_manager);
 	nn->grace_ended = false;
@@ -4950,6 +4953,10 @@ nfs4_state_start_net(struct net *net)
 	       nn->nfsd4_grace, net);
 	queue_delayed_work(laundry_wq, &nn->laundromat_work, nn->nfsd4_grace * HZ);
 	return 0;
+
+out_tracking:
+	nfs4_state_destroy_net(net);
+	return ret;
 }
 
 /* initialization to perform when the nfsd service is started: */
#1 lore raw
Quoted 1 line · Stanislav Kinsbursky

Function nfsd4_client_tracking_init() can return error.

Before, I think that we the nfsd4_client_* functions just became no-ops in this case. With the result that no client records get written, and so clients are unable to reclaim on the next boot.

Which is annoying, but possibly not as annoying as your server completely refusing to start.

It's arguably more helpful in the long run to fail immediately when we recognize reboot recovery isn't going to work. But in practice this may mean people that never knew they had a problem suddenly have servers that don't start at all.

So I'm inclined to be more forgiving and leave this as it is. But maybe something like a warning printk would be appropriate.

--b.

Quoted 41 lines
---
 fs/nfsd/nfs4state.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
fs/nfsd/nfs4state.c +8 -1
index f194f86..fc4b81b 100644
@@ -69,6 +69,7 @@ static u64 current_sessionid = 1;
 
 /* forward declarations */
 static int check_for_locks(struct nfs4_file *filp, struct nfs4_lockowner *lowner);
+void nfs4_state_shutdown_net(struct net *net);
 
 /* Locking: */
 
@@ -4942,7 +4943,9 @@ nfs4_state_start_net(struct net *net)
 	ret = nfs4_state_create_net(net);
 	if (ret)
 		return ret;
-	nfsd4_client_tracking_init(net);
+	ret = nfsd4_client_tracking_init(net);
+	if (ret)
+		goto out_tracking;
 	nn->boot_time = get_seconds();
 	locks_start_grace(net, &nn->nfsd4_manager);
 	nn->grace_ended = false;
@@ -4950,6 +4953,10 @@ nfs4_state_start_net(struct net *net)
 	       nn->nfsd4_grace, net);
 	queue_delayed_work(laundry_wq, &nn->laundromat_work, nn->nfsd4_grace * HZ);
 	return 0;
+
+out_tracking:
+	nfs4_state_destroy_net(net);
+	return ret;
 }
 
 /* initialization to perform when the nfsd service is started: */
#2 lore raw

06.03.2013 01:20, J. Bruce Fields пишет:

Quoted 10 lines · Stanislav Kinsbursky
Quoted 1 line

Function nfsd4_client_tracking_init() can return error.

Before, I think that we the nfsd4_client_* functions just became no-ops in this case. With the result that no client records get written, and so clients are unable to reclaim on the next boot.

Which is annoying, but possibly not as annoying as your server completely refusing to start.

Quoted 8 lines

It's arguably more helpful in the long run to fail immediately when we recognize reboot recovery isn't going to work. But in practice this may mean people that never knew they had a problem suddenly have servers that don't start at all.

So I'm inclined to be more forgiving and leave this as it is. But maybe something like a warning printk would be appropriate.

Ok then.
I'll add the warning anf convert the function to be "void" rather then "int". Thanks!

Quoted 43 lines

--b.

Quoted 41 lines
---
  fs/nfsd/nfs4state.c |    9 ++++++++-
  1 files changed, 8 insertions(+), 1 deletions(-)
fs/nfsd/nfs4state.c +8 -1
index f194f86..fc4b81b 100644
@@ -69,6 +69,7 @@ static u64 current_sessionid = 1;
 
  /* forward declarations */
  static int check_for_locks(struct nfs4_file *filp, struct nfs4_lockowner *lowner);
+void nfs4_state_shutdown_net(struct net *net);
 
  /* Locking: */
 
@@ -4942,7 +4943,9 @@ nfs4_state_start_net(struct net *net)
  	ret = nfs4_state_create_net(net);
  	if (ret)
  		return ret;
-	nfsd4_client_tracking_init(net);
+	ret = nfsd4_client_tracking_init(net);
+	if (ret)
+		goto out_tracking;
  	nn->boot_time = get_seconds();
  	locks_start_grace(net, &nn->nfsd4_manager);
  	nn->grace_ended = false;
@@ -4950,6 +4953,10 @@ nfs4_state_start_net(struct net *net)
  	       nn->nfsd4_grace, net);
  	queue_delayed_work(laundry_wq, &nn->laundromat_work, nn->nfsd4_grace * HZ);
  	return 0;
+
+out_tracking:
+	nfs4_state_destroy_net(net);
+	return ret;
  }
 
  /* initialization to perform when the nfsd service is started: */
Signature · 2 lines
Best regards,
Stanislav Kinsbursky
#3 lore raw

06.03.2013 09:06, Stanislav Kinsbursky пишет:

Quoted 16 lines

06.03.2013 01:20, J. Bruce Fields пишет:

Quoted 15 lines · Stanislav Kinsbursky
Quoted 1 line

Function nfsd4_client_tracking_init() can return error.

Before, I think that we the nfsd4_client_* functions just became no-ops in this case. With the result that no client records get written, and so clients are unable to reclaim on the next boot.

Which is annoying, but possibly not as annoying as your server completely refusing to start.

It's arguably more helpful in the long run to fail immediately when we recognize reboot recovery isn't going to work. But in practice this may mean people that never knew they had a problem suddenly have servers that don't start at all.

Quoted 8 lines
Quoted 3 lines

So I'm inclined to be more forgiving and leave this as it is. But maybe something like a warning printk would be appropriate.

Ok then.
I'll add the warning anf convert the function to be "void" rather then "int". Thanks!

We already have a warning.
So, probably all we need is just to change a prototype to make it less confusing. Is it ok?

Signature · 2 lines
Best regards,
Stanislav Kinsbursky
#4 lore raw
Quoted 21 lines · Stanislav Kinsbursky

06.03.2013 09:06, Stanislav Kinsbursky пишет:

Quoted 20 lines

06.03.2013 01:20, J. Bruce Fields пишет:

Quoted 18 lines · Stanislav Kinsbursky
Quoted 1 line

Function nfsd4_client_tracking_init() can return error.

Before, I think that we the nfsd4_client_* functions just became no-ops in this case. With the result that no client records get written, and so clients are unable to reclaim on the next boot.

Which is annoying, but possibly not as annoying as your server completely refusing to start.

It's arguably more helpful in the long run to fail immediately when we recognize reboot recovery isn't going to work. But in practice this may mean people that never knew they had a problem suddenly have servers that don't start at all.

So I'm inclined to be more forgiving and leave this as it is. But maybe something like a warning printk would be appropriate.

Quoted 8 lines
Quoted 4 lines

Ok then.
I'll add the warning anf convert the function to be "void" rather then "int". Thanks!

We already have a warning.
So, probably all we need is just to change a prototype to make it less confusing. Is it ok?

Sure. And/or add a comment if you think it would be useful.

--b.