From: Benny Halevy <bhalevy@panasas.com>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: pnfs@linux-nfs.org, linux-nfs@vger.kernel.org,
Andy Adamson <andros@netapp.com>,
Ricardo Labiaga <Ricardo.Labiaga@netapp.com>
Subject: Re: [PATCH v2 05/12] nfsd41: Backchannel: callback infrastructure
Date: Mon, 14 Sep 2009 20:23:37 +0300 [thread overview]
Message-ID: <4AAE7C19.7070600@panasas.com> (raw)
In-Reply-To: <20090914164951.GA32757@fieldses.org>
On Sep. 14, 2009, 19:49 +0300, "J. Bruce Fields" <bfields@fieldses.org> wrote:
> On Mon, Sep 14, 2009 at 12:35:35PM -0400, bfields wrote:
>> On Thu, Sep 10, 2009 at 12:25:59PM +0300, Benny Halevy wrote:
>>> From: Andy Adamson <andros@netapp.com>
>>>
>>> Keep the xprt used for create_session in cl_cb_xprt.
>>> Mark cl_callback.cb_minorversion = 1 and remember
>>> the client provided cl_callback.cb_prog rpc program number.
>>> Use it to probe the callback path.
>>>
>>> Use the client's network address to initialize as the
>>> callback's address as expected by the xprt creation
>>> routines.
>>>
>>> Define xdr sizes and code nfs4_cb_compound header to be able
>>> to send a null callback rpc.
>>>
>>> Signed-off-by: Andy Adamson<andros@netapp.com>
>>> Signed-off-by: Benny Halevy <bhalevy@panasas.com>
>>> Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com>
>>> [get callback minorversion from fore channel's]
>>> Signed-off-by: Benny Halevy <bhalevy@panasas.com>
>>> [nfsd41: change bc_sock to bc_xprt]
>>> Signed-off-by: Benny Halevy <bhalevy@panasas.com>
>>> [pulled definition for cl_cb_xprt]
>>> Signed-off-by: Benny Halevy <bhalevy@panasas.com>
>>> [nfsd41: set up backchannel's cb_addr]
>>> [moved rpc_create_args init to "nfsd: modify nfsd4.1 backchannel to use new xprt class"]
>>> Signed-off-by: Benny Halevy <bhalevy@panasas.com>
>>> ---
>>> fs/nfsd/nfs4callback.c | 21 +++++++++++++++++++--
>>> fs/nfsd/nfs4state.c | 14 ++++++++++++++
>>> include/linux/nfsd/state.h | 3 +++
>>> 3 files changed, 36 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
>>> index 63bb384..3e3e15b 100644
>>> --- a/fs/nfsd/nfs4callback.c
>>> +++ b/fs/nfsd/nfs4callback.c
>>> @@ -43,6 +43,7 @@
>>> #include <linux/sunrpc/xdr.h>
>>> #include <linux/sunrpc/svc.h>
>>> #include <linux/sunrpc/clnt.h>
>>> +#include <linux/sunrpc/svcsock.h>
>>> #include <linux/nfsd/nfsd.h>
>>> #include <linux/nfsd/state.h>
>>> #include <linux/sunrpc/sched.h>
>>> @@ -52,16 +53,19 @@
>>>
>>> #define NFSPROC4_CB_NULL 0
>>> #define NFSPROC4_CB_COMPOUND 1
>>> +#define NFS4_STATEID_SIZE 16
>>>
>>> /* Index of predefined Linux callback client operations */
>>>
>>> enum {
>>> NFSPROC4_CLNT_CB_NULL = 0,
>>> NFSPROC4_CLNT_CB_RECALL,
>>> + NFSPROC4_CLNT_CB_SEQUENCE,
>>> };
>>>
>>> enum nfs_cb_opnum4 {
>>> OP_CB_RECALL = 4,
>>> + OP_CB_SEQUENCE = 11,
>>> };
>>>
>>> #define NFS4_MAXTAGLEN 20
>>> @@ -70,15 +74,22 @@ enum nfs_cb_opnum4 {
>>> #define NFS4_dec_cb_null_sz 0
>>> #define cb_compound_enc_hdr_sz 4
>>> #define cb_compound_dec_hdr_sz (3 + (NFS4_MAXTAGLEN >> 2))
>>> +#define sessionid_sz (NFS4_MAX_SESSIONID_LEN >> 2)
>>> +#define cb_sequence_enc_sz (sessionid_sz + 4 + \
>>> + 1 /* no referring calls list yet */)
>>> +#define cb_sequence_dec_sz (op_dec_sz + sessionid_sz + 4)
>>> +
>>> #define op_enc_sz 1
>>> #define op_dec_sz 2
>>> #define enc_nfs4_fh_sz (1 + (NFS4_FHSIZE >> 2))
>>> #define enc_stateid_sz (NFS4_STATEID_SIZE >> 2)
>>> #define NFS4_enc_cb_recall_sz (cb_compound_enc_hdr_sz + \
>>> + cb_sequence_enc_sz + \
>>> 1 + enc_stateid_sz + \
>>> enc_nfs4_fh_sz)
>>>
>>> #define NFS4_dec_cb_recall_sz (cb_compound_dec_hdr_sz + \
>>> + cb_sequence_dec_sz + \
>>> op_dec_sz)
>>>
>>> /*
>>> @@ -137,11 +148,13 @@ xdr_error: \
>>> } while (0)
>>>
>>> struct nfs4_cb_compound_hdr {
>>> - int status;
>>> - u32 ident;
>>> + /* args */
>>> + u32 ident; /* minorversion 0 only */
>>> u32 nops;
>>> __be32 *nops_p;
>>> u32 minorversion;
>>> + /* res */
>>> + int status;
>>> u32 taglen;
>>> char *tag;
>>> };
>>> @@ -399,6 +412,10 @@ int setup_callback_client(struct nfs4_client *clp)
>>> if (!clp->cl_principal && (clp->cl_flavor >= RPC_AUTH_GSS_KRB5))
>>> return -EINVAL;
>>>
>>> + dprintk("%s: program %s 0x%x nrvers %u version %u minorversion %u\n",
>>> + __func__, args.program->name, args.prognumber,
>>> + args.program->nrvers, args.version, cb->cb_minorversion);
>>> +
>>> /* Create RPC client */
>>> client = rpc_create(&args);
>>> if (IS_ERR(client)) {
>>> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
>>> index 46e9ac5..e4c3223 100644
>>> --- a/fs/nfsd/nfs4state.c
>>> +++ b/fs/nfsd/nfs4state.c
>>> @@ -706,6 +706,8 @@ static inline void
>>> free_client(struct nfs4_client *clp)
>>> {
>>> shutdown_callback_client(clp);
>>> + if (clp->cl_cb_xprt)
>>> + svc_xprt_put(clp->cl_cb_xprt);
>>> if (clp->cl_cred.cr_group_info)
>>> put_group_info(clp->cl_cred.cr_group_info);
>>> kfree(clp->cl_principal);
>>> @@ -1321,6 +1323,18 @@ nfsd4_create_session(struct svc_rqst *rqstp,
>>> cr_ses->flags &= ~SESSION4_PERSIST;
>>> cr_ses->flags &= ~SESSION4_RDMA;
>>>
>>> + if (cr_ses->flags & SESSION4_BACK_CHAN) {
>>> + unconf->cl_cb_xprt = rqstp->rq_xprt;
>>> + svc_xprt_get(unconf->cl_cb_xprt);
>>> + rpc_copy_addr(
>>> + (struct sockaddr *)&unconf->cl_cb_conn.cb_addr,
>>> + sa);
>>> + unconf->cl_cb_conn.cb_addrlen = svc_addr_len(sa);
>>> + unconf->cl_cb_conn.cb_minorversion =
>>> + cstate->minorversion;
>>> + unconf->cl_cb_conn.cb_prog = cr_ses->callback_prog;
>>> + nfsd4_probe_callback(unconf);
>> This results in a NULL deference in rpcauth_lookup_credcache()--probably
>> some callback parameters that aren't set up right yet.
Where exactly is the NULL deref?
>
> Note--that's fixed 7 patches later in fsd41: Refactor create_client(),
> but I don't actually understand how yet.
unconf's cl_flavor initialization was moved in the latter patch
from nfsd4_setclientid to create_client so maybe this could
be the culprit (though, assuming it is initialized to 0
it will choosing implicitly authnull_ops in rpcauth_create()
which _should_ work...)
Benny
>
> --b.
>
>> --b.
>>
>>> + }
>>> conf = unconf;
>>> } else {
>>> status = nfserr_stale_clientid;
>>> diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h
>>> index 70ef5f4..243277b 100644
>>> --- a/include/linux/nfsd/state.h
>>> +++ b/include/linux/nfsd/state.h
>>> @@ -212,6 +212,9 @@ struct nfs4_client {
>>> struct nfsd4_clid_slot cl_cs_slot; /* create_session slot */
>>> u32 cl_exchange_flags;
>>> struct nfs4_sessionid cl_sessionid;
>>> +
>>> + /* for nfs41 callbacks */
>>> + struct svc_xprt *cl_cb_xprt; /* 4.1 callback transport */
>>> };
>>>
>>> /* struct nfs4_client_reset
>>> --
>>> 1.6.4
>>>
next prev parent reply other threads:[~2009-09-14 17:22 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-04 16:18 [PATCH 0/10] nfsd41 backchannel patches for 2.6.32 Benny Halevy
2009-09-04 16:31 ` [PATCH 01/10] nfsd41: sunrpc: move struct rpc_buffer def into sunrpc.h Benny Halevy
2009-09-04 16:31 ` [PATCH 02/10] nfsd41: sunrpc: Added rpc server-side backchannel handling Benny Halevy
2009-09-04 17:00 ` Trond Myklebust
2009-09-04 16:31 ` [PATCH 03/10] nfsd4: fix whitespace in NFSPROC4_CLNT_CB_NULL definition Benny Halevy
2009-09-04 16:32 ` [PATCH 04/10] nfsd41: Backchannel: callback infrastructure Benny Halevy
2009-09-04 16:32 ` [PATCH 05/10] nfsd41: Backchannel: Add sequence arguments to callback RPC arguments Benny Halevy
2009-09-04 16:32 ` [PATCH 06/10] nfsd41: Backchannel: Server backchannel RPC wait queue Benny Halevy
2009-09-04 16:32 ` [PATCH 07/10] nfsd41: Backchannel: Setup sequence information Benny Halevy
2009-09-04 16:32 ` [PATCH 08/10] nfsd41: Backchannel: cb_sequence callback Benny Halevy
2009-09-04 16:33 ` [PATCH 09/10] nfsd41: Backchannel: Implement cb_recall over NFSv4.1 Benny Halevy
2009-09-04 16:33 ` [PATCH 10/10] nfsd41: Refactor create_client() Benny Halevy
2009-09-10 9:23 ` [PATCH v2 0/12] nfsd41 backchannel patches for 2.6.32 Benny Halevy
2009-09-10 9:25 ` [PATCH v2 01/12] nfsd41: sunrpc: move struct rpc_buffer def into sunrpc.h Benny Halevy
2009-09-10 16:11 ` J. Bruce Fields
2009-09-10 9:25 ` [PATCH v2 02/12] nfsd41: sunrpc: Added rpc server-side backchannel handling Benny Halevy
2009-09-10 11:49 ` Trond Myklebust
[not found] ` <1252583366.8722.121.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2009-09-10 12:33 ` Benny Halevy
2009-09-10 13:19 ` [pnfs] " Alexandros Batsakis
2009-09-11 22:29 ` Build error of latest Linux-pnfs 2.6.31 Sun_Peixing
[not found] ` <44328C067A5E0945856BF1EF5BE23689A29888-1Zg0zMUlrbepizOVUD2tfjjd7nCn89gW@public.gmane.org>
2009-09-13 9:31 ` Benny Halevy
2009-09-10 14:32 ` [PATCH v3 02/12] nfsd41: sunrpc: Added rpc server-side backchannel handling Benny Halevy
2009-09-10 9:25 ` [PATCH v2 03/12] nfsd41: sunrpc: add new xprt class for nfsv4.1 backchannel Benny Halevy
2009-09-10 14:33 ` [PATCH v3 " Benny Halevy
2009-09-11 20:58 ` J. Bruce Fields
2009-09-11 21:12 ` [pnfs] " Alexandros Batsakis
[not found] ` <5e24e8930909111412r2c7bdc58u119767517154d6-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-09-13 20:28 ` J. Bruce Fields
2009-09-14 8:17 ` Benny Halevy
2009-09-10 9:25 ` [PATCH v2 04/12] nfsd4: fix whitespace in NFSPROC4_CLNT_CB_NULL definition Benny Halevy
2009-09-10 9:25 ` [PATCH v2 05/12] nfsd41: Backchannel: callback infrastructure Benny Halevy
2009-09-14 16:35 ` J. Bruce Fields
2009-09-14 16:49 ` J. Bruce Fields
2009-09-14 17:23 ` Benny Halevy [this message]
2009-09-14 20:04 ` J. Bruce Fields
2009-09-14 20:17 ` Trond Myklebust
[not found] ` <1252959452.6866.92.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2009-09-14 20:39 ` J. Bruce Fields
2009-09-14 20:47 ` Trond Myklebust
[not found] ` <1252961253.6866.98.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2009-09-14 20:56 ` J. Bruce Fields
2009-09-14 21:09 ` Trond Myklebust
[not found] ` <1252962546.6866.102.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2009-09-14 21:16 ` Trond Myklebust
[not found] ` <1252962982.6866.104.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2009-09-15 15:10 ` J. Bruce Fields
2009-09-15 17:32 ` Trond Myklebust
[not found] ` <1253035933.4456.43.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2009-09-16 1:06 ` J. Bruce Fields
2009-09-16 1:07 ` [PATCH 1/4] nfsd4: fix null dereference creating nfsv4 callback client J. Bruce Fields
2009-09-16 1:07 ` [PATCH 2/4] SUNRPC: Defer the auth_gss upcall when the RPC call is asynchronous J. Bruce Fields
2009-09-16 1:07 ` [PATCH 3/4] nfsd4: allow nfs4 state startup to fail J. Bruce Fields
2009-09-16 1:07 ` [PATCH 4/4] nfsd4: use common rpc_cred for all callbacks J. Bruce Fields
2009-09-10 9:26 ` [PATCH v2 06/12] nfsd41: Backchannel: Add sequence arguments to callback RPC arguments Benny Halevy
2009-09-10 9:26 ` [PATCH v2 07/12] nfsd41: Backchannel: Server backchannel RPC wait queue Benny Halevy
2009-09-10 9:26 ` [PATCH v2 08/12] nfsd41: Backchannel: Setup sequence information Benny Halevy
2009-09-10 9:26 ` [PATCH v2 09/12] nfsd41: Backchannel: cb_sequence callback Benny Halevy
2009-09-13 20:27 ` J. Bruce Fields
2009-09-14 7:21 ` [pnfs] " Boaz Harrosh
2009-09-10 9:27 ` [PATCH v2 10/12] nfsd41: Backchannel: Implement cb_recall over NFSv4.1 Benny Halevy
2009-09-13 20:39 ` J. Bruce Fields
2009-09-14 8:28 ` Benny Halevy
2009-09-10 9:27 ` [PATCH v2 11/12] nfsd41: modify nfsd4.1 backchannel to use new xprt class Benny Halevy
2009-09-10 9:27 ` [PATCH v2 12/12] nfsd41: Refactor create_client() Benny Halevy
2009-09-10 14:37 ` [pnfs] [PATCH v2 0/12] nfsd41 backchannel patches for 2.6.32 Benny Halevy
2009-09-10 14:45 ` Benny Halevy
2009-09-10 16:28 ` J. Bruce Fields
2009-09-10 17:10 ` Trond Myklebust
2009-09-17 19:39 ` J. Bruce Fields
2009-09-17 19:47 ` Benny Halevy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4AAE7C19.7070600@panasas.com \
--to=bhalevy@panasas.com \
--cc=Ricardo.Labiaga@netapp.com \
--cc=andros@netapp.com \
--cc=bfields@fieldses.org \
--cc=linux-nfs@vger.kernel.org \
--cc=pnfs@linux-nfs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).