mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nikita Danilov <nikita@clusterfs.com>
To: paulmck@us.ibm.com
Cc: andrea@suse.de, shemminger@osdl.org, akpm@osdl.org,
	dipankar@in.ibm.com, rusty@au1.ibm.com, faith@redhat.com,
	riel@redhat.com, ak@suse.de, mjbligh@us.ibm.com, gh@us.ibm.com,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC][Patch] RCU documentation
Date: Wed, 8 Sep 2004 13:36:58 +0400	[thread overview]
Message-ID: <16702.53946.440328.258271@thebsh.namesys.com> (raw)
In-Reply-To: <20040907232855.GA13513@us.ibm.com>

Paul E. McKenney writes:
 > Hello!

Hello Paul,

[...]

 > 
 > +	static inline int audit_upd_rule(struct audit_rule *rule,
 > +					 struct list_head *list,
 > +					 __u32 newaction,
 > +					 __u32 newfield_count)
 > +	{
 > +		struct audit_entry  *e;
 > +		struct audit_newentry *ne;
 > +
 > +		list_for_each_entry(e, list, list) {
 > +			if (!audit_compare_rule(rule, &e->rule)) {
 > +				ne = kmalloc(sizeof(*entry), GFP_ATOMIC);
 > +				if (ne == NULL)
 > +					return _ENOMEM;

-ENOMEM;

 > +				audit_copy_rule(&ne->rule, &e->rule);
 > +				ne->rule.action = newaction;

[...]

 > +	static enum audit_state audit_filter_task(struct task_struct *tsk)
 > +	{
 > +		struct audit_entry *e;
 > +		enum audit_state   state;
 > +
 > +		rcu_read_lock();
 > +		list_for_each_entry_rcu(e, &audit_tsklist, list) {
 > +			if (audit_filter_rules(tsk, &e->rule, NULL, &state)) {
 > +				spin_lock(&e->lock);
 > +				if (e->deleted) {
 > +					spin_unlock(&e->lock);
 > +					rcu_read_unlock();
 > +					return AUDIT_BUILD_CONTEXT;

Shouldn't this be "continue", to work correctly in the face of mutators
similar to audit_upd_rule(), that at some point leave both old (marked
->deleted) and new versions on the list?

Also, RCU used instead of existential lock is so typical, that it
probably deserves dedicated example.

 > +				}

[...]

Nikita.

  parent reply	other threads:[~2004-09-08  9:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-07 23:28 Paul E. McKenney
2004-09-08  0:06 ` David S. Miller
2004-09-08  9:36 ` Nikita Danilov [this message]
2004-09-08 14:37   ` Paul E. McKenney

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=16702.53946.440328.258271@thebsh.namesys.com \
    --to=nikita@clusterfs.com \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=andrea@suse.de \
    --cc=dipankar@in.ibm.com \
    --cc=faith@redhat.com \
    --cc=gh@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjbligh@us.ibm.com \
    --cc=paulmck@us.ibm.com \
    --cc=riel@redhat.com \
    --cc=rusty@au1.ibm.com \
    --cc=shemminger@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

all inboxes | Powered by JetHome®