Crash in dec_zone_page_state when nfs_page req is freed
Subsystems (2)
I am seeing a crash in dec_zone_page_state when called from
static void nfs_cancel_commit_list(struct list_head *head)
{
struct nfs_page *req;
while(!list_empty(head)) {
req = nfs_list_entry(head->next);
nfs_list_remove_request(req);
nfs_inode_remove_request(req);
nfs_clear_page_writeback(req);
dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
}
}I see this was somewhat recently added. It appears that nfs_clear_page_writeback has resulted in the req being freed. We are running with CONFIG_SLAB_DEBUG on which poisons memory with repeated 0x6b bytes when freed so the subsequent reference to req results in a bad wb_page pointer.
Is it the expectation that the request will be freed here? If so, should the dec_zone_page_state call be re-ordered, the wb_page pointer saved before calling nfs_clear_page_writeback, or wb_count being incremented and then adding a call to nfs_release_request?
Frank Filz
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
Quoted 15 lines · Frank Filz
I am seeing a crash in
dec_zone_page_statewhen called fromstatic void
nfs_cancel_commit_list(struct list_head *head){ struct nfs_page *req; while(!list_empty(head)) { req = nfs_list_entry(head->next); nfs_list_remove_request(req); nfs_inode_remove_request(req); nfs_clear_page_writeback(req); dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS); } }
Quoted 5 lines
I see this was somewhat recently added. It appears that
nfs_clear_page_writebackhas resulted in the req being freed. We are running withCONFIG_SLAB_DEBUGon which poisons memory with repeated0x6bbytes when freed so the subsequent reference to req results in a badwb_pagepointer.
Does the attached patch fix it for you?
Cheers,
Trond
---
fs/nfs/write.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
fs/nfs/write.c +2 -2
@@ -591,8 +591,8 @@ static void nfs_cancel_commit_list(struc req =nfs_list_entry (head->next);nfs_list_remove_request (req);nfs_inode_remove_request (req); -nfs_clear_page_writeback (req);dec_zone_page_state (req->wb_page,NR_UNSTABLE_NFS ); +nfs_clear_page_writeback (req); } }
@@ -1387,8 +1387,8 @@ nfs_commit_list(struct inode *inode, str req =nfs_list_entry (head->next);nfs_list_remove_request (req);nfs_mark_request_commit (req); -nfs_clear_page_writeback (req);dec_zone_page_state (req->wb_page,NR_UNSTABLE_NFS ); +nfs_clear_page_writeback (req); }return -ENOMEM ; }
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
Quoted 16 lines · Trond Myklebust
Quoted 15 lines · Frank Filz
I am seeing a crash in
dec_zone_page_statewhen called fromstatic void
nfs_cancel_commit_list(struct list_head *head){ struct nfs_page *req; while(!list_empty(head)) { req = nfs_list_entry(head->next); nfs_list_remove_request(req); nfs_inode_remove_request(req); nfs_clear_page_writeback(req); dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS); } }
Quoted 7 lines
Quoted 5 lines
I see this was somewhat recently added. It appears that
nfs_clear_page_writebackhas resulted in the req being freed. We are running withCONFIG_SLAB_DEBUGon which poisons memory with repeated0x6bbytes when freed so the subsequent reference to req results in a badwb_pagepointer.Does the attached patch fix it for you?
I've had a chance to do some testing of this. It turns out that nfs_inode_remove_request() will set wb_page to NULL, so it looks like the call to dec_zone_page_state needs to be moved up before nfs_inode_remove_request(). I'm testing that right now, but I start to wonder exactly what the dec_zone_page_state is doing in this case, I know that was a recent addition.
Frank Filz
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
Quoted 6 lines · Frank Filz
I've had a chance to do some testing of this. It turns out that
nfs_inode_remove_request()will setwb_pageto NULL, so it looks like the call todec_zone_page_stateneeds to be moved up beforenfs_inode_remove_request(). I'm testing that right now, but I start to wonder exactly what thedec_zone_page_stateis doing in this case, I know that was a recent addition.
Yup, that makes sense. Furthermore, it looks like the call to nfs_clear_page_writeback is redundant, since nfs_inode_remove_request will cause the tags to be implicitly cleared.
How does the attached patch work for you?
Cheers,
Trond
Fix two bugs:
- nfs_inode_remove_request will call nfs_clear_request, so we cannot reference req->wb_page after it. Move the call to dec_zone_page_state so that it occurs while req->wb_page is still valid.
- Calling nfs_clear_page_writeback is unnecessary since the radix tree tags will have been cleared by the call to nfs_inode_remove_request. Replace with a simple call to nfs_unlock_request.
---
fs/nfs/write.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
fs/nfs/write.c +2 -2
@@ -588,10 +588,10 @@ static void nfs_cancel_commit_list(strucwhile (!list_empty (head)) { req =nfs_list_entry (head->next); +dec_zone_page_state (req->wb_page,NR_UNSTABLE_NFS );nfs_list_remove_request (req);nfs_inode_remove_request (req); -dec_zone_page_state (req->wb_page,NR_UNSTABLE_NFS ); -nfs_clear_page_writeback (req); +nfs_unlock_request (req); } }
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
Quoted 8 lines · Trond Myklebust
Quoted 6 lines · Frank Filz
I've had a chance to do some testing of this. It turns out that
nfs_inode_remove_request()will setwb_pageto NULL, so it looks like the call todec_zone_page_stateneeds to be moved up beforenfs_inode_remove_request(). I'm testing that right now, but I start to wonder exactly what thedec_zone_page_stateis doing in this case, I know that was a recent addition.
Quoted 5 lines
Yup, that makes sense. Furthermore, it looks like the call to
nfs_clear_page_writebackis redundant, sincenfs_inode_remove_requestwill cause the tags to be implicitly cleared.How does the attached patch work for you?
That did the trick. Thanks.
Frank
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs