aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2008-11-26 06:03:54 -0500
committerMiklos Szeredi <miklos@szeredi.hu>2008-11-26 06:03:54 -0500
commite9bb09dd6c5b8ec6a971ed6251df5eba3a4c8d3c (patch)
tree5012a2046330c00f41fd65dc20867b01b80eee5d
parent193da6092764ab693da7170c5badbf60d7758c1d (diff)
fuse: don't let fuse_req->end() put the base reference
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>
-rw-r--r--fs/fuse/dev.c5
-rw-r--r--fs/fuse/file.c5
-rw-r--r--fs/fuse/inode.c1
3 files changed, 4 insertions, 7 deletions
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 85a23bb524f7..225388f54ae7 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -293,8 +293,7 @@ static void request_end(struct fuse_conn *fc, struct fuse_req *req)
293 wake_up(&req->waitq); 293 wake_up(&req->waitq);
294 if (end) 294 if (end)
295 end(fc, req); 295 end(fc, req);
296 else 296 fuse_put_request(fc, req);
297 fuse_put_request(fc, req);
298} 297}
299 298
300static void wait_answer_interruptible(struct fuse_conn *fc, 299static void wait_answer_interruptible(struct fuse_conn *fc,
@@ -1006,11 +1005,11 @@ static void end_io_requests(struct fuse_conn *fc)
1006 wake_up(&req->waitq); 1005 wake_up(&req->waitq);
1007 if (end) { 1006 if (end) {
1008 req->end = NULL; 1007 req->end = NULL;
1009 /* The end function will consume this reference */
1010 __fuse_get_request(req); 1008 __fuse_get_request(req);
1011 spin_unlock(&fc->lock); 1009 spin_unlock(&fc->lock);
1012 wait_event(req->waitq, !req->locked); 1010 wait_event(req->waitq, !req->locked);
1013 end(fc, req); 1011 end(fc, req);
1012 fuse_put_request(fc, req);
1014 spin_lock(&fc->lock); 1013 spin_lock(&fc->lock);
1015 } 1014 }
1016 } 1015 }
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 86054f437d1e..617269803913 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -79,7 +79,6 @@ static void fuse_release_end(struct fuse_conn *fc, struct fuse_req *req)
79{ 79{
80 dput(req->misc.release.dentry); 80 dput(req->misc.release.dentry);
81 mntput(req->misc.release.vfsmount); 81 mntput(req->misc.release.vfsmount);
82 fuse_put_request(fc, req);
83} 82}
84 83
85static void fuse_file_put(struct fuse_file *ff) 84static void fuse_file_put(struct fuse_file *ff)
@@ -493,7 +492,6 @@ static void fuse_readpages_end(struct fuse_conn *fc, struct fuse_req *req)
493 } 492 }
494 if (req->ff) 493 if (req->ff)
495 fuse_file_put(req->ff); 494 fuse_file_put(req->ff);
496 fuse_put_request(fc, req);
497} 495}
498 496
499static void fuse_send_readpages(struct fuse_req *req, struct file *file, 497static void fuse_send_readpages(struct fuse_req *req, struct file *file,
@@ -513,6 +511,7 @@ static void fuse_send_readpages(struct fuse_req *req, struct file *file,
513 } else { 511 } else {
514 request_send(fc, req); 512 request_send(fc, req);
515 fuse_readpages_end(fc, req); 513 fuse_readpages_end(fc, req);
514 fuse_put_request(fc, req);
516 } 515 }
517} 516}
518 517
@@ -1042,7 +1041,6 @@ static void fuse_writepage_free(struct fuse_conn *fc, struct fuse_req *req)
1042{ 1041{
1043 __free_page(req->pages[0]); 1042 __free_page(req->pages[0]);
1044 fuse_file_put(req->ff); 1043 fuse_file_put(req->ff);
1045 fuse_put_request(fc, req);
1046} 1044}
1047 1045
1048static void fuse_writepage_finish(struct fuse_conn *fc, struct fuse_req *req) 1046static void fuse_writepage_finish(struct fuse_conn *fc, struct fuse_req *req)
@@ -1086,6 +1084,7 @@ static void fuse_send_writepage(struct fuse_conn *fc, struct fuse_req *req)
1086 fuse_writepage_finish(fc, req); 1084 fuse_writepage_finish(fc, req);
1087 spin_unlock(&fc->lock); 1085 spin_unlock(&fc->lock);
1088 fuse_writepage_free(fc, req); 1086 fuse_writepage_free(fc, req);
1087 fuse_put_request(fc, req);
1089 spin_lock(&fc->lock); 1088 spin_lock(&fc->lock);
1090} 1089}
1091 1090
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 739595b4196f..fa474989ec76 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -760,7 +760,6 @@ static void process_init_reply(struct fuse_conn *fc, struct fuse_req *req)
760 fc->max_write = max_t(unsigned, 4096, fc->max_write); 760 fc->max_write = max_t(unsigned, 4096, fc->max_write);
761 fc->conn_init = 1; 761 fc->conn_init = 1;
762 } 762 }
763 fuse_put_request(fc, req);
764 fc->blocked = 0; 763 fc->blocked = 0;
765 wake_up_all(&fc->blocked_waitq); 764 wake_up_all(&fc->blocked_waitq);
766} 765}