
From: Jens Axboe <axboe@suse.de>

->head and ->tail were not initialized in the cleanup path, I'm guessing
this happens if we adjust the read to zero.  Seems best to simply check for
that condition and bail early, instead of initing ->head and tail earlier
and go through the whole path.


Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/fs/direct-io.c |    2 ++
 1 files changed, 2 insertions(+)

diff -puN fs/direct-io.c~dio-handle-eof-fix fs/direct-io.c
--- 25/fs/direct-io.c~dio-handle-eof-fix	2004-10-26 00:49:40.363376432 -0700
+++ 25-akpm/fs/direct-io.c	2004-10-26 00:49:40.367375824 -0700
@@ -987,6 +987,8 @@ direct_io_worker(int rw, struct kiocb *i
 	isize = i_size_read(inode);
 	if (bytes_todo > (isize - offset))
 		bytes_todo = isize - offset;
+	if (!bytes_todo)
+		return 0;
 
 	for (seg = 0; seg < nr_segs && bytes_todo; seg++) {
 		user_addr = (unsigned long)iov[seg].iov_base;
_
