diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2015-01-10 17:18:37 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-01-25 23:17:27 -0500 |
commit | 3b994d98a815d934ab6a77a380882865982c14f9 (patch) | |
tree | c837ebe22ac4427a23ba87ee019e1ed2832bb99a /kernel/acct.c | |
parent | 34cece2e8a1d2b66f00e153a19b80b4d4cec4eb8 (diff) | |
download | linux-3b994d98a815d934ab6a77a380882865982c14f9.tar.bz2 |
get rid of the second argument of acct_kill()
Replace the old ns->bacct only with NULL and only if it still points
to acct. And assign the new value to it *before* calling acct_kill()
in acct_on(). That way we don't need to pass the new acct to acct_kill().
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'kernel/acct.c')
-rw-r--r-- | kernel/acct.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/kernel/acct.c b/kernel/acct.c index b8fbefb8678f..cf6588ab517b 100644 --- a/kernel/acct.c +++ b/kernel/acct.c @@ -168,8 +168,7 @@ static void close_work(struct work_struct *work) complete(&acct->done); } -static void acct_kill(struct bsd_acct_struct *acct, - struct bsd_acct_struct *new) +static void acct_kill(struct bsd_acct_struct *acct) { if (acct) { struct pid_namespace *ns = acct->ns; @@ -179,7 +178,7 @@ static void acct_kill(struct bsd_acct_struct *acct, schedule_work(&acct->work); wait_for_completion(&acct->done); pin_remove(&acct->pin); - ns->bacct = new; + cmpxchg(&ns->bacct, acct, NULL); acct->ns = NULL; atomic_long_dec(&acct->count); mutex_unlock(&acct->lock); @@ -203,7 +202,7 @@ static void acct_pin_kill(struct fs_pin *pin) acct_put(acct); acct = NULL; } - acct_kill(acct, NULL); + acct_kill(acct); } static int acct_on(struct filename *pathname) @@ -262,10 +261,8 @@ static int acct_on(struct filename *pathname) pin_insert(&acct->pin, mnt); old = acct_get(ns); - if (old) - acct_kill(old, acct); - else - ns->bacct = acct; + ns->bacct = acct; + acct_kill(old); mutex_unlock(&acct->lock); mnt_drop_write(mnt); mntput(mnt); @@ -302,7 +299,7 @@ SYSCALL_DEFINE1(acct, const char __user *, name) mutex_unlock(&acct_on_mutex); putname(tmp); } else { - acct_kill(acct_get(task_active_pid_ns(current)), NULL); + acct_kill(acct_get(task_active_pid_ns(current))); } return error; @@ -310,7 +307,7 @@ SYSCALL_DEFINE1(acct, const char __user *, name) void acct_exit_ns(struct pid_namespace *ns) { - acct_kill(acct_get(ns), NULL); + acct_kill(acct_get(ns)); } /* |