aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2015-01-10 17:18:37 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2015-01-25 23:17:27 -0500
commit3b994d98a815d934ab6a77a380882865982c14f9 (patch)
treec837ebe22ac4427a23ba87ee019e1ed2832bb99a /kernel
parent34cece2e8a1d2b66f00e153a19b80b4d4cec4eb8 (diff)
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')
-rw-r--r--kernel/acct.c17
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)
168 complete(&acct->done); 168 complete(&acct->done);
169} 169}
170 170
171static void acct_kill(struct bsd_acct_struct *acct, 171static void acct_kill(struct bsd_acct_struct *acct)
172 struct bsd_acct_struct *new)
173{ 172{
174 if (acct) { 173 if (acct) {
175 struct pid_namespace *ns = acct->ns; 174 struct pid_namespace *ns = acct->ns;
@@ -179,7 +178,7 @@ static void acct_kill(struct bsd_acct_struct *acct,
179 schedule_work(&acct->work); 178 schedule_work(&acct->work);
180 wait_for_completion(&acct->done); 179 wait_for_completion(&acct->done);
181 pin_remove(&acct->pin); 180 pin_remove(&acct->pin);
182 ns->bacct = new; 181 cmpxchg(&ns->bacct, acct, NULL);
183 acct->ns = NULL; 182 acct->ns = NULL;
184 atomic_long_dec(&acct->count); 183 atomic_long_dec(&acct->count);
185 mutex_unlock(&acct->lock); 184 mutex_unlock(&acct->lock);
@@ -203,7 +202,7 @@ static void acct_pin_kill(struct fs_pin *pin)
203 acct_put(acct); 202 acct_put(acct);
204 acct = NULL; 203 acct = NULL;
205 } 204 }
206 acct_kill(acct, NULL); 205 acct_kill(acct);
207} 206}
208 207
209static int acct_on(struct filename *pathname) 208static int acct_on(struct filename *pathname)
@@ -262,10 +261,8 @@ static int acct_on(struct filename *pathname)
262 pin_insert(&acct->pin, mnt); 261 pin_insert(&acct->pin, mnt);
263 262
264 old = acct_get(ns); 263 old = acct_get(ns);
265 if (old) 264 ns->bacct = acct;
266 acct_kill(old, acct); 265 acct_kill(old);
267 else
268 ns->bacct = acct;
269 mutex_unlock(&acct->lock); 266 mutex_unlock(&acct->lock);
270 mnt_drop_write(mnt); 267 mnt_drop_write(mnt);
271 mntput(mnt); 268 mntput(mnt);
@@ -302,7 +299,7 @@ SYSCALL_DEFINE1(acct, const char __user *, name)
302 mutex_unlock(&acct_on_mutex); 299 mutex_unlock(&acct_on_mutex);
303 putname(tmp); 300 putname(tmp);
304 } else { 301 } else {
305 acct_kill(acct_get(task_active_pid_ns(current)), NULL); 302 acct_kill(acct_get(task_active_pid_ns(current)));
306 } 303 }
307 304
308 return error; 305 return error;
@@ -310,7 +307,7 @@ SYSCALL_DEFINE1(acct, const char __user *, name)
310 307
311void acct_exit_ns(struct pid_namespace *ns) 308void acct_exit_ns(struct pid_namespace *ns)
312{ 309{
313 acct_kill(acct_get(ns), NULL); 310 acct_kill(acct_get(ns));
314} 311}
315 312
316/* 313/*