From: Srivatsa Vaddagiri <vatsa@in.ibm.com>
To: "Paul Menage" <menage@google.com>
Cc: "Paul Jackson" <pj@sgi.com>,
akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
"Balbir Singh" <balbir@in.ibm.com>
Subject: Re: [PATCH] Fix race between attach_task and cpuset_exit
Date: Thu, 5 Apr 2007 13:44:24 +0530 [thread overview]
Message-ID: <20070405081424.GA20356@in.ibm.com> (raw)
In-Reply-To: <6599ad830704050001n50d9fa2bw4167c1fa16aa618f@mail.gmail.com>
On Thu, Apr 05, 2007 at 12:01:53AM -0700, Paul Menage wrote:
> I don't see how that could happen. Assuming we add the
> task_lock()/task_unlock() in cpuset_exit(), then only one of the two
> threads (either cpuset_exit() or attach_task() ) can copy C1 from
> T1->cpuset and replace it with something new, and hence only one of
> them can drop the refcount.
You are correct! We can just add the task_lock()/unlock() in cpuset_exit
and be done away with the races I described.
> >How's that possible? That you have a zero-refcount cpuset with non empty
> >tasks in it?
>
> If this is the last task in cs, then cs->count will be 1. We remove
> this task from cs, and decrement its count to 0. Then another cpu does
> cpuset_rmdir(), takes manage_mutex, sees that the count is 0, cleans
> up the cpuset, drops the dentry, and the cpuset gets freed. Then we
> get to run again, and we dereference an invalid cpuset.
Hmm yes ..I am surprised we arent doing a synhronize_rcu in
cpuset_rmdir() before dropping the dentry. Did you want to send a patch
for that?
attach_task() is ugly ....
--
Regards,
vatsa
next prev parent reply other threads:[~2007-04-05 8:06 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-25 16:47 [PATCH] Fix race between attach_task and cpuset_exit Srivatsa Vaddagiri
2007-03-25 17:52 ` Balbir Singh
2007-03-25 19:54 ` Paul Jackson
2007-03-26 11:50 ` Srivatsa Vaddagiri
2007-03-26 17:58 ` Paul Jackson
2007-03-27 6:35 ` Srivatsa Vaddagiri
2007-03-27 8:45 ` Paul Jackson
2007-03-26 18:30 ` Paul Jackson
2007-03-25 19:50 ` Paul Jackson
2007-03-26 11:55 ` Srivatsa Vaddagiri
2007-04-05 5:55 ` Paul Menage
2007-04-05 7:00 ` Srivatsa Vaddagiri
2007-04-05 7:01 ` Paul Menage
2007-04-05 8:14 ` Srivatsa Vaddagiri [this message]
2007-04-05 8:10 ` Paul Menage
2007-04-10 17:12 ` Srivatsa Vaddagiri
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=20070405081424.GA20356@in.ibm.com \
--to=vatsa@in.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=balbir@in.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=menage@google.com \
--cc=pj@sgi.com \
/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