summaryrefslogtreecommitdiff
path: root/kernel/acct.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2013-02-20 13:13:56 +1100
committerStephen Rothwell <sfr@canb.auug.org.au>2013-02-26 13:41:27 +1100
commitb2ed2cfd812abaafc55bbf13c76fc57188bd593e (patch)
tree610600ffcde6bbdc1720a18796c45c9a4a127572 /kernel/acct.c
parenta7ddd6dd50c8551cd7bec51f33b6ba907ba6d10d (diff)
fs: fix hang with BSD accounting on frozen filesystem
When BSD process accounting is enabled and logs information to a filesystem which gets frozen, system easily becomes unusable because each attempt to account process information blocks. Thus e.g. every task gets blocked in exit. It seems better to drop accounting information (which can already happen when filesystem is running out of space) instead of locking system up. So we open the accounting file with O_NONBLOCK. Signed-off-by: Jan Kara <jack@suse.cz> Reported-by: Nikola Ciprich <nikola.ciprich@linuxbox.cz> Tested-by: Nikola Ciprich <nikola.ciprich@linuxbox.cz> Reviewed-by: Dave Chinner <dchinner@redhat.com> Cc: Al Viro <viro@ZenIV.linux.org.uk> Cc: Joel Becker <jlbec@evilplan.org> Cc: Mark Fasheh <mfasheh@suse.com> Cc: Marco Stornelli <marco.stornelli@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'kernel/acct.c')
-rw-r--r--kernel/acct.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/acct.c b/kernel/acct.c
index b9bd7f098ee5..a370ccb43840 100644
--- a/kernel/acct.c
+++ b/kernel/acct.c
@@ -201,7 +201,8 @@ static int acct_on(struct filename *pathname)
struct bsd_acct_struct *acct = NULL;
/* Difference from BSD - they don't do O_APPEND */
- file = file_open_name(pathname, O_WRONLY|O_APPEND|O_LARGEFILE, 0);
+ file = file_open_name(pathname,
+ O_WRONLY|O_APPEND|O_LARGEFILE|O_NONBLOCK, 0);
if (IS_ERR(file))
return PTR_ERR(file);