Skip to content

Commit

Permalink
fuse: don't let fuse_req->end() put the base reference
Browse files Browse the repository at this point in the history
fuse_req->end() was supposed to be put the base reference but there's
no reason why it should.  It only makes things more complex.  Move it
out of ->end() and make it the responsibility of request_end().

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
  • Loading branch information
Tejun Heo authored and Miklos Szeredi committed Nov 26, 2008
1 parent 193da60 commit e9bb09d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
5 changes: 2 additions & 3 deletions fs/fuse/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,7 @@ static void request_end(struct fuse_conn *fc, struct fuse_req *req)
wake_up(&req->waitq);
if (end)
end(fc, req);
else
fuse_put_request(fc, req);
fuse_put_request(fc, req);
}

static void wait_answer_interruptible(struct fuse_conn *fc,
Expand Down Expand Up @@ -1006,11 +1005,11 @@ static void end_io_requests(struct fuse_conn *fc)
wake_up(&req->waitq);
if (end) {
req->end = NULL;
/* The end function will consume this reference */
__fuse_get_request(req);
spin_unlock(&fc->lock);
wait_event(req->waitq, !req->locked);
end(fc, req);
fuse_put_request(fc, req);
spin_lock(&fc->lock);
}
}
Expand Down
5 changes: 2 additions & 3 deletions fs/fuse/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ static void fuse_release_end(struct fuse_conn *fc, struct fuse_req *req)
{
dput(req->misc.release.dentry);
mntput(req->misc.release.vfsmount);
fuse_put_request(fc, req);
}

static void fuse_file_put(struct fuse_file *ff)
Expand Down Expand Up @@ -493,7 +492,6 @@ static void fuse_readpages_end(struct fuse_conn *fc, struct fuse_req *req)
}
if (req->ff)
fuse_file_put(req->ff);
fuse_put_request(fc, req);
}

static void fuse_send_readpages(struct fuse_req *req, struct file *file,
Expand All @@ -513,6 +511,7 @@ static void fuse_send_readpages(struct fuse_req *req, struct file *file,
} else {
request_send(fc, req);
fuse_readpages_end(fc, req);
fuse_put_request(fc, req);
}
}

Expand Down Expand Up @@ -1042,7 +1041,6 @@ static void fuse_writepage_free(struct fuse_conn *fc, struct fuse_req *req)
{
__free_page(req->pages[0]);
fuse_file_put(req->ff);
fuse_put_request(fc, req);
}

static void fuse_writepage_finish(struct fuse_conn *fc, struct fuse_req *req)
Expand Down Expand Up @@ -1086,6 +1084,7 @@ static void fuse_send_writepage(struct fuse_conn *fc, struct fuse_req *req)
fuse_writepage_finish(fc, req);
spin_unlock(&fc->lock);
fuse_writepage_free(fc, req);
fuse_put_request(fc, req);
spin_lock(&fc->lock);
}

Expand Down
1 change: 0 additions & 1 deletion fs/fuse/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,6 @@ static void process_init_reply(struct fuse_conn *fc, struct fuse_req *req)
fc->max_write = max_t(unsigned, 4096, fc->max_write);
fc->conn_init = 1;
}
fuse_put_request(fc, req);
fc->blocked = 0;
wake_up_all(&fc->blocked_waitq);
}
Expand Down

0 comments on commit e9bb09d

Please sign in to comment.