From: Jan Kara <jack@suse.cz>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org,
Nikola Ciprich <nikola.ciprich@linuxbox.cz>,
LKML <linux-kernel@vger.kernel.org>, Jan Kara <jack@suse.cz>
Subject: [PATCH v2] fs: Fix hang with BSD accounting on frozen filesystem
Date: Sat, 4 May 2013 00:11:23 +0200 [thread overview]
Message-ID: <1367619083-8093-1-git-send-email-jack@suse.cz> (raw)
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>
---
kernel/acct.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
Hi Al!
I'm sending an updated fix for BSD process accounting hang. Can you please
merge it? Thanks!
Honza
diff --git a/kernel/acct.c b/kernel/acct.c
index 85389fe..04606cc 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 (!sb_start_write_trylock(file_inode(file)->i_sb))
+ 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);
/*
@@ -555,7 +560,7 @@ static void do_acct_process(struct bsd_acct_struct *acct,
sizeof(acct_t), &file->f_pos);
current->signal->rlim[RLIMIT_FSIZE].rlim_cur = flim;
set_fs(fs);
- file_end_write(file);
+ sb_end_write(file_inode(file)->i_sb);
out:
revert_creds(orig_cred);
}
--
1.7.1
next reply other threads:[~2013-05-03 22:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-03 22:11 Jan Kara [this message]
2013-05-04 18:58 ` [PATCH v2] fs: Fix hang with BSD accounting on frozen filesystem Al Viro
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=1367619083-8093-1-git-send-email-jack@suse.cz \
--to=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nikola.ciprich@linuxbox.cz \
--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).