ceph: fix memory leak in async readpages
PATCH 1/1 ceph: fix memory leak in async readpages
The finish_read callback introduced in 63c90314546c1cec1f220f6ab24ea fails to release the page list allocated in start_read.
--- fs/ceph/addr.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
fs/ceph/addr.c +1 -0
@@ -261,6 +261,7 @@ static void finish_read(struct ceph_osd_request *req, struct ceph_msg *msg)unlock_page (page);page_cache_release (page); } +kfree (req->r_pages); }/*
Signature · 1 line
1.7.4.1
Can I add your Signed-off-by: on that?
I'll send this upstream with the other patches so it'll hopefully make 3.1...
Thanks!
sage
Quoted 26 lines · David Flynn
The
finish_readcallback introduced in63c90314546c1cec1f220f6ab24eafails to release the page list allocated instart_read.--- fs/ceph/addr.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)fs/ceph/addr.c +1
-0@@ -261,6 +261,7 @@ static void finish_read(struct ceph_osd_request *req, struct ceph_msg *msg)unlock_page (page);page_cache_release (page); } +kfree (req->r_pages); }/* Signature · 5 lines
1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 2 lines · Sage Weil
I'll send this upstream with the other patches so it'll hopefully make 3.1...
Er, not really.. this'll go upstream during the next merge window, along with the readahead code. :)
sage
Quoted 39 lines
Thanks!
sageQuoted 26 lines · David Flynn
The
finish_readcallback introduced in63c90314546c1cec1f220f6ab24eafails to release the page list allocated instart_read.--- fs/ceph/addr.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)fs/ceph/addr.c +1
-0@@ -261,6 +261,7 @@ static void finish_read(struct ceph_osd_request *req, struct ceph_msg *msg)unlock_page (page);page_cache_release (page); } +kfree (req->r_pages); }/* Signature · 5 lines
1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi ,
start_read() do twice "kfree(pages)",
................
out_pages:
ceph_release_page_vector(pages, nr_pages);
kfree(pages);ceph_release_page_vector had kfree pages, continue to do kfree(pages), sometimes ,async read ,printk "BUG kmalloc-16: Object already free" ,then OOPS.
Jeff Wu
----------------------------------------------------------------------
void ceph_release_page_vector(struct page **pages, int num_pages)
{
int i;
for (i = 0; i < num_pages; i++)
__free_pages(pages[i], 0);
kfree(pages);
}$ git diff
fs/ceph/addr.c +0 -0
@@ -345,7 +345,6 @@ static int start_read(struct inode *inode, struct
list_head *page_list, int max)
out_pages:
ceph_release_page_vector(pages, nr_pages);
- kfree(pages);
out:
ceph_osdc_put_request(req);
return ret;Quoted 53 lines · Sage Weil
Quoted 2 lines · Sage Weil
I'll send this upstream with the other patches so it'll hopefully make 3.1...
Er, not really.. this'll go upstream during the next merge window, along with the readahead code. :)
sage
Quoted 24 lines
Thanks!
sageQuoted 17 lines · David Flynn
The
finish_readcallback introduced in63c90314546c1cec1f220f6ab24eafails to release the page list allocated instart_read.--- fs/ceph/addr.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)fs/ceph/addr.c +1
-0@@ -261,6 +261,7 @@ static void finish_read(struct ceph_osd_request *req, struct ceph_msg *msg)unlock_page (page);page_cache_release (page); } +kfree (req->r_pages); }Quoted 15 lines
Quoted 9 lines
fs/ceph/addr.c +0
-0/* Signature · 5 lines
1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Thanks, Jeff!
Was there a workload that reliably triggered this case?
sage
Quoted 104 lines · Jeff Wu
Hi ,
start_read()do twice "kfree(pages)",................
out_pages:ceph_release_page_vector(pages, nr_pages); kfree(pages);
ceph_release_page_vectorhad kfree pages, continue to do kfree(pages), sometimes ,async read ,printk "BUG kmalloc-16: Object already free" ,then OOPS.Jeff Wu
----------------------------------------------------------------------
voidceph_release_page_vector(struct page **pages, int num_pages){ int i; for (i = 0; i < num_pages; i++) __free_pages(pages[i], 0); kfree(pages); }$ git difffs/ceph/addr.c +0
-1@@ -345,7 +345,6 @@ static int start_read(struct inode *inode, struct list_head *page_list, int max) out_pages:ceph_release_page_vector (pages ,nr_pages ); -kfree (pages); out:ceph_osdc_put_request (req);return ret;Quoted 49 lines · Sage Weil
Quoted 2 lines · Sage Weil
I'll send this upstream with the other patches so it'll hopefully make 3.1...
Er, not really.. this'll go upstream during the next merge window, along with the readahead code. :)
sage
Quoted 24 lines
Thanks!
sageQuoted 17 lines · David Flynn
The
finish_readcallback introduced in63c90314546c1cec1f220f6ab24eafails to release the page list allocated instart_read.--- fs/ceph/addr.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)fs/ceph/addr.c +1
-0@@ -261,6 +261,7 @@ static void finish_read(struct ceph_osd_request *req, struct ceph_msg *msg)unlock_page (page);page_cache_release (page); } +kfree (req->r_pages); }Quoted 15 lines
Quoted 9 lines
fs/ceph/addr.c +0
-0/* Signature · 5 lines
1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.htmlQuoted 4 lines
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi ,
take the following steps:
$mount -t ceph monip:6789:/ /mnt/ceph
$dd if=/dev/zero of=/mnt/ceph/2G bs=1M count=2048 conv=fsync
----------------copy_test:
#!/bin/bash
cp /mnt/ceph/2G /mnt/$1/
------------------
$copy_test 01 &
$copy_test 02 &
$copy_test 03 &
$copy_test 04 &
$copy_test 05 &
$copy_test 06 &
$copy_test 07 &
$copy_test 08 &
$copy_test 09 &
Jeff
Quoted 113 lines · Sage Weil
Thanks, Jeff!
Was there a workload that reliably triggered this case?
sage
Quoted 104 lines · Jeff Wu
Hi ,
start_read()do twice "kfree(pages)",................
out_pages:ceph_release_page_vector(pages, nr_pages); kfree(pages);
ceph_release_page_vectorhad kfree pages, continue to do kfree(pages), sometimes ,async read ,printk "BUG kmalloc-16: Object already free" ,then OOPS.Jeff Wu
----------------------------------------------------------------------
voidceph_release_page_vector(struct page **pages, int num_pages){ int i; for (i = 0; i < num_pages; i++) __free_pages(pages[i], 0); kfree(pages); }$ git difffs/ceph/addr.c +0
-1@@ -345,7 +345,6 @@ static int start_read(struct inode *inode, struct list_head *page_list, int max) out_pages:ceph_release_page_vector (pages ,nr_pages ); -kfree (pages); out:ceph_osdc_put_request (req);return ret;Quoted 49 lines · Sage Weil
Quoted 2 lines · Sage Weil
I'll send this upstream with the other patches so it'll hopefully make 3.1...
Er, not really.. this'll go upstream during the next merge window, along with the readahead code. :)
sage
Quoted 24 lines
Thanks!
sageQuoted 17 lines · David Flynn
The
finish_readcallback introduced in63c90314546c1cec1f220f6ab24eafails to release the page list allocated instart_read.--- fs/ceph/addr.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)fs/ceph/addr.c +1
-0@@ -261,6 +261,7 @@ static void finish_read(struct ceph_osd_request *req, struct ceph_msg *msg)unlock_page (page);page_cache_release (page); } +kfree (req->r_pages); }Quoted 15 lines
Quoted 9 lines
fs/ceph/addr.c +0
-0/* Signature · 5 lines
1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.htmlQuoted 4 lines
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html