
From: blaisorblade_spam@yahoo.it

Avoid using, in the UBD driver, the elv_queue_empty function.  It's for the
block layer only; in fact, the Anticipatory Scheduler can return NULL with
elv_next_request() even if the queue is not empty, because it waits for the
process to send another request before seeking on the disk.

In fact, if (with uml-ubd-any-elevator) we let UBD use any scheduler,
elevator=as will make the UBD driver Oops, if we don't have this patch.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade_spam@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/arch/um/drivers/ubd_kern.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff -puN arch/um/drivers/ubd_kern.c~uml-avoid-using-elv_queue_empty arch/um/drivers/ubd_kern.c
--- 25/arch/um/drivers/ubd_kern.c~uml-avoid-using-elv_queue_empty	2004-09-06 14:20:37.400490736 -0700
+++ 25-akpm/arch/um/drivers/ubd_kern.c	2004-09-06 14:20:37.404490128 -0700
@@ -1038,8 +1038,7 @@ static void do_ubd_request(request_queue
 	int err, n;
 
 	if(thread_fd == -1){
-		while(!elv_queue_empty(q)){
-			req = elv_next_request(q);
+		while((req = elv_next_request(q)) != NULL){
 			err = prepare_request(req, &io_req);
 			if(!err){
 				do_io(&io_req);
@@ -1048,9 +1047,8 @@ static void do_ubd_request(request_queue
 		}
 	}
 	else {
-		if(do_ubd || elv_queue_empty(q))
+		if(do_ubd || (req = elv_next_request(q)) == NULL)
 			return;
-		req = elv_next_request(q);
 		err = prepare_request(req, &io_req);
 		if(!err){
 			do_ubd = ubd_handler;
_
