summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2009-03-15 22:15:30 +0100
committerSage Weil <sage@newdream.net>2009-03-15 22:15:30 +0100
commitaa1289ba844dba08a0d81130b777436f51627d2e (patch)
tree6472d3a63f800210c40cb70402ca4a7e86377d20
parentvstart: only 1 mds (diff)
downloadceph-aa1289ba844dba08a0d81130b777436f51627d2e.tar.xz
ceph-aa1289ba844dba08a0d81130b777436f51627d2e.zip
kclient: put_page O_DIRECT pages after read or write
We were leaking page refs.
-rw-r--r--src/TODO1
-rw-r--r--src/kernel/file.c13
2 files changed, 11 insertions, 3 deletions
diff --git a/src/TODO b/src/TODO
index cda0f424a5b..28486813d48 100644
--- a/src/TODO
+++ b/src/TODO
@@ -53,7 +53,6 @@ repair
kernel client
-- should O_DIRECT invalidate the page cache?
- inotify for updates from other clients?
- optional or no fill_trace?
- flock, fnctl locks
diff --git a/src/kernel/file.c b/src/kernel/file.c
index 88548d88fd1..2083573973f 100644
--- a/src/kernel/file.c
+++ b/src/kernel/file.c
@@ -232,6 +232,15 @@ fail:
return ERR_PTR(rc);
}
+static void put_page_vector(struct page **pages, int num_pages)
+{
+ int i;
+
+ for (i = 0; i < num_pages; i++)
+ put_page(pages[i]);
+ kfree(pages);
+}
+
static void release_page_vector(struct page **pages, int num_pages)
{
int i;
@@ -388,7 +397,7 @@ more:
}
if (file->f_flags & O_DIRECT)
- kfree(pages);
+ put_page_vector(pages, num_pages);
else
release_page_vector(pages, num_pages);
return ret;
@@ -489,7 +498,7 @@ more:
out:
if (file->f_flags & O_DIRECT)
- kfree(pages);
+ put_page_vector(pages, num_pages);
else
release_page_vector(pages, num_pages);
return ret;