lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 4 Nov 2008 11:15:32 -0500 (EST)
From:	Alan Stern <stern@...land.harvard.edu>
To:	Jens Axboe <jens.axboe@...cle.com>
cc:	Tejun Heo <tj@...nel.org>,
	Kernel development list <linux-kernel@...r.kernel.org>
Subject: [PATCH 2/2] Block: use round_jiffies_up()

This patch (as1159) changes the timeout routines in the block core to
use round_jiffies_up().  There's no point in rounding the timer
deadline down, since if it expires too early we will have to restart
it.

The patch also removes a redundant test of q->rq_timed_out_fn, and it
sets req->deadline back to 0 when req is removed from the timer list
(to indicate the req is no longer being timed).

Signed-off-by: Alan Stern <stern@...land.harvard.edu>

---

Index: usb-2.6/block/blk-timeout.c
===================================================================
--- usb-2.6.orig/block/blk-timeout.c
+++ usb-2.6/block/blk-timeout.c
@@ -78,13 +78,14 @@ void blk_delete_timer(struct request *re
 	/*
 	 * Nothing to detach
 	 */
-	if (!q->rq_timed_out_fn || !req->deadline)
+	if (!req->deadline)
 		return;
 
 	list_del_init(&req->timeout_list);
 
 	if (list_empty(&q->timeout_list))
 		del_timer(&q->timeout);
+	req->deadline = 0;
 }
 
 static void blk_rq_timed_out(struct request *req)
@@ -142,7 +143,7 @@ void blk_rq_timed_out_timer(unsigned lon
 	}
 
 	if (next_set && !list_empty(&q->timeout_list))
-		mod_timer(&q->timeout, round_jiffies(next));
+		mod_timer(&q->timeout, round_jiffies_up(next));
 
 	spin_unlock_irqrestore(q->queue_lock, flags);
 }
@@ -201,7 +202,7 @@ void blk_add_timer(struct request *req)
 	 * than an existing one, modify the timer. Round to next nearest
 	 * second.
 	 */
-	expiry = round_jiffies(req->deadline);
+	expiry = round_jiffies_up(req->deadline);
 
 	/*
 	 * We use ->deadline == 0 to detect whether a timer was added or

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ