Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 106021
b: refs/heads/master
c: a75d979
h: refs/heads/master
i:
  106019: 3a1792d
v: v3
  • Loading branch information
Pavel Emelyanov authored and Linus Torvalds committed Jul 25, 2008
1 parent ec6f4ea commit b4ba5e9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 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: e59a04a7aa5ce2483470aee4f2eb79ba6b9afe8b
refs/heads/master: a75d97976517dcda69150fd81d6be86ae63324a1
42 changes: 21 additions & 21 deletions trunk/kernel/acct.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,16 @@ static void do_acct_process(struct pid_namespace *ns, struct file *);
* the cache line to have the data after getting the lock.
*/
struct bsd_acct_struct {
spinlock_t lock;
volatile int active;
volatile int needcheck;
struct file *file;
struct pid_namespace *ns;
struct timer_list timer;
};

static struct bsd_acct_struct acct_globals __cacheline_aligned =
{__SPIN_LOCK_UNLOCKED(acct_globals.lock)};
static DEFINE_SPINLOCK(acct_lock);

static struct bsd_acct_struct acct_globals __cacheline_aligned;

/*
* Called whenever the timer says to check the free space.
Expand All @@ -114,11 +114,11 @@ static int check_free_space(struct file *file)
sector_t resume;
sector_t suspend;

spin_lock(&acct_globals.lock);
spin_lock(&acct_lock);
res = acct_globals.active;
if (!file || !acct_globals.needcheck)
goto out;
spin_unlock(&acct_globals.lock);
spin_unlock(&acct_lock);

/* May block */
if (vfs_statfs(file->f_path.dentry, &sbuf))
Expand All @@ -140,7 +140,7 @@ static int check_free_space(struct file *file)
* If some joker switched acct_globals.file under us we'ld better be
* silent and _not_ touch anything.
*/
spin_lock(&acct_globals.lock);
spin_lock(&acct_lock);
if (file != acct_globals.file) {
if (act)
res = act>0;
Expand All @@ -165,15 +165,15 @@ static int check_free_space(struct file *file)
add_timer(&acct_globals.timer);
res = acct_globals.active;
out:
spin_unlock(&acct_globals.lock);
spin_unlock(&acct_lock);
return res;
}

/*
* Close the old accounting file (if currently open) and then replace
* it with file (if non-NULL).
*
* NOTE: acct_globals.lock MUST be held on entry and exit.
* NOTE: acct_lock MUST be held on entry and exit.
*/
static void acct_file_reopen(struct file *file)
{
Expand Down Expand Up @@ -201,11 +201,11 @@ static void acct_file_reopen(struct file *file)
}
if (old_acct) {
mnt_unpin(old_acct->f_path.mnt);
spin_unlock(&acct_globals.lock);
spin_unlock(&acct_lock);
do_acct_process(old_ns, old_acct);
filp_close(old_acct, NULL);
put_pid_ns(old_ns);
spin_lock(&acct_globals.lock);
spin_lock(&acct_lock);
}
}

Expand Down Expand Up @@ -235,10 +235,10 @@ static int acct_on(char *name)
return error;
}

spin_lock(&acct_globals.lock);
spin_lock(&acct_lock);
mnt_pin(file->f_path.mnt);
acct_file_reopen(file);
spin_unlock(&acct_globals.lock);
spin_unlock(&acct_lock);

mntput(file->f_path.mnt); /* it's pinned, now give up active reference */

Expand Down Expand Up @@ -272,9 +272,9 @@ asmlinkage long sys_acct(const char __user *name)
} else {
error = security_acct(NULL);
if (!error) {
spin_lock(&acct_globals.lock);
spin_lock(&acct_lock);
acct_file_reopen(NULL);
spin_unlock(&acct_globals.lock);
spin_unlock(&acct_lock);
}
}
return error;
Expand All @@ -289,10 +289,10 @@ asmlinkage long sys_acct(const char __user *name)
*/
void acct_auto_close_mnt(struct vfsmount *m)
{
spin_lock(&acct_globals.lock);
spin_lock(&acct_lock);
if (acct_globals.file && acct_globals.file->f_path.mnt == m)
acct_file_reopen(NULL);
spin_unlock(&acct_globals.lock);
spin_unlock(&acct_lock);
}

/**
Expand All @@ -304,12 +304,12 @@ void acct_auto_close_mnt(struct vfsmount *m)
*/
void acct_auto_close(struct super_block *sb)
{
spin_lock(&acct_globals.lock);
spin_lock(&acct_lock);
if (acct_globals.file &&
acct_globals.file->f_path.mnt->mnt_sb == sb) {
acct_file_reopen(NULL);
}
spin_unlock(&acct_globals.lock);
spin_unlock(&acct_lock);
}

/*
Expand Down Expand Up @@ -594,15 +594,15 @@ void acct_process(void)
if (!acct_globals.file)
return;

spin_lock(&acct_globals.lock);
spin_lock(&acct_lock);
file = acct_globals.file;
if (unlikely(!file)) {
spin_unlock(&acct_globals.lock);
spin_unlock(&acct_lock);
return;
}
get_file(file);
ns = get_pid_ns(acct_globals.ns);
spin_unlock(&acct_globals.lock);
spin_unlock(&acct_lock);

do_acct_process(ns, file);
fput(file);
Expand Down

0 comments on commit b4ba5e9

Please sign in to comment.