public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@us.ibm.com>
To: David Howells <dhowells@redhat.com>
Cc: torvalds@osdl.org, akpm@osdl.org,
	Michael A Halcrow <mahalcro@us.ibm.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] Keys: Use RCU to manage session keyring pointer
Date: Tue, 12 Apr 2005 07:50:38 -0700	[thread overview]
Message-ID: <20050412145038.GC1367@us.ibm.com> (raw)
In-Reply-To: <31445.1113297110@redhat.com>

On Tue, Apr 12, 2005 at 10:11:50AM +0100, David Howells wrote:
> Paul E. McKenney <paulmck@us.ibm.com> wrote:
> 
> > >  	spin_lock_irqsave(&tsk->sighand->siglock, flags);
> > > -	old = tsk->signal->session_keyring;
> > > -	tsk->signal->session_keyring = keyring;
> > > +	old = rcu_dereference(tsk->signal->session_keyring);
> > 
> > I don't understand why rcu_dereference() is needed in this case.
> > Since we are holding the lock, it should not be possible for
> > this to change, right?  Or am I missing something?  (Quite possible,
> > am not all that familiar with this code.)
> 
> Erm... you're right. I stuck the rcu_dereference() in then added the locks
> back in when I realised I still needed them.
> 
> > > +	synchronize_kernel();
> > 
> > This would want to become synchronize_rcu().
> 
> I think the deprecation happened since I wrote my patch.

Yes, sorry, I should have made it clear that this was a change that
affected your code rather than an error on your part.

> > > +	if (tsk->signal->session_keyring) {
> > > +		rcu_read_lock();
> > > +		key = keyring_search_aux(
> > > +			rcu_dereference(tsk->signal->session_keyring),
> > > +			type, description, match);
> > > +		rcu_read_unlock();
> > > +	}
> > > +	else {
> > > +		key = keyring_search_aux(tsk->user->session_keyring,
> > > +					 type, description, match);
> > 
> > This one is constant, right?  If not, I don't understand the locking design.
> 
> Which one? tsk->user->session_keyring is, tsk->signal->session_keyring is not.

Good, that matches the code!

							Thanx, Paul

> Thanks for the review.
> 
> David
> 

  reply	other threads:[~2005-04-12 14:57 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-23 20:14 [PATCH 1/3] Keys: Pass session keyring to call_usermodehelper() David Howells
2005-03-23 20:19 ` [PATCH 2/3] Keys: Use RCU to manage session keyring pointer David Howells
2005-03-23 21:07   ` Andrew Morton
2005-03-23 21:28     ` David Howells
2005-03-23 20:52 ` [PATCH 3/3] Keys: Make request-key create an authorisation key David Howells
2005-03-24 11:41   ` [PATCH 3/3] Keys: Make request-key create an authorisation key [try #2] David Howells
2005-03-31 19:50   ` [PATCH 3/3] Keys: Make request-key create an authorisation key Benoit Boissinot
2005-04-01 15:30     ` [PATCH] Keys: Fix request_key default keyring handling David Howells
2005-03-23 20:55 ` [PATCH 2/3] Keys: Use RCU to manage session keyring pointer David Howells
2005-04-11 22:45   ` Paul E. McKenney
2005-04-12  9:11     ` David Howells
2005-04-12 14:50       ` Paul E. McKenney [this message]
2005-03-23 21:06 ` [PATCH 1/3] Keys: Pass session keyring to call_usermodehelper() Andrew Morton
2005-03-23 21:26   ` David Howells
2005-03-23 22:34     ` Andrew Morton
2005-03-23 22:49       ` David Howells
2005-03-24  0:58       ` Kyle Moffett
2005-03-23 22:25   ` Mike Waychison
2005-03-24 11:38 ` [PATCH 1/3] Keys: Pass session keyring to call_usermodehelper() [try #2] David Howells

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=20050412145038.GC1367@us.ibm.com \
    --to=paulmck@us.ibm.com \
    --cc=akpm@osdl.org \
    --cc=dhowells@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mahalcro@us.ibm.com \
    --cc=torvalds@osdl.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