Backport from ml:

commit 5437f2417225dc89c785867f4790012668006abc
Author: Miklos Szeredi <[email protected]>
Date:   Wed Jul 1 16:25:56 2015 +0200

    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: Miklos Szeredi <[email protected]>
    Reviewed-by: Ashish Samant <[email protected]>

Signed-off-by: Maxim Patlasov <[email protected]>
---
 fs/fuse/dev.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 92ec220..1dd88a9 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -299,10 +299,6 @@ static void queue_request(struct fuse_conn *fc, struct 
fuse_req *req)
                len_args(req->in.numargs, (struct fuse_arg *) req->in.args);
        list_add_tail(&req->list, &fc->pending);
        req->state = FUSE_REQ_PENDING;
-       if (!req->waiting) {
-               req->waiting = 1;
-               atomic_inc(&fc->num_waiting);
-       }
        wake_up(&fc->waitq);
        kill_fasync(&fc->fasync, SIGIO, POLL_IN);
 }
@@ -504,6 +500,10 @@ void fuse_request_check_and_send(struct fuse_conn *fc, 
struct fuse_req *req,
                                 struct fuse_file *ff)
 {
        req->isreply = 1;
+       if (!req->waiting) {
+               req->waiting = 1;
+               atomic_inc(&fc->num_waiting);
+       }
        __fuse_request_send(fc, req, ff);
 }
 
@@ -517,6 +517,10 @@ static void fuse_request_send_nowait_locked(struct 
fuse_conn *fc,
                                            struct fuse_req *req)
 {
        BUG_ON(!req->background);
+       if (!req->waiting) {
+               req->waiting = 1;
+               atomic_inc(&fc->num_waiting);
+       }
        fc->num_background++;
        if (fc->num_background == fc->max_background)
                fc->blocked = 1;

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to