From: Benny Halevy <bhalevy@panasas.com>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: linux-nfs@vger.kernel.org, pnfs@linux-nfs.org
Subject: Re: [pnfs] [RFC 17/51] nfsd41: clientid handling
Date: Mon, 17 Nov 2008 16:03:39 +0200 [thread overview]
Message-ID: <492179BB.2040902@panasas.com> (raw)
In-Reply-To: <1226349987-10735-1-git-send-email-bhalevy@panasas.com>
On Nov. 10, 2008, 22:46 +0200, Benny Halevy <bhalevy@panasas.com> wrote:
> From: Marc Eshel <eshel@almaden.ibm.com>
>
> Extract the clientid from sessionid to set the op_clientid on open.
> Verify that the clid for other stateful ops is zero for minorversion != 0
> (and do all other checks only for minorversion 0).
>
> Signed-off-by: Benny Halevy <bhalevy@panasas.com>
> ---
> fs/nfsd/nfs4proc.c | 13 +++++++++++++
> fs/nfsd/nfs4state.c | 21 ++++++++++++++++-----
> fs/nfsd/nfs4xdr.c | 10 ++++++++++
> 3 files changed, 39 insertions(+), 5 deletions(-)
>
> diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
> index b17948b..26aae5d 100644
> --- a/fs/nfsd/nfs4proc.c
> +++ b/fs/nfsd/nfs4proc.c
> @@ -164,6 +164,14 @@ do_open_fhandle(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_
> return status;
> }
>
> +#if defined(CONFIG_NFSD_V4_1)
> +static void
> +nfsd41_set_clientid(clientid_t *clid, struct current_session *cses)
> +{
> + clid->cl_boot = cses->cs_sid.clientid.cl_boot;
> + clid->cl_id = cses->cs_sid.clientid.cl_id;
> +}
> +#endif /* CONFIG_NFSD_V4_1 */
>
> static __be32
> nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
> @@ -178,6 +186,11 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
> if (open->op_create && open->op_claim_type != NFS4_OPEN_CLAIM_NULL)
> return nfserr_inval;
>
> +#if defined(CONFIG_NFSD_V4_1)
> + /* Set the NFSv4.1 client id */
> + if (open->op_minorversion)
> + nfsd41_set_clientid(&open->op_clientid, cstate->current_ses);
> +#endif /* CONFIG_NFSD_V4_1 */
> nfs4_lock_state();
>
> /* check seqid for replay. set nfs4_owner */
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index 2e6e9d5..14c1a0e 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -413,8 +413,8 @@ STALE_CLIENTID(clientid_t *clid)
> {
> if (clid->cl_boot == boot_time)
> return 0;
> - dprintk("NFSD stale clientid (%08x/%08x)\n",
> - clid->cl_boot, clid->cl_id);
> + dprintk("NFSD stale clientid (%08x/%08x) boot_time %08lx\n",
> + clid->cl_boot, clid->cl_id, boot_time);
> return 1;
> }
>
> @@ -2270,7 +2270,8 @@ nfs4_preprocess_seqid_op(struct svc_fh *current_fh, u32 seqid, stateid_t *statei
> if (lock->lk_is_new) {
> if (!sop->so_is_open_owner)
> return nfserr_bad_stateid;
> - if (!same_clid(&clp->cl_clientid, lockclid))
> + if (sop->so_minorversion == 0 &&
> + !same_clid(&clp->cl_clientid, lockclid))
> return nfserr_bad_stateid;
> /* stp is the open stateid */
> status = nfs4_check_openmode(stp, lkflg);
> @@ -2747,6 +2748,9 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
> unsigned int strhashval;
> unsigned int cmd;
> int err;
> +#if defined(CONFIG_NFSD_V4_1)
> + struct current_session *cses = cstate->current_ses;
> +#endif /* CONFIG_NFSD_V4_1 */
review 11-12: when cstate is going to be embedded in compoundres
this will change.
>
> dprintk("NFSD: nfsd4_lock: start=%Ld length=%Ld\n",
> (long long) lock->lk_offset,
> @@ -2773,8 +2777,10 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
> struct nfs4_file *fp;
>
> status = nfserr_stale_clientid;
> - if (STALE_CLIENTID(&lock->lk_new_clientid))
> +#if defined(CONFIG_NFSD_V4_1)
> + if (!cses && STALE_CLIENTID(&lock->lk_new_clientid))
> goto out;
> +#endif /* CONFIG_NFSD_V4_1 */
>
> /* validate and update open stateid and open seqid */
> status = nfs4_preprocess_seqid_op(&cstate->current_fh,
> @@ -2902,6 +2908,9 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
> struct file_lock file_lock;
> int error;
> __be32 status;
> +#if defined(CONFIG_NFSD_V4_1)
> + struct current_session *cses = cstate->current_ses;
> +#endif /* CONFIG_NFSD_V4_1 */
>
> if (locks_in_grace())
> return nfserr_grace;
> @@ -2913,8 +2922,10 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
> nfs4_lock_state();
>
> status = nfserr_stale_clientid;
> - if (STALE_CLIENTID(&lockt->lt_clientid))
> +#if defined(CONFIG_NFSD_V4_1)
> + if (!cses && STALE_CLIENTID(&lockt->lt_clientid))
> goto out;
> +#endif /* CONFIG_NFSD_V4_1 */
>
> if ((status = fh_verify(rqstp, &cstate->current_fh, S_IFREG, 0))) {
> dprintk("NFSD: nfsd4_lockt: fh_verify() failed!\n");
> diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
> index 9b26ba9..4675339 100644
> --- a/fs/nfsd/nfs4xdr.c
> +++ b/fs/nfsd/nfs4xdr.c
> @@ -148,6 +148,11 @@ xdr_error: \
> } \
> } while (0)
>
> +static int zero_clientid(clientid_t *clid)
> +{
> + return ((clid->cl_boot == 0) && (clid->cl_id == 0));
> +}
> +
> static __be32 *read_buf(struct nfsd4_compoundargs *argp, u32 nbytes)
> {
> /* We want more bytes than seem to be available.
> @@ -585,6 +590,8 @@ nfsd4_decode_lockt(struct nfsd4_compoundargs *argp, struct nfsd4_lockt *lockt)
> READ_BUF(lockt->lt_owner.len);
> READMEM(lockt->lt_owner.data, lockt->lt_owner.len);
>
> + if (argp->minorversion && !zero_clientid(&lockt->lt_clientid))
> + return nfserr_inval;
> DECODE_TAIL;
> }
>
> @@ -1003,6 +1010,9 @@ nfsd4_decode_release_lockowner(struct nfsd4_compoundargs *argp, struct nfsd4_rel
> READ_BUF(rlockowner->rl_owner.len);
> READMEM(rlockowner->rl_owner.data, rlockowner->rl_owner.len);
>
> + if (argp->minorversion && !zero_clientid(&rlockowner->rl_clientid))
> + return nfserr_inval;
> +
> DECODE_TAIL;
> }
>
next prev parent reply other threads:[~2008-11-17 14:03 UTC|newest]
Thread overview: 85+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-10 20:12 [RFC 0/51] nfs41 server patches for review Benny Halevy
2008-11-10 20:16 ` [RFC 01/51] nfsd: add etoosmall to nfserrno Benny Halevy
2008-11-10 20:39 ` [pnfs] [RFC 0/51] nfs41 server patches for review Benny Halevy
2008-11-10 20:40 ` [RFC 01/51] nfsd: add etoosmall to nfserrno Benny Halevy
2008-11-10 20:41 ` [RFC 02/51] nfsd: dprint each op status in nfsd4_proc_compound Benny Halevy
2008-11-17 13:56 ` [pnfs] " Benny Halevy
2008-11-10 20:41 ` [RFC 03/51] nfsd: git rid of nfs4_cb_null_ops declaration Benny Halevy
2008-11-10 20:41 ` [RFC 04/51] nfsd: fix file comment in fs/nfsd/nfs4xdr.c Benny Halevy
2008-11-17 13:56 ` [pnfs] " Benny Halevy
2008-11-10 20:42 ` [RFC 05/51] nfsd41: Add Kconfig symbols for NFSv4.1 Benny Halevy
2008-11-10 20:42 ` [RFC 06/51] nfsd41: define nfs41 error codes Benny Halevy
2008-11-10 20:43 ` [RFC 07/51] nfsd41: sessions basic data types Benny Halevy
2008-11-17 13:57 ` [pnfs] " Benny Halevy
2008-11-10 20:43 ` [RFC 08/51] nfsd41: introduce nfs4_client cl_sessions list Benny Halevy
2008-11-17 13:58 ` [pnfs] " Benny Halevy
2008-11-10 20:43 ` [RFC 09/51] nfsd41: destroy_session when client is expired Benny Halevy
2008-11-10 20:44 ` [RFC 10/51] nfsd41: sessionid hashing Benny Halevy
2008-11-17 13:58 ` [pnfs] " Benny Halevy
2008-11-10 20:44 ` [RFC 11/51] FIXME: nfsd41: reduce server lease time for nfs41 Benny Halevy
2008-11-17 13:59 ` [pnfs] " Benny Halevy
2008-11-10 20:44 ` [RFC 12/51] nfsd41: provide support for minor version 1 at rpc level Benny Halevy
2008-11-17 14:00 ` [pnfs] " Benny Halevy
2008-11-10 20:45 ` [RFC 13/51] FIXME: nfsd41: introduce current_session Benny Halevy
2008-11-17 14:00 ` [pnfs] " Benny Halevy
2008-11-10 20:45 ` [RFC 14/51] nfsd41: introduce nfs41_{get,set}_slot_state Benny Halevy
2008-11-17 14:01 ` [pnfs] " Benny Halevy
2008-11-10 20:45 ` [RFC 15/51] FIXME: nfsd41: free up slot unless operation is dropped Benny Halevy
2008-11-17 14:01 ` [pnfs] " Benny Halevy
2008-11-10 20:46 ` [RFC 16/51] nfsd41: stateid handling Benny Halevy
2008-11-17 14:02 ` [pnfs] " Benny Halevy
2008-11-10 20:46 ` [RFC 17/51] nfsd41: clientid handling Benny Halevy
2008-11-17 14:03 ` Benny Halevy [this message]
2008-11-10 20:46 ` [RFC 18/51] nfsd41: access_valid Benny Halevy
2008-11-17 14:04 ` [pnfs] " Benny Halevy
2008-11-10 20:47 ` [RFC 19/51] nfsd41: add OPEN4_SHARE_ACCESS_WANT nfs4_stateid bmap Benny Halevy
2008-11-17 14:05 ` [pnfs] " Benny Halevy
2008-11-10 20:47 ` [RFC 20/51] nfsd: last_byte_offset Benny Halevy
2008-11-17 14:06 ` [pnfs] " Benny Halevy
2008-11-10 20:47 ` [RFC 21/51] nfsd41: xdr stubs Benny Halevy
2008-11-17 14:06 ` [pnfs] " Benny Halevy
2008-11-10 20:48 ` [RFC 22/51] nfsd41: proc stubs Benny Halevy
2008-11-17 14:07 ` [pnfs] " Benny Halevy
2008-11-10 20:48 ` [RFC 23/51] nfsd41: exchange_id operation Benny Halevy
2008-11-17 14:07 ` [pnfs] " Benny Halevy
2008-11-10 20:48 ` [RFC 24/51] nfsd41: print exchange flags when purging client Benny Halevy
2008-11-17 14:08 ` [pnfs] " Benny Halevy
2008-11-10 20:49 ` [RFC 25/51] nfsd41: create_session operation Benny Halevy
2008-11-17 14:09 ` [pnfs] " Benny Halevy
2008-11-10 20:49 ` [RFC 26/51] nfsd41: destroy_session operation Benny Halevy
2008-11-17 14:10 ` [pnfs] " Benny Halevy
2008-11-10 20:49 ` [RFC 27/51] nfsd41: sequence operation Benny Halevy
2008-11-17 14:10 ` [pnfs] " Benny Halevy
2008-11-10 20:50 ` [RFC 28/51] FIXME: nfsd41: sunrpc: Added rpc server-side backchannel handling Benny Halevy
2008-11-17 14:11 ` [pnfs] " Benny Halevy
2008-11-10 20:50 ` [RFC 29/51] nfsd: BUG_ON_UNLOCKED_STATE Benny Halevy
2008-11-10 20:50 ` [RFC 30/51] nfsd: lock state around nfs4_put_delegation in nfsd_break_deleg_cb err path Benny Halevy
2008-11-10 20:51 ` [RFC 31/51] FIXME: nfsd: kref_get cb_client while doing the callback Benny Halevy
2008-11-10 20:51 ` [RFC 32/51] nfsd41: callback infrastructure Benny Halevy
2008-11-17 14:12 ` [pnfs] " Benny Halevy
2008-11-10 20:52 ` [RFC 33/51] nfsd41: introduce cl_cb_mutex Benny Halevy
2008-11-10 20:52 ` [RFC 34/51] nfsd41: cb_sequence callback Benny Halevy
2008-11-10 20:52 ` [RFC 35/51] nfsd41: introduce nfs4_cb_call_sync for nfs4 and nfs41 Benny Halevy
2008-11-10 20:53 ` [RFC 36/51] nfsd41: cb_recall callback Benny Halevy
2008-11-10 20:53 ` [RFC 37/51] nfsd41: pass writable attrs mask to nfsd4_decode_fattr Benny Halevy
2008-11-10 20:53 ` [RFC 38/51] nfsd41: support for 3-word long attribute bitmask Benny Halevy
2008-11-17 14:13 ` [pnfs] " Benny Halevy
2008-11-10 20:54 ` [RFC 39/51] nfsd41: SUPPATTR_EXCLCREAT attribute Benny Halevy
2008-11-10 20:54 ` [RFC 40/51] nfsd41: CREATE_EXCLUSIVE4_1 Benny Halevy
2008-11-17 14:13 ` [pnfs] " Benny Halevy
2008-11-10 20:54 ` [RFC 41/51] sunrpc: Add deferral save and restore state callback Benny Halevy
2008-11-10 20:55 ` [RFC 42/51] nfsd: save and restore defer result pages Benny Halevy
2008-11-10 20:55 ` [RFC 43/51] nfsd: deferral processing Benny Halevy
2008-11-10 20:55 ` [RFC 44/51] nfsd41: slab cache for current session Benny Halevy
2008-11-17 14:14 ` [pnfs] " Benny Halevy
2008-11-10 20:56 ` [RFC 45/51] nfsd41: DRC save, restore, and clear functions Benny Halevy
2008-11-17 14:14 ` [pnfs] " Benny Halevy
2008-11-10 20:56 ` [RFC 46/51] nfsd41: nfsd nfsd4_sequence DRC logic Benny Halevy
2008-11-10 20:56 ` [RFC 47/51] nfsd41: enforce NFS4ERR_SEQUENCE_POS operation order rules Benny Halevy
2008-11-17 14:15 ` [pnfs] " Benny Halevy
2008-11-10 20:57 ` [RFC 48/51] nfsd41: nfsd DRC logic Benny Halevy
2008-11-10 20:57 ` [RFC 49/51] nfsd41: clear DRC cache on free_session Benny Halevy
2008-11-10 20:57 ` [RFC 50/51] nfsd41: Add a create session replay cache Benny Halevy
2008-11-17 14:16 ` [pnfs] " Benny Halevy
2008-11-10 20:58 ` [RFC 51/51] nfsd41: print DRC statistics Benny Halevy
2008-11-17 14:17 ` [pnfs] " 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=492179BB.2040902@panasas.com \
--to=bhalevy@panasas.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