From: James Bottomley <James.Bottomley@SteelEye.com>
To: maximilian attems <janitor@sternwelten.at>
Cc: Nishanth Aravamudan <nacc@us.ibm.com>,
"Salyzyn, Mark" <mark_salyzyn@adaptec.com>,
SCSI Mailing List <linux-scsi@vger.kernel.org>
Subject: Re: [patch 08/10] scsi/dpt_i2o: replace schedule_timeout()withmsleep_interruptible()
Date: 24 Oct 2004 10:39:52 -0400 [thread overview]
Message-ID: <1098628798.10908.19.camel@mulgrave> (raw)
In-Reply-To: <20041024140343.GA23059@stro.at>
On Sun, 2004-10-24 at 10:03, maximilian attems wrote:
> this patch seems already applied in 2.6.10-rc1.
> please double check.
I don't think it is. However we're not finished with shaking the
cobwebs out of this routine yet.
This:
set_current_state(TASK_INTERRUPTIBLE);
[...]
if (!timeout)
schedule();
Would sleep forever if timeout were zero because nothing ever seems to
shift the task back into TASK_RUNNING (i.e. wake it up).
Anyway, I think the attached looks to be the best way to fix all the
issues.
James
===== include/linux/delay.h 1.6 vs edited =====
--- 1.6/include/linux/delay.h 2004-09-03 05:08:32 -04:00
+++ edited/include/linux/delay.h 2004-10-24 10:38:09 -04:00
@@ -46,4 +46,12 @@
msleep(seconds * 1000);
}
+static inline unsigned long ssleep_interruptible(unsigned int seconds)
+{
+ unsigned long ret = msleep_interruptible(seconds * 1000);
+ /* Round up to seconds for return (i.e 0.001s remaining
+ * becomes 1s) */
+ return ret/1000 + (ret ? 1 : 0);
+}
+
#endif /* defined(_LINUX_DELAY_H) */
===== drivers/scsi/dpt_i2o.c 1.44 vs edited =====
--- 1.44/drivers/scsi/dpt_i2o.c 2004-07-26 18:03:34 -04:00
+++ edited/drivers/scsi/dpt_i2o.c 2004-10-24 10:34:17 -04:00
@@ -1164,22 +1164,14 @@
spin_unlock(&adpt_wq_i2o_post.lock);
msg[2] |= 0x80000000 | ((u32)wait_data->id);
- timeout *= HZ;
if((status = adpt_i2o_post_this(pHba, msg, len)) == 0){
- set_current_state(TASK_INTERRUPTIBLE);
if(pHba->host)
spin_unlock_irq(pHba->host->host_lock);
- if (!timeout)
- schedule();
- else{
- timeout = schedule_timeout(timeout);
- if (timeout == 0) {
- // I/O issued, but cannot get result in
- // specified time. Freeing resorces is
- // dangerous.
- status = -ETIME;
- }
- schedule_timeout(timeout*HZ);
+ if (ssleep_interruptible(timeout)) {
+ // I/O issued, but cannot get result in
+ // specified time. Freeing resorces is
+ // dangerous.
+ status = -ETIME;
}
if(pHba->host)
spin_lock_irq(pHba->host->host_lock);
next prev parent reply other threads:[~2004-10-24 14:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-21 14:11 [patch 08/10] scsi/dpt_i2o: replace schedule_timeout()withmsleep_interruptible() Salyzyn, Mark
2004-10-22 23:22 ` Nishanth Aravamudan
2004-10-24 14:03 ` maximilian attems
2004-10-24 14:39 ` James Bottomley [this message]
-- strict thread matches above, loose matches on Subject: below --
2004-10-25 11:30 Salyzyn, Mark
2004-10-25 14:19 ` James Bottomley
2004-10-21 13:17 [patch 08/10] scsi/dpt_i2o: replace schedule_timeout() withmsleep_interruptible() Salyzyn, Mark
2004-10-21 13:47 ` James Bottomley
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=1098628798.10908.19.camel@mulgrave \
--to=james.bottomley@steeleye.com \
--cc=janitor@sternwelten.at \
--cc=linux-scsi@vger.kernel.org \
--cc=mark_salyzyn@adaptec.com \
--cc=nacc@us.ibm.com \
/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