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.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 4dc104c0e95d..6c740f860665 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -90,7 +90,17 @@ static void __fuse_put_request(struct fuse_req *req)
90 90
91struct fuse_req *fuse_get_req(struct fuse_conn *fc) 91struct fuse_req *fuse_get_req(struct fuse_conn *fc)
92{ 92{
93 struct fuse_req *req = fuse_request_alloc(); 93 struct fuse_req *req;
94 sigset_t oldset;
95 int err;
96
97 block_sigs(&oldset);
98 err = wait_event_interruptible(fc->blocked_waitq, !fc->blocked);
99 restore_sigs(&oldset);
100 if (err)
101 return ERR_PTR(-EINTR);
102
103 req = fuse_request_alloc();
94 if (!req) 104 if (!req)
95 return ERR_PTR(-ENOMEM); 105 return ERR_PTR(-ENOMEM);
96 106
@@ -118,6 +128,11 @@ void fuse_release_background(struct fuse_conn *fc, struct fuse_req *req)
118 fput(req->file); 128 fput(req->file);
119 spin_lock(&fc->lock); 129 spin_lock(&fc->lock);
120 list_del(&req->bg_entry); 130 list_del(&req->bg_entry);
131 if (fc->num_background == FUSE_MAX_BACKGROUND) {
132 fc->blocked = 0;
133 wake_up_all(&fc->blocked_waitq);
134 }
135 fc->num_background--;
121 spin_unlock(&fc->lock); 136 spin_unlock(&fc->lock);
122} 137}
123 138
@@ -195,6 +210,9 @@ static void background_request(struct fuse_conn *fc, struct fuse_req *req)
195{ 210{
196 req->background = 1; 211 req->background = 1;
197 list_add(&req->bg_entry, &fc->background); 212 list_add(&req->bg_entry, &fc->background);
213 fc->num_background++;
214 if (fc->num_background == FUSE_MAX_BACKGROUND)
215 fc->blocked = 1;
198 if (req->inode) 216 if (req->inode)
199 req->inode = igrab(req->inode); 217 req->inode = igrab(req->inode);
200 if (req->inode2) 218 if (req->inode2)
@@ -288,6 +306,7 @@ void request_send(struct fuse_conn *fc, struct fuse_req *req)
288static void request_send_nowait(struct fuse_conn *fc, struct fuse_req *req) 306static void request_send_nowait(struct fuse_conn *fc, struct fuse_req *req)
289{ 307{
290 spin_lock(&fc->lock); 308 spin_lock(&fc->lock);
309 background_request(fc, req);
291 if (fc->connected) { 310 if (fc->connected) {
292 queue_request(fc, req); 311 queue_request(fc, req);
293 spin_unlock(&fc->lock); 312 spin_unlock(&fc->lock);
@@ -306,9 +325,6 @@ void request_send_noreply(struct fuse_conn *fc, struct fuse_req *req)
306void request_send_background(struct fuse_conn *fc, struct fuse_req *req) 325void request_send_background(struct fuse_conn *fc, struct fuse_req *req)
307{ 326{
308 req->isreply = 1; 327 req->isreply = 1;
309 spin_lock(&fc->lock);
310 background_request(fc, req);
311 spin_unlock(&fc->lock);
312 request_send_nowait(fc, req); 328 request_send_nowait(fc, req);
313} 329}
314 330