All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] use mod_timer in scsi_add_timer
@ 2003-08-31 11:28 Christoph Hellwig
  2003-08-31 12:51 ` Alan Cox
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2003-08-31 11:28 UTC (permalink / raw)
  To: James Bottomley; +Cc: linux-scsi

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);
 }
 
 /**

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-08-31 13:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-08-31 11:28 [PATCH] use mod_timer in scsi_add_timer Christoph Hellwig
2003-08-31 12:51 ` Alan Cox
2003-08-31 12:53   ` Christoph Hellwig
2003-08-31 13:24     ` Alan Cox

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.