linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org, dchinner@redhat.com,
	Jan Kara <jack@suse.cz>
Subject: [PATCH 2/3] fs: Fix hang with BSD accounting on frozen filesystem
Date: Mon, 12 Nov 2012 12:17:51 +0100	[thread overview]
Message-ID: <1352719072-32274-2-git-send-email-jack@suse.cz> (raw)
In-Reply-To: <1352719072-32274-1-git-send-email-jack@suse.cz>

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.

Reported-and-tested-by: Nikola Ciprich <nikola.ciprich@linuxbox.cz>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
 kernel/acct.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/kernel/acct.c b/kernel/acct.c
index 051e071..a061116 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);
 
-- 
1.7.1


  reply	other threads:[~2012-11-12 11:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-12 11:17 [PATCH 1/3] fs: Return EAGAIN when O_NONBLOCK write should block on frozen fs Jan Kara
2012-11-12 11:17 ` Jan Kara [this message]
2012-11-12 11:17 ` [PATCH 3/3] ocfs2: Add freeze protection to ocfs2_file_splice_write() Jan Kara
2012-11-12 14:03 ` [PATCH 1/3] fs: Return EAGAIN when O_NONBLOCK write should block on frozen fs Jan Kara
2012-11-12 23:37 ` Dave Chinner
2012-12-05 13:36 ` Jan Kara
  -- strict thread matches above, loose matches on Subject: below --
2012-12-22  1:07 [PATCH 0/3 RESEND] Fix hang with BSD process accounting and fs freezing Jan Kara
2012-12-22  1:07 ` [PATCH 2/3] fs: Fix hang with BSD accounting on frozen filesystem Jan Kara
2013-02-07 14:52 [PATCH 0/3 RESEND] Fix hang of " Jan Kara
2013-02-07 14:52 ` [PATCH 2/3] fs: Fix hang with " Jan Kara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1352719072-32274-2-git-send-email-jack@suse.cz \
    --to=jack@suse.cz \
    --cc=dchinner@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=viro@ZenIV.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).