Linux NFS development
 help / color / mirror / Atom feed
From: Benny Halevy <bhalevy@panasas.com>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>,
	Olga Kornievskaia <aglo@citi.umich.edu>,
	linux-nfs@vger.kernel.org, pnfs mailing list <pnfs@linux-nfs.org>,
	Trond Myklebust <trond@netapp.com>
Subject: Re: [pnfs] [PATCH] nfsd: use nfs client rpc callback program
Date: Fri, 26 Sep 2008 14:52:10 +0300	[thread overview]
Message-ID: <48DCCCEA.80706@panasas.com> (raw)
In-Reply-To: <20080925204110.GB14349@fieldses.org>

J. Bruce Fields wrote:
> On Thu, Sep 25, 2008 at 04:27:01PM -0400, Trond Myklebust wrote:
>> On Thu, 2008-09-25 at 16:00 -0400, J. Bruce Fields wrote:
>>>>>> Another fix would be to add a refcount to the rpc_program structure...
>>>>> ... a refcount seems more straightforward.  Benny, what do you think?
>>>> I agree.  I'll send a patch hopefully tomorrow.
>>>> Would you like that combined with the one I sent or as a separate one?
>>>> (I'm inclined towards the latter).
>>> That'd be fine.
>> So, looking at what you're trying to do, I'm still having trouble
>> figuring out why you think you need a dynamically allocated rpc_program
>> in the first place.
>>
>> If the only thing you are trying to support is dynamically allocated
>> program numbers, then note that rpc_encode_header() doesn't use
>> program->number at all. Instead, it uses clnt->cl_prog and
>> clnt->cl_vers. Nothing stops you from setting those values explicitly...
> 
> Oh, sure, that sounds like an excellent plan--thanks!
> 
Yeah, much simpler.
Though having nfs4_probe_callback directly assign to clnt->cl_prog
would work, it seems like a layering violation.
How about allowing this officially via struct rpc_create_args?

Benny

diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index e5bfe01..4ba84e8 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -104,6 +104,7 @@ struct  {
 	const struct rpc_timeout *timeout;
 	char			*servername;
 	struct rpc_program	*program;
+	u32			prognumber;	/* overrides program->number */
 	u32			version;
 	rpc_authflavor_t	authflavor;
 	unsigned long		flags;
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 76739e9..da0789f 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -174,7 +174,7 @@ static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args, stru
 	clnt->cl_procinfo = version->procs;
 	clnt->cl_maxproc  = version->nrprocs;
 	clnt->cl_protname = program->name;
-	clnt->cl_prog     = program->number;
+	clnt->cl_prog     = args->prognumber ? : program->number;
 	clnt->cl_vers     = version->number;
 	clnt->cl_stats    = program->stats;
 	clnt->cl_metrics  = rpc_alloc_iostats(clnt);
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index 30d3130..5e95909 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -377,6 +377,7 @@ static int do_probe_callback(void *data)
 		.addrsize	= sizeof(addr),
 		.timeout	= &timeparms,
 		.program	= &cb_program,
+		.prognumber	= cb->cb_prog,
 		.version	= nfs_cb_version[1]->number,
 		.authflavor	= RPC_AUTH_UNIX, /* XXX: need AUTH_GSS... */
 		.flags		= (RPC_CLNT_CREATE_NOPING | RPC_CLNT_CREATE_QUIET),

  reply	other threads:[~2008-09-26 11:52 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-17 19:43 [PATCH] nfsd: use nfs client rpc callback program Benny Halevy
2008-09-17 23:10 ` J. Bruce Fields
2008-09-17 23:34   ` Benny Halevy
2008-09-18  0:10     ` [pnfs] " Benny Halevy
2008-09-18 19:24       ` Benny Halevy
2008-09-18 19:43         ` Peter Staubach
2008-09-18 20:05           ` Benny Halevy
2008-09-18 21:36             ` Benny Halevy
2008-09-24 16:35         ` J. Bruce Fields
2008-09-24 16:59           ` Trond Myklebust
2008-09-24 17:21             ` J. Bruce Fields
2008-09-24 17:26               ` Trond Myklebust
2008-09-24 17:42                 ` J. Bruce Fields
2008-09-24 18:42                   ` Trond Myklebust
2008-09-24 18:49                     ` J. Bruce Fields
2008-09-25 19:30                       ` Benny Halevy
2008-09-25 20:00                         ` J. Bruce Fields
2008-09-25 20:27                           ` Trond Myklebust
2008-09-25 20:41                             ` J. Bruce Fields
2008-09-26 11:52                               ` Benny Halevy [this message]
2008-09-27  3:34                                 ` J. Bruce Fields
2008-09-28  6:21                                   ` [PATCH v4] " Benny Halevy
2008-09-29 19:21                                     ` J. Bruce Fields
2008-09-25 20:08                         ` [pnfs] [PATCH] " Trond Myklebust
2008-09-25 20:38                           ` J. Bruce Fields
2008-09-19 19:51     ` Olga Kornievskaia
2008-09-19 21:15       ` 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=48DCCCEA.80706@panasas.com \
    --to=bhalevy@panasas.com \
    --cc=aglo@citi.umich.edu \
    --cc=bfields@fieldses.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=pnfs@linux-nfs.org \
    --cc=trond.myklebust@fys.uio.no \
    --cc=trond@netapp.com \
    /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