public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pavel Emelyanov <xemul@openvz.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Oleg Nesterov <oleg@tv-sign.ru>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 0/10] Make bsd process accounting work in pid namespaces
Date: Fri, 16 May 2008 14:16:08 +0400	[thread overview]
Message-ID: <482D5EE8.6050207@openvz.org> (raw)
In-Reply-To: <20080515194304.31309426.akpm@linux-foundation.org>

Andrew Morton wrote:
> On Thu, 15 May 2008 14:52:46 +0400 Pavel Emelyanov <xemul@openvz.org> wrote:
> 
>> fter I fixed access to task->tgid in kernel/acct.c, Oleg 
>> pointed out some bad side effects with this accounting vs pid 
>> namespaces interaction. I.e. when some task in pid namespace 
>> sets this accounting up, this blocks all the others from doing 
>> the same. Restricting this to init namespace only could help, 
>> but didn't look as a grace solution.
>>
>> So here is the approach to make this accounting work with pid
>> namespaces properly.
> 
> We still have this silliness in acct_file_reopen():
> 
> 		spin_unlock(&acct_lock);
> 		do_acct_process(acct, old_ns, old_acct);
> 		filp_close(old_acct, NULL);
> 		spin_lock(&acct_lock);
> 
> Was this lock-dropping safe before?
> 
> Is it safe now?

Yup :)

> To work this out, we'd need to know what acct_lock protects.  What does
> acct_lock protect?

It protected the acct_glbls state before this set. This re-lock was OK 
before wrt. acct_glbls members and still such now.

After the set it still does so and (!) also protects the list of those
bsd_acct_struct-s, that have a file opened.

So, as far as the list is concerned. There are two places, that walk this
list under this lock and call acct_file_reopen - the acct_auto_close and the
acct_auto_close_mnt - both perform "goto restart" to start the iteration
from the very beginning, so this re-lock doesn't affect this list integrity.
List modifications (add/del) always happen under this lock.


Thanks,
Pavel

  reply	other threads:[~2008-05-16 10:19 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-15 10:52 [PATCH 0/10] Make bsd process accounting work in pid namespaces Pavel Emelyanov
2008-05-15 10:54 ` [PATCH 1/10] Bsdacct: rename acct_blbls to bsd_acct_struct Pavel Emelyanov
2008-05-15 10:56 ` [PATCH 2/10] Pidns: use kzalloc when allocating new pid_namespace struct Pavel Emelyanov
2008-05-15 10:58 ` [PATCH 3/10] Pidns: add the struct bsd_acct_struct pointer on " Pavel Emelyanov
2008-05-15 11:00 ` [PATCH 4/10] Bsdacct: "truthify" a comment near acct_process Pavel Emelyanov
2008-05-15 11:02 ` [PATCH 5/10] Bsdacct: make check timer accept a bsd_acct_struct argument Pavel Emelyanov
2008-05-15 11:04 ` [PATCH 6/10] Bsdacct: turn the acct_lock from on-the-struct to global Pavel Emelyanov
2008-05-15 11:07 ` [PATCH 7/10] Bsdacct: make internal code work with passed bsd_acct_struct, not global Pavel Emelyanov
2008-05-15 11:08 ` [PATCH 8/10] Bsdacct: switch from global bsd_acct_struct instance to per-pidns one Pavel Emelyanov
2008-05-15 11:10 ` [PATCH 9/10] Bsdacct: turn acct off for all pidns-s on umount time Pavel Emelyanov
2008-05-15 11:11 ` [PATCH 10/10] Bsdacct: account dying tasks in all relevant namespaces Pavel Emelyanov
2008-05-16  2:44   ` Andrew Morton
2008-05-16 10:11     ` Pavel Emelyanov
2008-05-16 10:33       ` Andrew Morton
2008-05-16  2:43 ` [PATCH 0/10] Make bsd process accounting work in pid namespaces Andrew Morton
2008-05-16 10:16   ` Pavel Emelyanov [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-04-10  8:40 Pavel Emelyanov

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=482D5EE8.6050207@openvz.org \
    --to=xemul@openvz.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@tv-sign.ru \
    /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