From: " J. Bruce Fields" <bfields@citi.umich.edu>
To: Benny Halevy <bhalevy@panasas.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH 4/8] nfsd4: extend the client_lock to cover cl_lru
Date: Fri, 7 May 2010 18:29:27 -0400 [thread overview]
Message-ID: <20100507222926.GN19142@fieldses.org> (raw)
In-Reply-To: <1273013057-32460-1-git-send-email-bhalevy@panasas.com>
On Wed, May 05, 2010 at 01:44:17AM +0300, Benny Halevy wrote:
> @@ -2557,6 +2562,7 @@ nfs4_laundromat(void)
> dprintk("NFSD: laundromat service - starting\n");
> if (locks_in_grace())
> nfsd4_end_grace();
> + spin_lock(&client_lock);
> list_for_each_safe(pos, next, &client_lru) {
> clp = list_entry(pos, struct nfs4_client, cl_lru);
> if (time_after((unsigned long)clp->cl_time, (unsigned long)cutoff)) {
> @@ -2565,11 +2571,15 @@ nfs4_laundromat(void)
> clientid_val = t;
> break;
> }
> + list_del_init(&clp->cl_lru);
> + spin_unlock(&client_lock);
> dprintk("NFSD: purging unused client (clientid %08x)\n",
> clp->cl_clientid.cl_id);
> nfsd4_remove_clid_dir(clp);
> expire_client(clp);
> + spin_lock(&client_lock);
> }
> + spin_unlock(&client_lock);
> INIT_LIST_HEAD(&reaplist);
> spin_lock(&recall_lock);
> list_for_each_safe(pos, next, &del_recall_lru) {
Careful--the list_for_each_safe() isn't enough to handle the results of
concurrent modifications that might occur while the client_lock is
dropped.
Maybe just use the trick of moving everything to a temporary list, then
doing the real work on that list after dropping the lock?
--b.
next prev parent reply other threads:[~2010-05-07 22:29 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-04 22:37 [PATCH 0/8] nfsd4: keep the client from expiring while in use by nfs41 compounds Benny Halevy
2010-05-04 22:43 ` [PATCH 1/8] nfsd4: rename sessionid_lock to client_lock Benny Halevy
2010-05-04 22:43 ` [PATCH 2/8] nfsd4: fold release_session into expire_client Benny Halevy
2010-05-04 22:44 ` [PATCH 3/8] nfsd4: use list_move in move_to_confirmed Benny Halevy
2010-05-04 22:44 ` [PATCH 4/8] nfsd4: extend the client_lock to cover cl_lru Benny Halevy
2010-05-07 22:29 ` J. Bruce Fields [this message]
2010-05-09 6:18 ` Benny Halevy
2010-05-04 22:44 ` [PATCH 5/8] nfsd4: refactor expire_client Benny Halevy
2010-05-04 22:44 ` [PATCH 6/8] nfsd4: introduce nfs4_client.cl_refcount Benny Halevy
2010-05-04 22:44 ` [PATCH 7/8] nfsd4: keep a reference count on client while in use Benny Halevy
2010-05-04 22:45 ` [PATCH 8/8] nfsd41: cstate->session can NULL in nfsd4_destroy_session Benny Halevy
2010-05-07 22:38 ` [PATCH 0/8] nfsd4: keep the client from expiring while in use by nfs41 compounds J. Bruce Fields
2010-05-09 6:30 ` Benny Halevy
2010-05-09 16:55 ` J. Bruce Fields
2010-05-10 14:15 ` Benny Halevy
2010-05-10 19:01 ` J. Bruce Fields
2010-05-11 7:27 ` Benny Halevy
2010-05-11 14:39 ` J. Bruce Fields
2010-05-11 16:05 ` J. Bruce Fields
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=20100507222926.GN19142@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox