It's no longer needed to check the file state when moving a request
from one queue to another, so remove these code.

Related to #VSTOR-101450
Signed-off-by: Liu Kui <kui....@virtuozzo.com>
---
 fs/fuse/dev.c                      | 26 +++++---------------------
 fs/fuse/inode.c                    |  1 -
 fs/fuse/kio/pcs/pcs_fuse_kdirect.c | 10 +---------
 3 files changed, 6 insertions(+), 31 deletions(-)

diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index e3e97ed8c92f..99bb359cf4ad 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -470,7 +470,6 @@ static void __fuse_request_send(struct fuse_req *req)
        struct fuse_mount *fm = req->fm;
        struct fuse_conn *fc = fm->fc;
        struct fuse_iqueue *fiq = req->args->fiq;
-       struct fuse_file *ff = req->args->ff;
 
        BUG_ON(test_bit(FR_BACKGROUND, &req->flags));
 
@@ -489,11 +488,6 @@ static void __fuse_request_send(struct fuse_req *req)
                req->out.h.error = -ENOTCONN;
                if (req->args->end)
                        req->args->end(fm, req->args, req->out.h.error);
-       } else if (ff && test_bit(FUSE_S_FAIL_IMMEDIATELY, &ff->ff_state)) {
-               spin_unlock(&fiq->lock);
-               req->out.h.error = -EIO;
-               if (req->args->end)
-                       req->args->end(fm, req->args, req->out.h.error);
        } else {
                req->in.h.unique = fuse_get_unique(fiq);
                /* acquire extra reference, since request is still needed
@@ -626,16 +620,16 @@ static int fuse_request_queue_background(struct fuse_req 
*req)
        __set_bit(FR_ISREPLY, &req->flags);
 
        if (fc->kio.op && req->args->async && !nonblocking && 
READ_ONCE(fc->connected) &&
-           (!ff || !test_bit(FUSE_S_FAIL_IMMEDIATELY, &ff->ff_state))) {
+               (!ff || !test_bit(FUSE_S_FAIL_IMMEDIATELY, &ff->ff_state))) {
                int ret = fc->kio.op->req_classify(req, false, false);
                if (likely(!ret)) {
                        unsigned int bkt = fuse_qhash_bucket();
                        __clear_bit(FR_BACKGROUND, &req->flags);
                        __set_bit(FR_NO_ACCT, &req->flags);
                        if (wait_event_killable_exclusive(fc->qhash[bkt].waitq,
-                                                         
(atomic_read(&fc->qhash[bkt].num_reqs) < fuse_qhash_bucket_len ||
-                                                          
!READ_ONCE(fc->connected) ||
-                                                          (ff && 
test_bit(FUSE_S_FAIL_IMMEDIATELY, &ff->ff_state)))))
+                                               
(atomic_read(&fc->qhash[bkt].num_reqs) < fuse_qhash_bucket_len ||
+                                          !READ_ONCE(fc->connected) ||
+                                          (ff && 
test_bit(FUSE_S_FAIL_IMMEDIATELY, &ff->ff_state)))))
                                return -EIO;
                        if (!READ_ONCE(fc->connected))
                                return -ENOTCONN;
@@ -650,9 +644,7 @@ static int fuse_request_queue_background(struct fuse_req 
*req)
        }
 
        spin_lock(&fc->bg_lock);
-       if (ff && test_bit(FUSE_S_FAIL_IMMEDIATELY, &ff->ff_state)) {
-               ret = -EIO;
-       } else if (likely(fc->connected)) {
+       if (likely(fc->connected)) {
                ret = 0;
                fc->num_background++;
                if (fc->num_background == fc->max_background)
@@ -1421,15 +1413,7 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, 
struct file *file,
                goto out_end;
 
        }
-       if (args->page_cache && args->io_inode) {
-               struct fuse_inode *fi = get_fuse_inode(args->io_inode);
 
-               if (test_bit(FUSE_I_INVAL_FILES, &fi->state) || args->killed) {
-                       req->out.h.error = -EIO;
-                       err = -EAGAIN;
-                       goto out_end;
-               }
-       }
        list_add(&req->list, &fpq->io);
        spin_unlock(&fpq->lock);
        cs->req = req;
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 3e0413048b11..324e8086a256 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -509,7 +509,6 @@ int fuse_invalidate_files(struct fuse_conn *fc, u64 nodeid)
 
        /* let them see FUSE_S_FAIL_IMMEDIATELY */
        wake_up_all(&fc->blocked_waitq);
-
        for (i = 0; i < FUSE_QHASH_SIZE; i++)
                wake_up_all(&fc->qhash[i].waitq);
 
diff --git a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c 
b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
index 0a59271a6f12..379fac0a1343 100644
--- a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
+++ b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
@@ -837,13 +837,7 @@ static void wait_shrink(struct pcs_fuse_req *r, struct 
pcs_dentry_info *di)
 
 static bool kqueue_insert(struct pcs_dentry_info *di, struct fuse_req *req)
 {
-       struct fuse_file *ff = req->args->ff;
-
        spin_lock(&di->kq_lock);
-       if (ff && test_bit(FUSE_S_FAIL_IMMEDIATELY, &ff->ff_state)) {
-               spin_unlock(&di->kq_lock);
-               return false;
-       }
        list_add_tail(&req->list, &di->kq);
        spin_unlock(&di->kq_lock);
        return true;
@@ -984,9 +978,7 @@ static int pcs_fuse_prep_rw(struct pcs_fuse_req *r)
                BUG();
        }
 
-       if (req->args->ff && test_bit(FUSE_S_FAIL_IMMEDIATELY, 
&req->args->ff->ff_state))
-               ret = -EIO;
-       else if (req->in.h.opcode == FUSE_READ || req->in.h.opcode == 
FUSE_FSYNC ||
+       if (req->in.h.opcode == FUSE_READ || req->in.h.opcode == FUSE_FSYNC ||
            req->in.h.opcode == FUSE_FLUSH)
                fuse_read_dio_begin(fi);
        else
-- 
2.39.5 (Apple Git-154)

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to