Skip to contentSkip to conversation

nfs41: fix nfs4_callback_recallslot

PATCH In review [email protected] 3 participants 6 messages Jan 21, 2010

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

PATCH 1/2 nfs41: fix nfs4_callback_recallslot

From: Andy Adamson <[email protected]>

Return NFS4_OK if target high slotid equals enforced high slotid. Fix nfs_client reference leak.

---
 fs/nfs/callback_proc.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
fs/nfs/callback_proc.c +7 -3
index e5155d9..c79e18c 100644
@@ -381,13 +381,17 @@ unsigned nfs4_callback_recallslot(struct cb_recallslotargs *args, void *dummy)
 	fc_tbl = &clp->cl_session->fc_slot_table;
 
 	status = htonl(NFS4ERR_BAD_HIGH_SLOT);
-	if (args->crsa_target_max_slots >= fc_tbl->max_slots ||
+	if (args->crsa_target_max_slots > fc_tbl->max_slots ||
 	    args->crsa_target_max_slots < 1)
-		goto out;
+		goto out_putclient;
+
+	status = htonl(NFS4_OK);
+	if (args->crsa_target_max_slots == fc_tbl->max_slots)
+		goto out_putclient;
 
 	fc_tbl->target_max_slots = args->crsa_target_max_slots;
 	nfs41_handle_recall_slot(clp);
-	status = htonl(NFS4_OK);
+out_putclient:
 	nfs_put_client(clp);	/* balance nfs_find_client */
 out:
 	dprintk("%s: exit with status = %d\n", __func__, ntohl(status));
Signature · 1 line
1.6.6
#1 lore raw

PATCH 2/2 nfs41: clear NFS4CLNT_RECALL_SLOT bit on session reset

From: Andy Adamson <[email protected]>

---
 fs/nfs/nfs4state.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
fs/nfs/nfs4state.c +5 -2
index 069dcb3..c7f2944 100644
@@ -1291,9 +1291,12 @@ static int nfs4_reset_session(struct nfs_client *clp)
 
 	memset(clp->cl_session->sess_id.data, 0, NFS4_MAX_SESSIONID_LEN);
 	status = nfs4_proc_create_session(clp);
-	if (status)
+	if (status) {
 		status = nfs4_recovery_handle_error(clp, status);
-
+		goto out;
+	}
+	/* create_session negotiated new slot table */
+	clear_bit(NFS4CLNT_RECALL_SLOT, &clp->cl_state);
 out:
 	/*
 	 * Let the state manager reestablish state
Signature · 1 line
1.6.6
#2 lore raw

Re: [PATCH 2/2] nfs41: clear NFS4CLNT_RECALL_SLOT bit on session reset

Quoted 16 lines · On Thu, 2010-01-21 at 14:19 -0500, [email protected] wrote:

From: Andy Adamson <[email protected]>

---
 fs/nfs/nfs4state.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
fs/nfs/nfs4state.c +0 -1
index 069dcb3..c7f2944 100644
@@ -1291,9 +1291,12 @@ static int nfs4_reset_session(struct nfs_client *clp)
 
 	memset(clp->cl_session->sess_id.data, 0, NFS4_MAX_SESSIONID_LEN);
 	status = nfs4_proc_create_session(clp);
-	if (status)

fs/nfs/nfs4state.c static int nfs4_reset_session(struct nfs_client *clp) · line 1302

Quoted 10 lines
fs/nfs/nfs4state.c +5 -1
+	if (status) {
 		status = nfs4_recovery_handle_error(clp, status);
-
+		goto out;
+	}
+	/* create_session negotiated new slot table */
+	clear_bit(NFS4CLNT_RECALL_SLOT, &clp->cl_state);
 out:
 	/*
 	 * Let the state manager reestablish state

Errm.... Looking at nfs4_reset_session, wouldn't it make sense to move that 'out:' label down one line, so that we can get rid of that test for 'status == 0'?

Trond

#3 lore raw

Re: [PATCH 2/2] nfs41: clear NFS4CLNT_RECALL_SLOT bit on session reset

Quoted 8 lines · Trond Myklebust
Quoted 7 lines · On Thu, 2010-01-21 at 14:19 -0500, [email protected] wrote:

From: Andy Adamson <[email protected]>

---
=A0fs/nfs/nfs4state.c | =A0 =A07 +++++-- =A01 files changed, 5 insertions(+), 2 deletions(-)

Quoted 5 lines

fs/nfs/nfs4state.c static int nfs4_reset_session(struct nfs_clie=

Quoted 5 lines
fs/nfs/nfs4state.c +0 -0
index 069dcb3..c7f2944 100644
@@ -1291,9 +1291,12 @@ static int nfs4_reset_session(struct nfs_clie=

nt *clp)

Quoted 2 lines
Quoted 2 lines

=A0 =A0 =A0 memset(clp->cl_session->sess_id.data, 0, NFS4_MAX_SESSIO=

NID_LEN);

Quoted 4 lines
Quoted 4 lines

=A0 =A0 =A0 status =3D nfs4_proc_create_session(clp);
- =A0 =A0 if (status)
+ =A0 =A0 if (status) {
=A0 =A0 =A0 =A0 =A0 =A0 =A0 status =3D nfs4_recovery_handle_error(cl=

p, status);

Quoted 10 lines
Quoted 8 lines

-
+ =A0 =A0 =A0 =A0 =A0 =A0 goto out;
+ =A0 =A0 }
+ =A0 =A0 /* create_session negotiated new slot table */
+ =A0 =A0 clear_bit(NFS4CLNT_RECALL_SLOT, &clp->cl_state); =A0out:
=A0 =A0 =A0 /*
=A0 =A0 =A0 =A0* Let the state manager reestablish state

Errm.... Looking at nfs4_reset_session, wouldn't it make sense to mov=

e

Quoted 1 line

that 'out:' label down one line, so that we can get rid of that test =

for

Quoted 1 line

'status =3D=3D 0'?

yes indeed it would.

-->Andy

Quoted 4 lines

Trond
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" =

in

Quoted 3 lines

the body of a message to [email protected]
More majordomo info at =A0http://vger.kernel.org/majordomo-info.html

#4 lore raw
In reply to [email protected]
Quoted 15 lines · On Thu, 2010-01-21 at 14:19 -0500, [email protected] wrote:

From: Andy Adamson <[email protected]>

Return NFS4_OK if target high slotid equals enforced high slotid. Fix nfs_client reference leak.

---
 fs/nfs/callback_proc.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
fs/nfs/callback_proc.c +0 -0
index e5155d9..c79e18c 100644

fs/nfs/callback_proc.c unsigned nfs4_callback_recallslot(struct cb_recallslotargs *args, void *dummy) · line 383

Quoted 3 lines
fs/nfs/callback_proc.c +0 -0
@@ -381,13 +381,17 @@ unsigned nfs4_callback_recallslot(struct cb_recallslotargs *args, void *dummy)
 	fc_tbl = &clp->cl_session->fc_slot_table;
 
 	status = htonl(NFS4ERR_BAD_HIGH_SLOT);

This is not related directly to your patch, but "sparse" is going to have a field day with all these scattered around the place. Are there any plans to clean all this up, and replace those 'int' and 'unsigned' declarations that are being assigned big ended values with the correct '__be32' type?

Quoted 17 lines
fs/nfs/callback_proc.c +7 -3
-	if (args->crsa_target_max_slots >= fc_tbl->max_slots ||
+	if (args->crsa_target_max_slots > fc_tbl->max_slots ||
 	    args->crsa_target_max_slots < 1)
-		goto out;
+		goto out_putclient;
+
+	status = htonl(NFS4_OK);
+	if (args->crsa_target_max_slots == fc_tbl->max_slots)
+		goto out_putclient;
 
 	fc_tbl->target_max_slots = args->crsa_target_max_slots;
 	nfs41_handle_recall_slot(clp);
-	status = htonl(NFS4_OK);
+out_putclient:
 	nfs_put_client(clp);	/* balance nfs_find_client */
 out:
 	dprintk("%s: exit with status = %d\n", __func__, ntohl(status));
#5 lore raw
Quoted 11 lines · Trond Myklebust
Quoted 10 lines · On Thu, 2010-01-21 at 14:19 -0500, [email protected] wrote:

From: Andy Adamson <[email protected]>

Return NFS4_OK if target high slotid equals enforced high slotid. Fix nfs_client reference leak.

---
=A0fs/nfs/callback_proc.c | =A0 10 +++++++--- =A01 files changed, 7 insertions(+), 3 deletions(-)

Quoted 5 lines

fs/nfs/callback_proc.c unsigned nfs4_callback_recallslot(struct cb_re=

Quoted 5 lines
fs/nfs/callback_proc.c +0 -0
index e5155d9..c79e18c 100644
@@ -381,13 +381,17 @@ unsigned nfs4_callback_recallslot(struct cb_re=

callslotargs *args, void *dummy)

Quoted 7 lines

fs/nfs/callback_proc.c unsigned nfs4_callback_recallslot(struct cb_re= · line 383

Quoted 3 lines
fs/nfs/callback_proc.c +0 -0
 =A0 =A0 =A0 fc_tbl =3D &clp->cl_session->fc_slot_table;
 
 =A0 =A0 =A0 status =3D htonl(NFS4ERR_BAD_HIGH_SLOT);

This is not related directly to your patch, but "sparse" is going to have a field day with all these scattered around the place. Are there any plans to clean all this up, and replace those 'int' and 'unsigned=

'

Quoted 1 line

declarations that are being assigned big ended values with the correc=

t

Quoted 1 line

'__be32' type?

I could do that.

-->Andy

Quoted 11 lines
Quoted 11 lines
fs/nfs/callback_proc.c +6 -2
- =A0 =A0 if (args->crsa_target_max_slots >=3D fc_tbl->max_slots ||
+ =A0 =A0 if (args->crsa_target_max_slots > fc_tbl->max_slots ||
 =A0 =A0 =A0 =A0 =A0 args->crsa_target_max_slots < 1)
- =A0 =A0 =A0 =A0 =A0 =A0 goto out;
+ =A0 =A0 =A0 =A0 =A0 =A0 goto out_putclient;
+
+ =A0 =A0 status =3D htonl(NFS4_OK);
+ =A0 =A0 if (args->crsa_target_max_slots =3D=3D fc_tbl->max_slots)
+ =A0 =A0 =A0 =A0 =A0 =A0 goto out_putclient;
 
Quoted 1 line
Quoted 1 line

=A0 =A0 =A0 fc_tbl->target_max_slots =3D args->crsa_target_max_slots=

;

Quoted 4 lines
Quoted 4 lines

=A0 =A0 =A0 nfs41_handle_recall_slot(clp);
- =A0 =A0 status =3D htonl(NFS4_OK);
+out_putclient:
=A0 =A0 =A0 nfs_put_client(clp); =A0 =A0/* balance nfs_find_client *=

/

Quoted 2 lines
Quoted 2 lines

=A0out:
=A0 =A0 =A0 dprintk("%s: exit with status =3D %d\n", __func__, ntohl=

(status));

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" =

in

Quoted 3 lines

the body of a message to [email protected]
More majordomo info at =A0http://vger.kernel.org/majordomo-info.html