From: "J. Bruce Fields" <bfields@fieldses.org>
To: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: aglo@citi.umich.edu, kwc@citi.umich.edu, linux-nfs@vger.kernel.org
Subject: Re: [PATCH 2/5] rpc: Use separate spinlock for cred locking in auth_gss.c
Date: Sun, 9 Nov 2008 15:46:21 -0500 [thread overview]
Message-ID: <20081109204621.GD27376@fieldses.org> (raw)
In-Reply-To: <1213738487.7288.66.camel@localhost>
On Tue, Jun 17, 2008 at 05:34:47PM -0400, Trond Myklebust wrote:
> On Tue, 2008-06-17 at 16:51 -0400, J. Bruce Fields wrote:
> > On Sat, Jun 14, 2008 at 02:16:27PM -0400, Trond Myklebust wrote:
> > > On Sat, 2008-06-14 at 13:45 -0400, J. Bruce Fields wrote:
> > > > > NACK. I deliberately ripped out the old struct gss_auth spinlock in
> > > > > order to allow multiple gss_auth per inode (I believe Kevin was asking
> > > > > for this).
> > > >
> > > > OK, makes sense. So what will be the scope of a cred lookup--an rpc
> > > > client?
> > >
> > > That should normally be the case, but why do you need to change the
> > > locking here in the first place? Is there ever going to be a case where
> > > the same rpc_cred has upcalls on several different pipes? I can't see
> > > how that could be justified.
> >
> > If you allow changing the upcall version over the life of the kernel,
> > then it's difficult to avoid. You can insist that noone have both the
> > new and old version opened simultaneously, for example, but it's harder
> > to know when there are no longer messages sitting around that have been
> > unhashed but are still lying around waiting for a process to wake up and
> > examine their results.
>
> AFAIK, there are two cases when the dying rpc.gssd closes the pipe:
>
> 1. gss_cred->gc_upcall is set. In this case, the gss_cred has a
> full reference to the gss_msg, so it has no trouble locating the
> message and figuring out if it needs to resend (rpc_purge_list()
> will ensure that the error field is set to EAGAIN) or if the
> call completed before gssd died. If you are worried about the
> fact that gss_upcall_callback uses gss_msg->auth to access the
> inode in order to do the locking, then just add a pointer to the
> inode to gss_msg: it is not as if a gss_msg can migrate from one
> upcall queue to another.
> 2. gss_cred->gc_upcall is not set. In this case the call to
> rpc_purge_list() in rpc_pipe_release() will ensure that the
> message gets immediately released.
>
> In other words, I can't see that keeping the current behaviour will
> cause you to have more than one upcall at a time even if you do restart
> rpc.gssd.
OK, sorry for the delay. I believe there is still a race here in the
presence of two pipes that take upcalls, something like:
task 1 task 2
------ ------
Create upcall message on
old pipe using refresh_upcall
---- gssd closes old pipe, destroys message ----
---- new gssd opens new pipe ----
close of old pipe wakes up
this rpc task; upcall_callback
called.
gss_refresh__callback creates new
upcall on new pipe for the same cred;
sets gc_upcall.
gc_upcall := NULL
woken up later, upcall_callback
dereferences NULL gc_upcall.
The problem being that access to gc_upcall isn't correctly serialized,
since it's protected here by two different i_lock's (task 1 is using the
old pipe's i_lock, task 2 the new pipe's i_lock).
Anyway, rather than fooling with the basic data structures I figured
it's easiest just to add a separate lock which just controls the change
of version and to forbid changing the version while there are still any
upcalls lying around. I'll send patches.
--b.
next prev parent reply other threads:[~2008-11-09 20:46 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-13 22:50 [RFC] new client gssd upcall J. Bruce Fields
2008-06-13 22:50 ` [PATCH 1/5] rpc: remove unnecessary assignment J. Bruce Fields
2008-06-13 22:50 ` [PATCH 2/5] rpc: Use separate spinlock for cred locking in auth_gss.c J. Bruce Fields
2008-06-13 22:50 ` [PATCH 3/5] rpc: move in_downcall list to gss code J. Bruce Fields
2008-06-13 22:50 ` [PATCH 4/5] rpc: add an rpc_pipe_open method J. Bruce Fields
2008-06-13 22:50 ` [PATCH 5/5] rpc: add new gssd upcall pipe J. Bruce Fields
2008-06-14 16:07 ` Trond Myklebust
2008-06-14 17:36 ` J. Bruce Fields
2008-11-09 20:46 ` J. Bruce Fields
2008-06-14 16:01 ` [PATCH 3/5] rpc: move in_downcall list to gss code Trond Myklebust
2008-06-14 15:58 ` [PATCH 2/5] rpc: Use separate spinlock for cred locking in auth_gss.c Trond Myklebust
2008-06-14 17:45 ` J. Bruce Fields
2008-06-14 18:16 ` Trond Myklebust
2008-06-17 20:51 ` J. Bruce Fields
2008-06-17 21:34 ` Trond Myklebust
2008-06-17 22:06 ` J. Bruce Fields
2008-11-09 20:46 ` J. Bruce Fields [this message]
2008-11-09 21:04 ` text-based gss upcall J. Bruce Fields
2008-11-09 21:04 ` [PATCH 1/9] rpc: remove unnecessary assignment J. Bruce Fields
2008-11-09 21:04 ` [PATCH 2/9] rpc: factor out warning code from gss_pipe_destroy_msg J. Bruce Fields
2008-11-09 21:04 ` [PATCH 3/9] rpc: minor gss_alloc_msg cleanup J. Bruce Fields
2008-11-09 21:04 ` [PATCH 4/9] rpc: add an rpc_pipe_open method J. Bruce Fields
2008-11-09 21:04 ` [PATCH 5/9] rpc: call release_pipe only on last close J. Bruce Fields
2008-11-09 21:04 ` [PATCH 6/9] rpc: track number of users of the gss upcall pipe J. Bruce Fields
2008-11-09 21:04 ` [PATCH 7/9] rpc: use count of pipe openers to wait for first open J. Bruce Fields
2008-11-09 21:04 ` [PATCH 8/9] rpc: store pointer to pipe inode in gss upcall message J. Bruce Fields
2008-11-09 21:04 ` [PATCH 9/9] rpc: implement new upcall J. Bruce Fields
2008-11-10 19:11 ` [PATCH 5/9] rpc: call release_pipe only on last close Trond Myklebust
[not found] ` <1226344297.7599.41.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2008-11-10 19:49 ` J. Bruce Fields
2008-11-10 20:01 ` Trond Myklebust
[not found] ` <1226347279.7599.47.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2008-11-10 20:07 ` J. Bruce Fields
2008-11-10 20:11 ` Trond Myklebust
[not found] ` <1226347898.7599.49.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2008-11-10 20:17 ` J. Bruce Fields
2008-11-10 20:21 ` Trond Myklebust
[not found] ` <1226348515.7599.52.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2008-11-10 20:26 ` J. Bruce Fields
2008-11-10 20:37 ` J. Bruce Fields
2008-11-10 21:18 ` Trond Myklebust
[not found] ` <1226351883.7599.103.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2008-11-10 21:27 ` J. Bruce Fields
2008-11-10 20:35 ` [PATCH 4/9] rpc: add an rpc_pipe_open method Trond Myklebust
[not found] ` <1226349322.7599.59.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2008-11-10 20:37 ` J. Bruce Fields
2008-11-10 21:18 ` J. Bruce Fields
2008-11-10 21:48 ` Trond Myklebust
[not found] ` <1226353722.7599.105.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2008-11-10 21:56 ` J. Bruce Fields
2008-06-16 14:28 ` [RFC] new client gssd upcall Jeff Layton
[not found] ` <20080616102859.66fa6a34-RtJpwOs3+0O+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2008-06-17 21:36 ` J. Bruce Fields
2008-06-17 21:59 ` Trond Myklebust
2008-06-17 22:09 ` J. Bruce Fields
2008-06-18 11:51 ` Jeff Layton
2008-06-19 15:37 ` Olga Kornievskaia
2008-06-19 15:49 ` Jeff Layton
[not found] ` <20080619114929.5c211ec9-RtJpwOs3+0O+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2008-06-19 17:06 ` Trond Myklebust
2008-06-19 17:27 ` Jeff Layton
[not found] ` <20080619132720.6bce2bb9-RtJpwOs3+0O+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2008-06-19 18:13 ` Trond Myklebust
2008-06-19 19:11 ` Jeff Layton
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=20081109204621.GD27376@fieldses.org \
--to=bfields@fieldses.org \
--cc=Trond.Myklebust@netapp.com \
--cc=aglo@citi.umich.edu \
--cc=kwc@citi.umich.edu \
--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.