public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] add check do_direct_IO() return val
@ 2007-07-26  9:04 Joe Jin
  2007-07-27  5:13 ` Andrew Morton
  2007-07-27  5:13 ` wengang wang
  0 siblings, 2 replies; 31+ messages in thread
From: Joe Jin @ 2007-07-26  9:04 UTC (permalink / raw)
  To: akpm, torvalds, jens.axboe
  Cc: linux-kernel, gurudas.pai, wen.gang.wang, joe.jin

This is the patch for check do_direct_IO() return val.

At do_direct_IO(), sometimes dio_get_page() will return -EFAULT/-ENOMEM,
according to orig source, it will go on left work. buf for dio_get_page()
return a error will made many useful member of dio not initialized like
dio->map_bh and others, at this point, kernel will panic.

Signed-off-by: Joe Jin <joe.jin@oracle.com>


---
--- linux-2.6.22/fs/direct-io.c.orig	2007-07-26 11:32:27.000000000 +0800
+++ linux-2.6.22/fs/direct-io.c	2007-07-26 11:33:58.000000000 +0800
@@ -1031,7 +1031,9 @@ direct_io_worker(int rw, struct kiocb *i
 			((dio->final_block_in_request - dio->block_in_file) <<
 					blkbits);
 
-		if (ret) {
+		if (ret == -EFAULT || ret == -ENOMEM) 
+			goto out;
+		else if (ret) {
 			dio_cleanup(dio);
 			break;
 		}
@@ -1113,6 +1115,7 @@ direct_io_worker(int rw, struct kiocb *i
 	} else
 		BUG_ON(ret != -EIOCBQUEUED);
 
+out:
 	return ret;
 }
 

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

end of thread, other threads:[~2007-08-01 11:41 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-26  9:04 [PATCH] add check do_direct_IO() return val Joe Jin
2007-07-27  5:13 ` Andrew Morton
2007-07-27  7:15   ` Joe Jin
2007-07-27  7:31     ` Dave Young
2007-07-27  7:44       ` Joe Jin
2007-07-27 12:37     ` gurudas pai
2007-07-28  3:47       ` Joe Jin
2007-07-30 20:53         ` Andrew Morton
2007-07-30 21:09           ` Zach Brown
2007-07-30 21:24           ` Badari Pulavarty
2007-07-30 21:45             ` Zach Brown
2007-07-30 21:58               ` Badari Pulavarty
2007-07-30 21:58                 ` Zach Brown
2007-07-30 23:38                 ` Zach Brown
2007-07-31  0:15                   ` Badari Pulavarty
2007-07-31  0:17                   ` Badari Pulavarty
2007-07-31  0:53                   ` Joe Jin
2007-07-31  3:45                     ` Badari
2007-07-31  4:35                       ` Joe Jin
2007-07-31  5:01                         ` Badari
2007-07-31 22:25                         ` Badari Pulavarty
2007-07-31 22:34                           ` Andrew Morton
2007-07-31 22:59                             ` Linus Torvalds
2007-07-31 23:16                               ` Zach Brown
2007-08-01  1:36                               ` Joe Jin
2007-08-01 11:40                                 ` gurudas pai
2007-07-31 23:04                             ` Badari Pulavarty
2007-07-31 23:14                           ` Zach Brown
2007-08-01  1:11                           ` Joe Jin
2007-07-27  8:09   ` gurudas pai
2007-07-27  5:13 ` wengang wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox