Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: James Bottomley <James.Bottomley@SteelEye.com>
Cc: linux-scsi@vger.kernel.org
Subject: [PATCH] use mod_timer in scsi_add_timer
Date: Sun, 31 Aug 2003 13:28:30 +0200	[thread overview]
Message-ID: <20030831112830.GA19502@lst.de> (raw)

del_timer / modify / add_timer is racy.  mod_timer on not active
timer is fine, though.

Note that eh_timeout handling looks fishy in more places, I'll
audit it.


--- 1.62/drivers/scsi/scsi_error.c	Mon Aug 25 15:37:40 2003
+++ edited/drivers/scsi/scsi_error.c	Thu Aug 28 23:04:57 2003
@@ -105,24 +105,13 @@
 void scsi_add_timer(struct scsi_cmnd *scmd, int timeout,
 		    void (*complete)(struct scsi_cmnd *))
 {
-
-	/*
-	 * If the clock was already running for this command, then
-	 * first delete the timer.  The timer handling code gets rather
-	 * confused if we don't do this.
-	 */
-	if (scmd->eh_timeout.function)
-		del_timer(&scmd->eh_timeout);
-
 	scmd->eh_timeout.data = (unsigned long)scmd;
-	scmd->eh_timeout.expires = jiffies + timeout;
 	scmd->eh_timeout.function = (void (*)(unsigned long)) complete;
+	mod_timer(&scmd->eh_timeout, jiffies + timeout);
 
 	SCSI_LOG_ERROR_RECOVERY(5, printk("%s: scmd: %p, time:"
 					  " %d, (%p)\n", __FUNCTION__,
 					  scmd, timeout, complete));
-
-	add_timer(&scmd->eh_timeout);
 }
 
 /**

             reply	other threads:[~2003-08-31 11:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-31 11:28 Christoph Hellwig [this message]
2003-08-31 12:51 ` [PATCH] use mod_timer in scsi_add_timer Alan Cox
2003-08-31 12:53   ` Christoph Hellwig
2003-08-31 13:24     ` Alan Cox

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=20030831112830.GA19502@lst.de \
    --to=hch@lst.de \
    --cc=James.Bottomley@SteelEye.com \
    --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