Commit e2653bd5 authored by Miklos Szeredi's avatar Miklos Szeredi

fuse: fix leaked aux requests

Auxiliary requests chained on req->misc.write.next may be leaked on
truncate.  Free these as well if the parent request was truncated off.
Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
parent 419234d5
...@@ -1494,6 +1494,7 @@ static void fuse_send_writepage(struct fuse_conn *fc, struct fuse_req *req, ...@@ -1494,6 +1494,7 @@ static void fuse_send_writepage(struct fuse_conn *fc, struct fuse_req *req,
__releases(fc->lock) __releases(fc->lock)
__acquires(fc->lock) __acquires(fc->lock)
{ {
struct fuse_req *aux, *next;
struct fuse_inode *fi = get_fuse_inode(req->inode); struct fuse_inode *fi = get_fuse_inode(req->inode);
struct fuse_write_in *inarg = &req->misc.write.in; struct fuse_write_in *inarg = &req->misc.write.in;
__u64 data_size = req->num_pages * PAGE_SIZE; __u64 data_size = req->num_pages * PAGE_SIZE;
...@@ -1520,6 +1521,15 @@ __acquires(fc->lock) ...@@ -1520,6 +1521,15 @@ __acquires(fc->lock)
out_free: out_free:
fuse_writepage_finish(fc, req); fuse_writepage_finish(fc, req);
spin_unlock(&fc->lock); spin_unlock(&fc->lock);
/* After fuse_writepage_finish() aux request list is private */
for (aux = req->misc.write.next; aux; aux = next) {
next = aux->misc.write.next;
aux->misc.write.next = NULL;
fuse_writepage_free(fc, aux);
fuse_put_request(fc, aux);
}
fuse_writepage_free(fc, req); fuse_writepage_free(fc, req);
fuse_put_request(fc, req); fuse_put_request(fc, req);
spin_lock(&fc->lock); spin_lock(&fc->lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment