Commit 5437f241 authored by Miklos Szeredi's avatar Miklos Szeredi

fuse: account as waiting before queuing for background

Move accounting of fc->num_waiting to the point where the request actually
starts waiting.  This is earlier than the current queue_request() for
background requests, since they might be waiting on the fc->bg_queue before
being queued on fc->pending.
Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
Reviewed-by: default avatarAshish Samant <ashish.samant@oracle.com>
parent 73e0e738
...@@ -327,10 +327,6 @@ static void queue_request(struct fuse_conn *fc, struct fuse_req *req) ...@@ -327,10 +327,6 @@ static void queue_request(struct fuse_conn *fc, struct fuse_req *req)
len_args(req->in.numargs, (struct fuse_arg *) req->in.args); len_args(req->in.numargs, (struct fuse_arg *) req->in.args);
list_add_tail(&req->list, &fc->pending); list_add_tail(&req->list, &fc->pending);
req->state = FUSE_REQ_PENDING; req->state = FUSE_REQ_PENDING;
if (!req->waiting) {
req->waiting = 1;
atomic_inc(&fc->num_waiting);
}
wake_up(&fc->waitq); wake_up(&fc->waitq);
kill_fasync(&fc->fasync, SIGIO, POLL_IN); kill_fasync(&fc->fasync, SIGIO, POLL_IN);
} }
...@@ -519,6 +515,10 @@ static void __fuse_request_send(struct fuse_conn *fc, struct fuse_req *req) ...@@ -519,6 +515,10 @@ static void __fuse_request_send(struct fuse_conn *fc, struct fuse_req *req)
void fuse_request_send(struct fuse_conn *fc, struct fuse_req *req) void fuse_request_send(struct fuse_conn *fc, struct fuse_req *req)
{ {
req->isreply = 1; req->isreply = 1;
if (!req->waiting) {
req->waiting = 1;
atomic_inc(&fc->num_waiting);
}
__fuse_request_send(fc, req); __fuse_request_send(fc, req);
} }
EXPORT_SYMBOL_GPL(fuse_request_send); EXPORT_SYMBOL_GPL(fuse_request_send);
...@@ -592,6 +592,10 @@ static void fuse_request_send_nowait_locked(struct fuse_conn *fc, ...@@ -592,6 +592,10 @@ static void fuse_request_send_nowait_locked(struct fuse_conn *fc,
struct fuse_req *req) struct fuse_req *req)
{ {
BUG_ON(!req->background); BUG_ON(!req->background);
if (!req->waiting) {
req->waiting = 1;
atomic_inc(&fc->num_waiting);
}
fc->num_background++; fc->num_background++;
if (fc->num_background == fc->max_background) if (fc->num_background == fc->max_background)
fc->blocked = 1; fc->blocked = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment