aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fuse/dev.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/fuse/dev.c')
-rw-r--r--fs/fuse/dev.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 6c740f860665..d4efb6223e2c 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -120,20 +120,14 @@ void fuse_put_request(struct fuse_conn *fc, struct fuse_req *req)
120 } 120 }
121} 121}
122 122
123void fuse_release_background(struct fuse_conn *fc, struct fuse_req *req) 123void fuse_remove_background(struct fuse_conn *fc, struct fuse_req *req)
124{ 124{
125 iput(req->inode); 125 list_del_init(&req->bg_entry);
126 iput(req->inode2);
127 if (req->file)
128 fput(req->file);
129 spin_lock(&fc->lock);
130 list_del(&req->bg_entry);
131 if (fc->num_background == FUSE_MAX_BACKGROUND) { 126 if (fc->num_background == FUSE_MAX_BACKGROUND) {
132 fc->blocked = 0; 127 fc->blocked = 0;
133 wake_up_all(&fc->blocked_waitq); 128 wake_up_all(&fc->blocked_waitq);
134 } 129 }
135 fc->num_background--; 130 fc->num_background--;
136 spin_unlock(&fc->lock);
137} 131}
138 132
139/* 133/*
@@ -163,17 +157,27 @@ static void request_end(struct fuse_conn *fc, struct fuse_req *req)
163 wake_up(&req->waitq); 157 wake_up(&req->waitq);
164 fuse_put_request(fc, req); 158 fuse_put_request(fc, req);
165 } else { 159 } else {
160 struct inode *inode = req->inode;
161 struct inode *inode2 = req->inode2;
162 struct file *file = req->file;
166 void (*end) (struct fuse_conn *, struct fuse_req *) = req->end; 163 void (*end) (struct fuse_conn *, struct fuse_req *) = req->end;
167 req->end = NULL; 164 req->end = NULL;
165 req->inode = NULL;
166 req->inode2 = NULL;
167 req->file = NULL;
168 if (!list_empty(&req->bg_entry))
169 fuse_remove_background(fc, req);
168 spin_unlock(&fc->lock); 170 spin_unlock(&fc->lock);
169 down_read(&fc->sbput_sem); 171
170 if (fc->mounted)
171 fuse_release_background(fc, req);
172 up_read(&fc->sbput_sem);
173 if (end) 172 if (end)
174 end(fc, req); 173 end(fc, req);
175 else 174 else
176 fuse_put_request(fc, req); 175 fuse_put_request(fc, req);
176
177 if (file)
178 fput(file);
179 iput(inode);
180 iput(inode2);
177 } 181 }
178} 182}
179 183