mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] 2.6.0-test10 O_DIRECT memory leak fix
@ 2003-11-25 22:49 Badari Pulavarty
  2003-11-26  1:05 ` Andrew Morton
  2003-12-01  7:02 ` IWAMOTO Toshihiro
  0 siblings, 2 replies; 3+ messages in thread
From: Badari Pulavarty @ 2003-11-25 22:49 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 431 bytes --]

Hi Andrew,

I found the problem with O_DIRECT memory leak.

The problem is, when we are doing DIO read and crossed the end of file -
we don't release referencess on all the pages we got from get_user_pages().
(since it is a sucess case).

The fix is to call dio_cleanup() even for sucess cases. Can you please
review this ? I tested the patch with fsstress and there are no memory leak 
problems now.

Thanks,
Badari

[-- Attachment #2: dioleak.patch --]
[-- Type: text/x-diff, Size: 550 bytes --]

--- linux-2.6.0-test10/fs/direct-io.c	2003-11-25 12:45:14.000000000 -0800
+++ linux-2.6.0-test10.new/fs/direct-io.c	2003-11-25 15:20:26.554239616 -0800
@@ -946,6 +946,12 @@ direct_io_worker(int rw, struct kiocb *i
 	if (dio->bio)
 		dio_bio_submit(dio);
 
+	/* 
+	 * It is possible that, we return short IO due to end of file.
+	 * In that case, we need to release all the pages we got hold on.
+	 */ 
+	dio_cleanup(dio);
+
 	/*
 	 * OK, all BIOs are submitted, so we can decrement bio_count to truly
 	 * reflect the number of to-be-processed BIOs.

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

end of thread, other threads:[~2003-12-01  7:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-25 22:49 [PATCH] 2.6.0-test10 O_DIRECT memory leak fix Badari Pulavarty
2003-11-26  1:05 ` Andrew Morton
2003-12-01  7:02 ` IWAMOTO Toshihiro

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

all inboxes | Powered by JetHome®