From: Mark Lord <kernel@teksavvy.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: dgilbert@interlog.com,
Linux Kernel <linux-kernel@vger.kernel.org>,
IDE/ATA development list <linux-ide@vger.kernel.org>,
linux-scsi <linux-scsi@vger.kernel.org>,
Joel Becker <joel.becker@oracle.com>
Subject: [PATCH] block: Prevent hang_check firing during long I/O
Date: Fri, 24 Sep 2010 09:51:13 -0400 [thread overview]
Message-ID: <1285336273.9259.2.camel@corey> (raw)
In-Reply-To: <4C9C6B7D.1060805@kernel.dk>
During long I/O operations, the hang_check timer may fire,
trigger stack dumps that unnecessarily alarm the user.
Eg. hdparm --security-erase NULL /dev/sdb ## can take *hours* to complete
So, if hang_check is armed, we should wake up periodically
to prevent it from triggering. This patch uses a wake-up interval
equal to half the hang_check timer period, which keeps overhead low enough.
Signed-off-by: Mark Lord <mlord@pobox.com>
--- old/block/blk-exec.c 2010-09-20 19:56:53.000000000 -0400
+++ linux/block/blk-exec.c 2010-09-24 09:43:32.342604574 -0400
@@ -80,6 +80,7 @@
DECLARE_COMPLETION_ONSTACK(wait);
char sense[SCSI_SENSE_BUFFERSIZE];
int err = 0;
+ unsigned long hang_check;
/*
* we need an extra reference to the request, so we can look at
@@ -95,7 +96,13 @@
rq->end_io_data = &wait;
blk_execute_rq_nowait(q, bd_disk, rq, at_head, blk_end_sync_rq);
- wait_for_completion(&wait);
+
+ /* Prevent hang_check timer from firing at us during very long I/O */
+ hang_check = sysctl_hung_task_timeout_secs;
+ if (hang_check)
+ while (!wait_for_completion_timeout(&wait, hang_check * (HZ/2)));
+ else
+ wait_for_completion(&wait);
if (rq->errors)
err = -EIO;
next prev parent reply other threads:[~2010-09-24 13:51 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-23 23:41 "blocked for more than 120 secs" --> a valid situation, how to prevent? Mark Lord
2010-09-24 0:05 ` Douglas Gilbert
2010-09-24 2:53 ` Mark Lord
2010-09-24 3:51 ` Mark Lord
2010-09-24 9:12 ` Jens Axboe
2010-09-24 13:51 ` Mark Lord [this message]
2010-09-24 13:52 ` [PATCH] block: Prevent hang_check firing during long I/O Jens Axboe
2010-09-24 4:41 ` "blocked for more than 120 secs" --> a valid situation, how to prevent? Douglas Gilbert
2010-09-24 0:51 ` Stan Hoeppner
2010-09-24 1:37 ` Kyle McMartin
2010-09-24 3:48 ` Stan Hoeppner
2010-09-24 5:02 ` Douglas Gilbert
2010-09-24 5:31 ` Mark Lord
2010-09-24 6:22 ` Stan Hoeppner
2010-09-24 6:30 ` hdparm-9.32 released: recommended upgrade Mark Lord
2010-09-24 1:58 ` "blocked for more than 120 secs" --> a valid situation, how to prevent? Maxim Levitsky
2010-09-24 2:08 ` Kyle McMartin
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=1285336273.9259.2.camel@corey \
--to=kernel@teksavvy.com \
--cc=axboe@kernel.dk \
--cc=dgilbert@interlog.com \
--cc=joel.becker@oracle.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
/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).