Commit 3b994d98a815d934ab6a77a380882865982c14f9

Authored by Al Viro
1 parent 34cece2e8a

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>

Showing 1 changed file with 7 additions and 10 deletions Side-by-side Diff

... ... @@ -168,8 +168,7 @@
168 168 complete(&acct->done);
169 169 }
170 170  
171   -static void acct_kill(struct bsd_acct_struct *acct,
172   - struct bsd_acct_struct *new)
  171 +static void acct_kill(struct bsd_acct_struct *acct)
173 172 {
174 173 if (acct) {
175 174 struct pid_namespace *ns = acct->ns;
... ... @@ -179,7 +178,7 @@
179 178 schedule_work(&acct->work);
180 179 wait_for_completion(&acct->done);
181 180 pin_remove(&acct->pin);
182   - ns->bacct = new;
  181 + cmpxchg(&ns->bacct, acct, NULL);
183 182 acct->ns = NULL;
184 183 atomic_long_dec(&acct->count);
185 184 mutex_unlock(&acct->lock);
... ... @@ -203,7 +202,7 @@
203 202 acct_put(acct);
204 203 acct = NULL;
205 204 }
206   - acct_kill(acct, NULL);
  205 + acct_kill(acct);
207 206 }
208 207  
209 208 static int acct_on(struct filename *pathname)
... ... @@ -262,10 +261,8 @@
262 261 pin_insert(&acct->pin, mnt);
263 262  
264 263 old = acct_get(ns);
265   - if (old)
266   - acct_kill(old, acct);
267   - else
268   - ns->bacct = acct;
  264 + ns->bacct = acct;
  265 + acct_kill(old);
269 266 mutex_unlock(&acct->lock);
270 267 mnt_drop_write(mnt);
271 268 mntput(mnt);
... ... @@ -302,7 +299,7 @@
302 299 mutex_unlock(&acct_on_mutex);
303 300 putname(tmp);
304 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 305 return error;
... ... @@ -310,7 +307,7 @@
310 307  
311 308 void 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 /*