diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2007-10-17 02:31:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-17 11:43:03 -0400 |
commit | de5e3dec421c44c999071b8f7e0580ad2ade92ae (patch) | |
tree | c327562a78335346704c382c5b220b13c9208589 | |
parent | f92b99b9dccb61760b345baf40ed37f59b91f8af (diff) |
fuse: fix reserved request wake up
Use wake_up_all instead of wake_up in put_reserved_req(), otherwise it is
possible that the right task is not woken up.
Also create a separate reserved_req_waitq in addition to the blocked_waitq,
since they fulfill totally separate functions.
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | fs/fuse/dev.c | 4 | ||||
-rw-r--r-- | fs/fuse/fuse_i.h | 3 | ||||
-rw-r--r-- | fs/fuse/inode.c | 2 |
3 files changed, 7 insertions, 2 deletions
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index ebc36f525eee..9c9e35e42bfd 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c | |||
@@ -129,7 +129,7 @@ static struct fuse_req *get_reserved_req(struct fuse_conn *fc, | |||
129 | struct fuse_file *ff = file->private_data; | 129 | struct fuse_file *ff = file->private_data; |
130 | 130 | ||
131 | do { | 131 | do { |
132 | wait_event(fc->blocked_waitq, ff->reserved_req); | 132 | wait_event(fc->reserved_req_waitq, ff->reserved_req); |
133 | spin_lock(&fc->lock); | 133 | spin_lock(&fc->lock); |
134 | if (ff->reserved_req) { | 134 | if (ff->reserved_req) { |
135 | req = ff->reserved_req; | 135 | req = ff->reserved_req; |
@@ -155,7 +155,7 @@ static void put_reserved_req(struct fuse_conn *fc, struct fuse_req *req) | |||
155 | fuse_request_init(req); | 155 | fuse_request_init(req); |
156 | BUG_ON(ff->reserved_req); | 156 | BUG_ON(ff->reserved_req); |
157 | ff->reserved_req = req; | 157 | ff->reserved_req = req; |
158 | wake_up(&fc->blocked_waitq); | 158 | wake_up_all(&fc->reserved_req_waitq); |
159 | spin_unlock(&fc->lock); | 159 | spin_unlock(&fc->lock); |
160 | fput(file); | 160 | fput(file); |
161 | } | 161 | } |
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index 9f4603beb9e8..95bcb433d1b4 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h | |||
@@ -289,6 +289,9 @@ struct fuse_conn { | |||
289 | /** waitq for blocked connection */ | 289 | /** waitq for blocked connection */ |
290 | wait_queue_head_t blocked_waitq; | 290 | wait_queue_head_t blocked_waitq; |
291 | 291 | ||
292 | /** waitq for reserved requests */ | ||
293 | wait_queue_head_t reserved_req_waitq; | ||
294 | |||
292 | /** The next unique request id */ | 295 | /** The next unique request id */ |
293 | u64 reqctr; | 296 | u64 reqctr; |
294 | 297 | ||
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 807988445685..95c8a9738ca7 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c | |||
@@ -232,6 +232,7 @@ static void fuse_put_super(struct super_block *sb) | |||
232 | kill_fasync(&fc->fasync, SIGIO, POLL_IN); | 232 | kill_fasync(&fc->fasync, SIGIO, POLL_IN); |
233 | wake_up_all(&fc->waitq); | 233 | wake_up_all(&fc->waitq); |
234 | wake_up_all(&fc->blocked_waitq); | 234 | wake_up_all(&fc->blocked_waitq); |
235 | wake_up_all(&fc->reserved_req_waitq); | ||
235 | mutex_lock(&fuse_mutex); | 236 | mutex_lock(&fuse_mutex); |
236 | list_del(&fc->entry); | 237 | list_del(&fc->entry); |
237 | fuse_ctl_remove_conn(fc); | 238 | fuse_ctl_remove_conn(fc); |
@@ -410,6 +411,7 @@ static struct fuse_conn *new_conn(void) | |||
410 | atomic_set(&fc->count, 1); | 411 | atomic_set(&fc->count, 1); |
411 | init_waitqueue_head(&fc->waitq); | 412 | init_waitqueue_head(&fc->waitq); |
412 | init_waitqueue_head(&fc->blocked_waitq); | 413 | init_waitqueue_head(&fc->blocked_waitq); |
414 | init_waitqueue_head(&fc->reserved_req_waitq); | ||
413 | INIT_LIST_HEAD(&fc->pending); | 415 | INIT_LIST_HEAD(&fc->pending); |
414 | INIT_LIST_HEAD(&fc->processing); | 416 | INIT_LIST_HEAD(&fc->processing); |
415 | INIT_LIST_HEAD(&fc->io); | 417 | INIT_LIST_HEAD(&fc->io); |