summaryrefslogtreecommitdiffstats
path: root/kernel/acct.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2013-05-04 00:11:23 +0200
committerAl Viro <viro@zeniv.linux.org.uk>2013-05-04 14:57:58 -0400
commit5ae98f1589e076e4b314fc54ae2beac58842ddc2 (patch)
treeea0ea08edbc6f4f0644faca5e8c3a29a68f71c51 /kernel/acct.c
parent9dcc26cf67fb7db7613290e62eeed6c4276c75ce (diff)
downloadlinux-5ae98f1589e076e4b314fc54ae2beac58842ddc2.tar.bz2
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 just skip the write if the filesystem is frozen. Reported-by: Nikola Ciprich <nikola.ciprich@linuxbox.cz> Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'kernel/acct.c')
-rw-r--r--kernel/acct.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/kernel/acct.c b/kernel/acct.c
index 85389fe2abd0..8d6e145138bb 100644
--- a/kernel/acct.c
+++ b/kernel/acct.c
@@ -540,10 +540,15 @@ static void do_acct_process(struct bsd_acct_struct *acct,
ac.ac_swaps = encode_comp_t(0);
/*
+ * Get freeze protection. If the fs is frozen, just skip the write
+ * as we could deadlock the system otherwise.
+ */
+ if (!file_start_write_trylock(file))
+ goto out;
+ /*
* Kernel segment override to datasegment and write it
* to the accounting file.
*/
- file_start_write(file);
fs = get_fs();
set_fs(KERNEL_DS);
/*