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                      | 29 +++++------------------------
 fs/fuse/inode.c                    |  1 -
 fs/fuse/kio/pcs/pcs_fuse_kdirect.c | 10 +---------
 3 files changed, 6 insertions(+), 34 deletions(-)

diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 782f79010dce..35e105e7661e 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -303,17 +303,8 @@ static void fuse_dev_queue_interrupt(struct fuse_iqueue 
*fiq, struct fuse_req *r
 
 static void fuse_dev_queue_req(struct fuse_iqueue *fiq, struct fuse_req *req)
 {
-       struct fuse_file *ff = req->args->ff;
-
        spin_lock(&fiq->lock);
        if (fiq->connected) {
-               if (ff && test_bit(FUSE_S_FAIL_IMMEDIATELY, &ff->ff_state)) {
-                       spin_unlock(&fiq->lock);
-                       req->out.h.error = -EIO;
-                       clear_bit(FR_PENDING, &req->flags);
-                       fuse_request_end(req);
-                       return;
-               }
                if (req->in.h.opcode != FUSE_NOTIFY_REPLY)
                        req->in.h.unique = fuse_get_unique_locked(fiq);
                list_add_tail(&req->list, &fiq->pending);
@@ -682,16 +673,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;
@@ -706,9 +697,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)
@@ -1465,15 +1454,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 f6150ea1286b..c067c5922b5d 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -628,7 +628,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 a2af5f10ec45..6225a4ede7e1 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