Bug 8220 - do_acct_process is not called from do_exit
Summary: do_acct_process is not called from do_exit
Alias: None
Product: Process Management
Classification: Unclassified
Component: Other (show other bugs)
Hardware: i386 Linux
: P2 high
Assignee: Olaf Kirch
Depends on:
Reported: 2007-03-16 16:08 UTC by Lin Tan
Modified: 2007-11-17 18:57 UTC (History)
1 user (show)

See Also:
Kernel Version:
Tree: Mainline
Regression: ---


Description Lin Tan 2007-03-16 16:08:02 UTC
Hardware Environment: All
Software Environment: All

Problem Description:
The comment above the body of do_acct_process() clearly states that it should
only be called from do_exit(). See the code extract below.
415  This function should only be called from
416  *  do_exit().
417  */
419 /*
420  *  do_acct_process does all actual work. Caller holds the reference to file.
421  */
422 static void do_acct_process(struct file *file)

But in the following call chain, it is called from init, but never from do_exit.
do_acct_process <- acct_file_reopen <-	sys_acct <- acct_auto_close <- sys_acct
<- do_umount <- do_remount_sb <- acct_auto_close <- do_umount	<- sys_umount <-
sys_umount <-	handle_initrd <- handle_initrd	<- initrd_load <- initrd_load	<-
prepare_namespace <- prepare_namespace <- init

Steps to reproduce:
I found this bug using a code checking tool.
Comment 1 Olaf Kirch 2007-03-18 10:14:03 UTC
I think the comment is somewhat ambiguous. It should probably say
"This function should only be called from do_exit() or when switching
to a different output file".

Maybe it originally precded acct_process() - and in that case, it would even
be correct.

Is there any specific reason why you think this qualifies as a bug?
Comment 2 Lin Tan 2007-03-18 18:18:22 UTC
Thanks a lot for the explanation!

This was detected by a static checking tool. As the comment and code mismatch,
it is either a bug or the comment is wrong or imprecise.
In this case, as the comment is not correct, it may confuse and mislead
developers and cause new bugs. I've found bugs caused by reading bad comments.
Comment 3 Ingo Molnar 2007-11-17 18:57:39 UTC
ok, i've fixed the comment and have queued up a patch for upstream.

Note You need to log in before you can comment on or make changes to this bug.