From: Jan Kara Date: Tue, 26 Mar 2013 23:24:15 +0000 (+1100) Subject: fs: fix hang with BSD accounting on frozen filesystem X-Git-Tag: next-20130404~3^2~468 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=7e92c3bdbe288cd05e1cb4030dccc74ea1ecb815;p=karo-tx-linux.git 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 Reported-by: Nikola Ciprich Tested-by: Nikola Ciprich Reviewed-by: Dave Chinner Cc: Al Viro Cc: Joel Becker Cc: Mark Fasheh Cc: Marco Stornelli Signed-off-by: Andrew Morton --- diff --git a/kernel/acct.c b/kernel/acct.c index 85389fe2abd0..b714d76288b9 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);