Skip to contentSkip to conversation

Fix noop elevator request merging (in current 2.5 bk)

PATCH Oleg Drokin 2 participants 2 messages Sep 8, 2003 Block layer

lore
Share & tools
lore
#0 lore raw

Hello!

This patch is required otherwise in case if elv_try_last_merge returns nonzero, we do not initialise *req, and subsequent BUG_ON() in __make_request() will dies because req is NULL (or is just uninitialised).
This stopped my UBD devices to work, that's how I noticed ;)

Bye,
Oleg

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.1228 -> 1.1229
# drivers/block/noop-iosched.c 1.2 -> 1.3
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/09/08 [email protected] 1.1229
# Fix request merging in noop elevator, preventing a crash in __make_request() # --------------------------------------------
#

drivers/block/noop-iosched.c +3 -1
diff -Nru a/drivers/block/noop-iosched.c b/drivers/block/noop-iosched.c
@@ -24,8 +24,10 @@
 	struct request *__rq;
 	int ret;
 
-	if ((ret = elv_try_last_merge(q, bio)))
+	if ((ret = elv_try_last_merge(q, bio))) {
+		*req = q->last_merge;
 		return ret;
+	}
 
 	while ((entry = entry->prev) != &q->queue_head) {
 		__rq = list_entry_rq(entry);
#1 lore raw
Quoted 7 lines · Oleg Drokin

Hello!

This patch is required otherwise in case if elv_try_last_merge returns nonzero, we do not initialise *req, and subsequent BUG_ON() in __make_request() will dies because req is NULL (or is just uninitialised). This stopped my UBD devices to work, that's how I noticed ;)

Thanks, patch looks good.

Signature · 1 line
Jens Axboe