Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 106024
b: refs/heads/master
c: b5a7174
h: refs/heads/master
v: v3
  • Loading branch information
Pavel Emelyanov authored and Linus Torvalds committed Jul 25, 2008
1 parent 0890c71 commit 15d5819
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0b6b030fc30d169bb406b34b4fc60d99dde4a9c6
refs/heads/master: b5a7174875ea570cc675f2c503e800db8efdd6a7
28 changes: 16 additions & 12 deletions trunk/kernel/acct.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,11 @@ struct bsd_acct_struct {
struct file *file;
struct pid_namespace *ns;
struct timer_list timer;
struct list_head list;
};

static DEFINE_SPINLOCK(acct_lock);
static LIST_HEAD(acct_list);

/*
* Called whenever the timer says to check the free space.
Expand Down Expand Up @@ -188,12 +190,14 @@ static void acct_file_reopen(struct bsd_acct_struct *acct, struct file *file,
acct->needcheck = 0;
acct->file = NULL;
acct->ns = NULL;
list_del(&acct->list);
}
if (file) {
acct->file = file;
acct->ns = ns;
acct->needcheck = 0;
acct->active = 1;
list_add(&acct->list, &acct_list);
/* It's been deleted if it was used before so this is safe */
setup_timer(&acct->timer, acct_timeout, (unsigned long)acct);
acct->timer.expires = jiffies + ACCT_TIMEOUT*HZ;
Expand Down Expand Up @@ -314,13 +318,13 @@ void acct_auto_close_mnt(struct vfsmount *m)
{
struct bsd_acct_struct *acct;

acct = init_pid_ns.bacct;
if (acct == NULL)
return;

spin_lock(&acct_lock);
if (acct->file && acct->file->f_path.mnt == m)
acct_file_reopen(acct, NULL, NULL);
restart:
list_for_each_entry(acct, &acct_list, list)
if (acct->file && acct->file->f_path.mnt == m) {
acct_file_reopen(acct, NULL, NULL);
goto restart;
}
spin_unlock(&acct_lock);
}

Expand All @@ -335,13 +339,13 @@ void acct_auto_close(struct super_block *sb)
{
struct bsd_acct_struct *acct;

acct = init_pid_ns.bacct;
if (acct == NULL)
return;

spin_lock(&acct_lock);
if (acct->file && acct->file->f_path.mnt->mnt_sb == sb)
acct_file_reopen(acct, NULL, NULL);
restart:
list_for_each_entry(acct, &acct_list, list)
if (acct->file && acct->file->f_path.mnt->mnt_sb == sb) {
acct_file_reopen(acct, NULL, NULL);
goto restart;
}
spin_unlock(&acct_lock);
}

Expand Down

0 comments on commit 15d5819

Please sign in to comment.