Skip to contentSkip to conversation

NFSv4.1 set NFS4_MAX_SLOT_TABLE in _nfs41_proc_sequence

PATCH In review [email protected] 3 participants 3 messages Jun 15, 2010 – Jun 16, 2010 1 message not in the archive

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

PATCH 1/1 NFSv4.1 set NFS4_MAX_SLOT_TABLE in _nfs41_proc_sequence

From: Andy Adamson <[email protected]>

_nfs41_proc_sequence() kmallocs the calldata but does not set calldata->res.slotid to NFS4_MAX_SLOT_TABLE, so nfs41_sequence_prepare() calls nfs41_setup_sequence() with the res.sr_slotid set to a random value. If nfs41_setup_sequence() sees res.sr_slotid as not set to NFS4_MAX_SLOT_TABLE, it returns without actually setting up the sequence.

---
 fs/nfs/nfs4proc.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
fs/nfs/nfs4proc.c +1 -0
index 04eff86..243d6c7 100644
@@ -5142,6 +5142,7 @@ static struct rpc_task *_nfs41_proc_sequence(struct nfs_client *clp, struct rpc_
 		nfs_put_client(clp);
 		return ERR_PTR(-ENOMEM);
 	}
+	calldata->res.sr_slotid = NFS4_MAX_SLOT_TABLE;
 	msg.rpc_argp = &calldata->args;
 	msg.rpc_resp = &calldata->res;
 	calldata->clp = clp;
Signature · 1 line
1.6.6
#1 lore raw
Quoted 7 lines · On Tue, 2010-06-15 at 18:31 -0400, [email protected] wrote:

From: Andy Adamson <[email protected]>

_nfs41_proc_sequence() kmallocs the calldata but does not set calldata->res.slotid to NFS4_MAX_SLOT_TABLE, so nfs41_sequence_prepare() calls nfs41_setup_sequence() with the res.sr_slotid set to a random value. If nfs41_setup_sequence() sees res.sr_slotid as not set to NFS4_MAX_SLOT_TABLE, it returns without actually setting up the sequence.

Looks like a typo in my patch "NFSv41: Fix a memory leak in nfs41_proc_async_sequence()". I'll squash your patch into that. Please note that you will have to rebase if you try to pull the nfs-for-2.6.36 branch again.

Now.... With that said, do we really need to allow RPC calls to call nfs41_setup_sequence with an initialised slotid? This initialisation is a serious hassle, and is easy to forget.
When do we expect to end up hitting the res.sr_slotid != NFS4_MAX_SLOT_TABLE condition in real life?

Cheers
Trond

A message that is not in the archive (sent off-list or not yet received): 1276695716.5267.8.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org

#3 lore raw
Quoted 9 lines · Trond Myklebust
Quoted 7 lines · On Tue, 2010-06-15 at 18:31 -0400, [email protected] wrote:

From: Andy Adamson <[email protected]>

_nfs41_proc_sequence() kmallocs the calldata but does not set calldata->res.slotid to NFS4_MAX_SLOT_TABLE, so nfs41_sequence_prepare() calls nfs41_setup_sequence() with the res.sr_slotid set to a random value. If nfs41_setup_sequence() sees res.sr_slotid as not set to NFS4_MAX_SLOT_TABLE, it returns without actually setting up the sequence.

Quoted 7 lines

Looks like a typo in my patch "NFSv41: Fix a memory leak in nfs41_proc_async_sequence()". I'll squash your patch into that. Please note that you will have to rebase if you try to pull the nfs-for-2.6.36 branch again.

Now.... With that said, do we really need to allow RPC calls to call nfs41_setup_sequence with an initialised slotid?

nfs41_setup_sequence needs to know when a slot has already been initialized which happens when the error handlers resend.

Quoted 2 lines

This initialisation is
a serious hassle, and is easy to forget.

Agreed. I'll make it easy to remember by coding an initialization helper function.

Quoted 2 lines

When do we expect to end up hitting the res.sr_slotid != NFS4_MAX_SLOT_TABLE condition in real life?

What we don't expect in real life is for session->max_req == NFS4_MAX_SLOT_TABLE, unless it is not initialized.
A valid slotid is any value between 0 and session->max_req e.g. slotid != NFS4_MAX_SLOT_TABLE, so we hit that condition every valid SEQUENCE op.

-->Andy

Quoted 9 lines

Cheers
Trond

--
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