From: Christoph Hellwig <hch@infradead.org>
To: Trond Myklebust <trond.myklebust@primarydata.com>
Cc: Bruce Fields <bfields@fieldses.org>, linux-nfs@vger.kernel.org
Subject: Re: [PATCH 36/70] NFSd: Add reference counting to find_stateid
Date: Sat, 19 Apr 2014 07:50:26 -0700 [thread overview]
Message-ID: <20140419145026.GE25682@infradead.org> (raw)
In-Reply-To: <1397846704-14567-37-git-send-email-trond.myklebust@primarydata.com>
> +static void nfs4_put_stateid(struct nfs4_stid *s)
> +{
> + if (s == NULL)
> + return;
> + switch (s->sc_type) {
> + case NFS4_OPEN_STID:
> + case NFS4_LOCK_STID:
> + case NFS4_CLOSED_STID:
> + put_generic_stateid(openlockstateid(s));
> + break;
> + case NFS4_DELEG_STID:
> + case NFS4_REVOKED_DELEG_STID:
> + case NFS4_CLOSED_DELEG_STID:
> + nfs4_put_delegation(delegstateid(s));
> + }
> +}
I really don't like the way the inheritance for the stateids works,
a pure put operation shouldn't need this. I think all this can be
fixed by adding a ->free function pointer to struct nfs4_stid. At this
point the braindamage of passing a kmem_cache pointer to various
function can be removed (similar to how nfs4_alloc_stid should be
replaced with a nfs4_init_stid that takes an already allocated stid),
and nothing in the normal refcounting path should need these switches.
> @@ -3804,26 +3823,33 @@ static __be32 nfsd4_validate_stateid(struct nfs4_client *cl, stateid_t *stateid)
> return nfserr_bad_stateid;
> status = check_stateid_generation(stateid, &s->sc_stateid, 1);
> if (status)
> - return status;
> + goto out_put_stid;
> switch (s->sc_type) {
> case NFS4_DELEG_STID:
> - return nfs_ok;
> + status = nfs_ok;
> + break;
> case NFS4_REVOKED_DELEG_STID:
> - return nfserr_deleg_revoked;
> + status = nfserr_deleg_revoked;
> + break;
> case NFS4_OPEN_STID:
> case NFS4_LOCK_STID:
> ols = openlockstateid(s);
> if (ols->st_stateowner->so_is_open_owner
> && !(openowner(ols->st_stateowner)->oo_flags
> & NFS4_OO_CONFIRMED))
> - return nfserr_bad_stateid;
> - return nfs_ok;
> + status = nfserr_bad_stateid;
> + else
> + status = nfs_ok;
> + break;
Not quite as urgent as for the refcounting, but I think moving more
of these switches on the type into proper methods would improve the
stateid code a lot.
next prev parent reply other threads:[~2014-04-19 14:50 UTC|newest]
Thread overview: 118+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-18 18:43 [PATCH 00/70] NFSd lock scalability patches Trond Myklebust
2014-04-18 18:43 ` [PATCH 01/70] NFSd: Ensure we clear the cstate->slot in nfsd4_proc_compound Trond Myklebust
2014-04-18 18:43 ` [PATCH 02/70] NFSd: Move default initialisers from create_client() to alloc_client() Trond Myklebust
2014-04-18 18:43 ` [PATCH 03/70] NFSd: call rpc_destroy_wait_queue() from free_client() Trond Myklebust
2014-04-18 18:43 ` [PATCH 04/70] NFSd: Remove 'inline' designation for free_client() Trond Myklebust
2014-04-18 18:43 ` [PATCH 05/70] nfsd4: rename recall_lock to state_lock Trond Myklebust
2014-04-18 18:44 ` [PATCH 06/70] nfsd4: use cl_lock to synchronize all stateid idr calls Trond Myklebust
2014-04-18 18:44 ` [PATCH 07/70] nfsd4: hash deleg stateid only on successful nfs4_set_delegation Trond Myklebust
2014-04-18 18:44 ` [PATCH 08/70] nfsd4: use state_lock for delegation hashing Trond Myklebust
2014-04-18 18:44 ` [PATCH 09/70] NFSd: Mark nfs4_free_lockowner and nfs4_free_openowner as static functions Trond Myklebust
2014-04-18 18:44 ` [PATCH 10/70] NFSd: Avoid taking state_lock while holding inode lock in nfsd_break_one_deleg Trond Myklebust
2014-04-18 18:44 ` [PATCH 11/70] NFSd: Ensure delegation setup is safe w.r.t. break_lease() Trond Myklebust
2014-04-18 18:44 ` [PATCH 12/70] NFSd: Add fine grained protection for the nfs4_file->fi_stateids list Trond Myklebust
2014-04-18 18:44 ` [PATCH 13/70] NFSd: Clean up nfs4_preprocess_stateid_op Trond Myklebust
2014-04-18 18:44 ` [PATCH 14/70] NFSd: Add a mutex to protect the NFSv4.0 open owner replay cache Trond Myklebust
2014-04-18 18:44 ` [PATCH 15/70] NFSd: Add locking to the nfs4_file->fi_fds[] array Trond Myklebust
2014-04-18 18:44 ` [PATCH 16/70] NFSd: Protect the nfs4_file delegation fields using the fi_lock Trond Myklebust
2014-04-18 18:44 ` [PATCH 17/70] NFSd: Lock owners are not per open stateid Trond Myklebust
2014-04-18 18:44 ` [PATCH 18/70] NFSd: Clean up helper __release_lock_stateid Trond Myklebust
2014-04-18 18:44 ` [PATCH 19/70] NFSd: Allow lockowners to hold several stateids Trond Myklebust
2014-04-18 18:44 ` [PATCH 20/70] NFSd: NFSv4 lock-owners are not associated to a specific file Trond Myklebust
2014-04-18 18:44 ` [PATCH 21/70] NFSd: Get rid of the lockowner_ino_hashtbl Trond Myklebust
2014-04-18 18:44 ` [PATCH 22/70] NFSd: Cleanup nfs4svc_encode_compoundres Trond Myklebust
2014-04-18 18:44 ` [PATCH 23/70] NFSd: Don't get a session reference without a client reference Trond Myklebust
2014-04-18 18:44 ` [PATCH 24/70] NFSd: Move the delegation reference counter into the struct nfs4_stid Trond Myklebust
2014-04-18 18:44 ` [PATCH 25/70] NFSd: Simplify stateid management Trond Myklebust
2014-04-18 18:44 ` [PATCH 26/70] NFSd: Fix delegation revocation Trond Myklebust
2014-04-18 18:44 ` [PATCH 27/70] NFSd: Don't let the laundromat reap clients that are referenced Trond Myklebust
2014-04-18 18:44 ` [PATCH 28/70] NFSd: Add reference counting to the lock and open stateids Trond Myklebust
2014-04-18 18:44 ` [PATCH 29/70] NFSd: Add a struct nfs4_file field to struct nfs4_stid Trond Myklebust
2014-04-18 18:44 ` [PATCH 30/70] NFSd: Replace delegation->dl_file with the dl_stid.sc_file Trond Myklebust
2014-04-18 18:44 ` [PATCH 31/70] NFSd: Replace nfs4_ol_stateid->st_file with the st_stid.sc_file Trond Myklebust
2014-04-18 18:44 ` [PATCH 32/70] NFSd: Ensure stateids remain unique until they are freed Trond Myklebust
2014-04-18 18:44 ` [PATCH 33/70] NFSd: Ensure atomicity of stateid destruction and idr tree removal Trond Myklebust
2014-04-18 18:44 ` [PATCH 34/70] NFSd: Fix atomicity of delegation counter Trond Myklebust
2014-04-18 18:44 ` [PATCH 35/70] NFSd: Slight cleanup of find_stateid() Trond Myklebust
2014-04-18 18:44 ` [PATCH 36/70] NFSd: Add reference counting to find_stateid Trond Myklebust
2014-04-18 18:44 ` [PATCH 37/70] NFSd: nfs4_preprocess_seqid_op should only set *stpp on success Trond Myklebust
2014-04-18 18:44 ` [PATCH 38/70] NFSd: Add reference counting to lock stateids Trond Myklebust
2014-04-18 18:44 ` [PATCH 39/70] NFSd: nfsd4_locku() must reference the lock stateid Trond Myklebust
2014-04-18 18:44 ` [PATCH 40/70] NFSd: Ensure that nfs4_open_delegation() references the delegation stateid Trond Myklebust
2014-04-18 18:44 ` [PATCH 41/70] NFSd: nfsd4_process_open2() must reference " Trond Myklebust
2014-04-18 18:44 ` [PATCH 42/70] NFSd: nfsd4_process_open2() must reference the open stateid Trond Myklebust
2014-04-18 18:44 ` [PATCH 43/70] NFSd: Prepare nfsd4_close() for open stateid referencing Trond Myklebust
2014-04-18 18:44 ` [PATCH 44/70] NFSd: nfsd4_open_confirm() must reference the open stateid Trond Myklebust
2014-04-18 18:44 ` [PATCH 45/70] NFSd: Add reference counting to nfs4_preprocess_confirmed_seqid_op Trond Myklebust
2014-04-18 18:44 ` [PATCH 46/70] NFSd: Migrate the stateid reference into nfs4_preprocess_seqid_op Trond Myklebust
2014-04-18 18:44 ` [PATCH 47/70] NFSd: Migrate the stateid reference into nfs4_lookup_stateid() Trond Myklebust
2014-04-18 18:44 ` [PATCH 48/70] NFSd: Migrate the stateid reference into nfs4_find_stateid_by_type() Trond Myklebust
2014-04-18 18:44 ` [PATCH 49/70] NFSd: Cleanup - Let nfsd4_lookup_stateid() take a cstate argument Trond Myklebust
2014-04-18 18:44 ` [PATCH 50/70] NFSd: Use the session->se_client in lookup_clientid() Trond Myklebust
2014-04-18 18:44 ` [PATCH 51/70] NFSd: Convert nfsd4_process_open1() to work with lookup_clientid() Trond Myklebust
2014-04-18 18:44 ` [PATCH 52/70] NFSd: Convert nfs4_check_open_reclaim() " Trond Myklebust
2014-04-18 18:44 ` [PATCH 53/70] NFSd: Ensure struct nfs4_client is unhashed before we try to destroy it Trond Myklebust
2014-04-18 18:44 ` [PATCH 54/70] NFSd: Ensure that the laundromat unhashes the client before releasing locks Trond Myklebust
2014-04-18 18:44 ` [PATCH 55/70] NFSd: Don't require client_lock in free_client Trond Myklebust
2014-04-18 18:44 ` [PATCH 56/70] NFSd: Move create_client() call outside the lock Trond Myklebust
2014-04-18 18:44 ` [PATCH 57/70] NFSd: Protect unconfirmed client creation using client_lock Trond Myklebust
2014-04-18 18:44 ` [PATCH 58/70] NFSd: Protect session creation and client confirm " Trond Myklebust
2014-04-18 18:44 ` [PATCH 59/70] NFSd: Protect nfsd4_destroy_clientid " Trond Myklebust
2014-04-18 18:44 ` [PATCH 60/70] NFSd: Ensure lookup_clientid() takes client_lock Trond Myklebust
2014-04-18 18:44 ` [PATCH 61/70] NFSd: Remove nfs4_lock_state(): nfs4_preprocess_stateid_op() Trond Myklebust
2014-04-18 18:44 ` [PATCH 62/70] NFSd: Remove nfs4_lock_state(): nfsd4_test_stateid/nfsd4_free_stateid Trond Myklebust
2014-04-18 18:44 ` [PATCH 63/70] NFSd: Remove nfs4_lock_state(): nfsd4_release_lockowner Trond Myklebust
2014-04-18 18:44 ` [PATCH 64/70] NFSd: Remove nfs4_lock_state(): nfsd4_lock/locku/lockt() Trond Myklebust
2014-04-18 18:44 ` [PATCH 65/70] NFSd: Remove nfs4_lock_state(): nfsd4_open_downgrade + nfsd4_close Trond Myklebust
2014-04-18 18:45 ` [PATCH 66/70] NFSd: Remove nfs4_lock_state(): nfsd4_delegreturn() Trond Myklebust
2014-04-18 18:45 ` [PATCH 67/70] NFSd: Remove nfs4_lock_state(): nfsd4_open and nfsd4_open_confirm Trond Myklebust
2014-04-18 18:45 ` [PATCH 68/70] NFSd: Remove nfs4_lock_state(): exchange_id, create/destroy_session() Trond Myklebust
2014-04-18 18:45 ` [PATCH 69/70] NFSd: Remove nfs4_lock_state(): setclientid, setclientid_confirm, renew Trond Myklebust
2014-04-18 18:45 ` [PATCH 70/70] NFSd: Remove nfs4_lock_state(): reclaim_complete() Trond Myklebust
2014-05-05 8:53 ` [PATCH 60/70] NFSd: Ensure lookup_clientid() takes client_lock Christoph Hellwig
2014-05-16 18:19 ` [PATCH 58/70] NFSd: Protect session creation and client confirm using client_lock Jeff Layton
2014-04-19 14:56 ` [PATCH 50/70] NFSd: Use the session->se_client in lookup_clientid() Christoph Hellwig
2014-05-07 20:18 ` Bruce Fields
2014-05-07 20:21 ` Bruce Fields
2014-05-07 19:58 ` [PATCH 37/70] NFSd: nfs4_preprocess_seqid_op should only set *stpp on success Bruce Fields
2014-05-08 19:48 ` Trond Myklebust
2014-04-19 14:50 ` Christoph Hellwig [this message]
2014-04-21 15:37 ` [PATCH 36/70] NFSd: Add reference counting to find_stateid Trond Myklebust
2014-04-19 14:41 ` [PATCH 35/70] NFSd: Slight cleanup of find_stateid() Christoph Hellwig
2014-04-21 13:31 ` Trond Myklebust
2014-04-19 15:51 ` [PATCH 34/70] NFSd: Fix atomicity of delegation counter Christoph Hellwig
2014-04-21 15:58 ` Trond Myklebust
2014-04-19 14:40 ` [PATCH 30/70] NFSd: Replace delegation->dl_file with the dl_stid.sc_file Christoph Hellwig
2014-04-21 13:13 ` Trond Myklebust
2014-05-05 9:01 ` Christoph Hellwig
2014-05-07 19:25 ` [PATCH 29/70] NFSd: Add a struct nfs4_file field to struct nfs4_stid Bruce Fields
2014-05-08 19:40 ` Trond Myklebust
2014-05-09 7:34 ` Christoph Hellwig
2014-05-07 19:20 ` [PATCH 27/70] NFSd: Don't let the laundromat reap clients that are referenced Bruce Fields
2014-05-07 18:46 ` [PATCH 26/70] NFSd: Fix delegation revocation Bruce Fields
2014-05-07 16:21 ` [PATCH 25/70] NFSd: Simplify stateid management Bruce Fields
2014-04-19 14:38 ` [PATCH 21/70] NFSd: Get rid of the lockowner_ino_hashtbl Christoph Hellwig
2014-04-21 13:08 ` Trond Myklebust
2014-05-07 15:20 ` [PATCH 19/70] NFSd: Allow lockowners to hold several stateids Bruce Fields
2014-05-22 12:20 ` Jeff Layton
2014-04-19 14:35 ` [PATCH 15/70] NFSd: Add locking to the nfs4_file->fi_fds[] array Christoph Hellwig
2014-04-21 13:01 ` Trond Myklebust
2014-04-21 13:14 ` Christoph Hellwig
2014-04-21 13:16 ` Christoph Hellwig
2014-05-06 23:41 ` [PATCH 11/70] NFSd: Ensure delegation setup is safe w.r.t. break_lease() Bruce Fields
2014-05-09 0:56 ` Trond Myklebust
2014-05-06 23:40 ` [PATCH 10/70] NFSd: Avoid taking state_lock while holding inode lock in nfsd_break_one_deleg Bruce Fields
2014-05-09 0:50 ` Trond Myklebust
2014-05-30 12:05 ` Jeff Layton
2014-04-19 15:56 ` [PATCH 08/70] nfsd4: use state_lock for delegation hashing Christoph Hellwig
2014-05-06 16:48 ` [PATCH 06/70] nfsd4: use cl_lock to synchronize all stateid idr calls Bruce Fields
2014-05-06 16:40 ` [PATCH 04/70] NFSd: Remove 'inline' designation for free_client() Bruce Fields
2014-05-06 16:37 ` [PATCH 03/70] NFSd: call rpc_destroy_wait_queue() from free_client() Bruce Fields
2014-05-06 16:37 ` [PATCH 02/70] NFSd: Move default initialisers from create_client() to alloc_client() Bruce Fields
2014-05-06 15:32 ` [PATCH 01/70] NFSd: Ensure we clear the cstate->slot in nfsd4_proc_compound Bruce Fields
2014-05-06 16:36 ` Bruce Fields
2014-04-19 15:04 ` [PATCH 00/70] NFSd lock scalability patches Christoph Hellwig
2014-04-19 20:58 ` Bruce Fields
2014-05-07 20:29 ` Bruce Fields
2014-05-08 20:16 ` Trond Myklebust
2014-04-21 15:01 ` Christoph Hellwig
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=20140419145026.GE25682@infradead.org \
--to=hch@infradead.org \
--cc=bfields@fieldses.org \
--cc=linux-nfs@vger.kernel.org \
--cc=trond.myklebust@primarydata.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;
as well as URLs for NNTP newsgroup(s).