From: "J. Bruce Fields" <bfields@citi.umich.edu>
To: Benny Halevy <bhalevy@panasas.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH v2 8/9] nfsd4: keep a reference count on client while in use
Date: Thu, 13 May 2010 12:11:49 -0400 [thread overview]
Message-ID: <20100513161149.GA25327@fieldses.org> (raw)
In-Reply-To: <4BEC0E5F.2030608@panasas.com>
On Thu, May 13, 2010 at 05:36:15PM +0300, Benny Halevy wrote:
> On May. 13, 2010, 1:29 +0300, "J. Bruce Fields" <bfields@citi.umich.edu> wrote:
> > Another case:
> >
> > - Two 4.1 compounds arrive, both their sequence operations are
> > processed.
> > - Independently, an exchange_id expires the client.
> > - At this point, the reference count is 2.
> > - One of the original compounds completes. It renews the client
> > (because it hits reference count 1).
>
> and that will be a no-op as the client is marked as expired.
Pfft, apologies, and thanks for setting me straight again. Still, the
existing scheme seems slightly more complicated than necessary.
>
> > - The second of the two original compounds completes. It frees
> > the client.
>
> right
>
> >
> > I guess there's nothing fundamentally wrong with that, but it's a little
> > odd.
> >
> > Wouldn't it be more straightforward to let cl_refcount be a count of the
> > number of outstanding compounds, and make release_session_client do:
> >
> > if cl_refcount >= 0
> > return;
> > if (client_is_expired(clp))
> > free client;
> > else
> > renew client;
> >
> > ?
> >
> > The following works for me. If you don't see any objection, I'll squash
> > this in and push out the result.
>
> No objection, looks good. Thanks!
OK, thanks!
I notice I didn't do exactly what I said I would, though; with the
following change on top I think it's right.
I'll test that and then push out the result.
--b.
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 05ad0ae..84b0fe9 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -765,7 +765,7 @@ expire_client(struct nfs4_client *clp)
list_del(&clp->cl_strhash);
spin_lock(&client_lock);
unhash_client_locked(clp);
- if (atomic_dec_and_test(&clp->cl_refcount))
+ if (atomic_read(&clp->cl_refcount) == 0)
free_client(clp);
spin_unlock(&client_lock);
}
@@ -853,7 +853,7 @@ static struct nfs4_client *create_client(struct xdr_netobj name, char *recdir,
}
memcpy(clp->cl_recdir, recdir, HEXDIR_LEN);
- atomic_set(&clp->cl_refcount, 1);
+ atomic_set(&clp->cl_refcount, 0);
atomic_set(&clp->cl_cb_set, 0);
INIT_LIST_HEAD(&clp->cl_idhash);
INIT_LIST_HEAD(&clp->cl_strhash);
next prev parent reply other threads:[~2010-05-13 16:11 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-11 21:09 [PATCH v2 0/9] nfsd4: keep the client from expiring while in use by nfs41 compounds Benny Halevy
2010-05-11 21:12 ` [PATCH v2 1/9] nfsd4: rename sessionid_lock to client_lock Benny Halevy
2010-05-11 21:12 ` [PATCH v2 2/9] nfsd4: fold release_session into expire_client Benny Halevy
2010-05-11 21:12 ` [PATCH v2 3/9] nfsd4: use list_move in move_to_confirmed Benny Halevy
2010-05-11 21:13 ` [PATCH v2 4/9] nfsd4: extend the client_lock to cover cl_lru Benny Halevy
2010-05-11 21:13 ` [PATCH v2 5/9] nfsd4: refactor expire_client Benny Halevy
2010-05-11 21:13 ` [PATCH v2 6/9] nfsd4: introduce nfs4_client.cl_refcount Benny Halevy
2010-05-11 21:13 ` [PATCH v2 7/9] nfsd4: mark_client_expired Benny Halevy
2010-05-11 21:13 ` [PATCH v2 8/9] nfsd4: keep a reference count on client while in use Benny Halevy
2010-05-12 2:40 ` J. Bruce Fields
2010-05-12 4:26 ` Benny Halevy
2010-05-12 6:19 ` Benny Halevy
2010-05-12 12:26 ` J. Bruce Fields
2010-05-12 22:29 ` J. Bruce Fields
2010-05-12 22:34 ` J. Bruce Fields
2010-05-13 14:36 ` Benny Halevy
2010-05-13 16:11 ` J. Bruce Fields [this message]
2010-05-12 12:23 ` J. Bruce Fields
2010-05-11 21:14 ` [PATCH v2 9/9] nfsd4: nfsd4_destroy_session must set callback client under the state lock 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=20100513161149.GA25327@fieldses.org \
--to=bfields@citi.umich.edu \
--cc=bhalevy@panasas.com \
--cc=linux-nfs@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.