This reverts commit 3cb4c6ac929ed7d73f4e51abe5c520f20efe3aa7.

The fix in above commit is no longer necessary, now that a separate
revocation list has been implemented in:
 - "fs/fuse: revamp fuse_invalidate_files()"

Signed-off-by: Liu Kui <kui....@virtuozzo.com>
---
 fs/fuse/kio/pcs/pcs_fuse_kdirect.c | 43 +++++++++---------------------
 1 file changed, 12 insertions(+), 31 deletions(-)

diff --git a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c 
b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
index 6225a4ede7e1..16b198d76c16 100644
--- a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
+++ b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
@@ -835,19 +835,11 @@ static void wait_shrink(struct pcs_fuse_req *r, struct 
pcs_dentry_info *di)
        list_add_tail(&r->exec.ireq.list, &di->size.queue);
 }
 
-static bool kqueue_insert(struct pcs_dentry_info *di, struct fuse_req *req)
+static void kqueue_insert(struct pcs_dentry_info *di, struct fuse_req *req)
 {
        spin_lock(&di->kq_lock);
        list_add_tail(&req->list, &di->kq);
        spin_unlock(&di->kq_lock);
-       return true;
-}
-
-static void kqueue_remove(struct pcs_dentry_info *di, struct fuse_req *req)
-{
-       spin_lock(&di->kq_lock);
-       list_del_init(&req->list);
-       spin_unlock(&di->kq_lock);
 }
 
 static inline int req_wait_grow_queue(struct pcs_fuse_req *r, off_t offset, 
size_t size)
@@ -855,6 +847,8 @@ static inline int req_wait_grow_queue(struct pcs_fuse_req 
*r, off_t offset, size
        struct pcs_dentry_info *di = get_pcs_inode(r->req.args->io_inode);
        struct fuse_inode *fi = get_fuse_inode(r->req.args->io_inode);
 
+       kqueue_insert(di, &r->req);
+
        BUG_ON(r->req.in.h.opcode != FUSE_WRITE && r->req.in.h.opcode != 
FUSE_FALLOCATE);
        fuse_write_dio_begin(fi);
 
@@ -978,6 +972,8 @@ static int pcs_fuse_prep_rw(struct pcs_fuse_req *r)
                BUG();
        }
 
+       kqueue_insert(di, req);
+
        if (req->in.h.opcode == FUSE_READ || req->in.h.opcode == FUSE_FSYNC ||
            req->in.h.opcode == FUSE_FLUSH)
                fuse_read_dio_begin(fi);
@@ -989,13 +985,14 @@ static int pcs_fuse_prep_rw(struct pcs_fuse_req *r)
        return ret;
 }
 
-static int pcs_fuse_submit_prepare(struct pcs_fuse_cluster *pfc, struct 
fuse_req *req)
+static void pcs_fuse_submit(struct pcs_fuse_cluster *pfc, struct fuse_req *req)
 {
        struct pcs_fuse_req *r = pcs_req_from_fuse(req);
        struct fuse_args *args = req->args;
        struct fuse_inode *fi = get_fuse_inode(args->io_inode);
        struct pcs_dentry_info *di = pcs_inode_from_fuse(fi);
-       int ret = 0;
+       struct pcs_int_request* ireq;
+       int ret;
 
        BUG_ON(!di);
        BUG_ON(req->cache != pcs_fuse_req_cachep);
@@ -1003,21 +1000,8 @@ static int pcs_fuse_submit_prepare(struct 
pcs_fuse_cluster *pfc, struct fuse_req
        /* Init pcs_fuse_req */
        memset(&r->exec, 0, sizeof(r->exec));
        /* Use inline request structure */
-       ireq_init(di, &r->exec.ireq);
-
-       spin_lock(&di->lock);
-       if (!kqueue_insert(di, req))
-               ret = -EIO;
-       spin_unlock(&di->lock);
-       return ret;
-}
-
-static void pcs_fuse_submit(struct pcs_fuse_cluster *pfc, struct fuse_req *req)
-{
-       struct pcs_fuse_req *r = pcs_req_from_fuse(req);
-       struct pcs_int_request *ireq = &r->exec.ireq;
-       struct pcs_dentry_info *di = ireq->dentry;
-       int ret;
+       ireq = &r->exec.ireq;
+       ireq_init(di, ireq);
 
        switch (req->in.h.opcode) {
        case FUSE_WRITE:
@@ -1035,7 +1019,7 @@ static void pcs_fuse_submit(struct pcs_fuse_cluster *pfc, 
struct fuse_req *req)
                }
                break;
        case FUSE_FALLOCATE: {
-               struct fuse_fallocate_in *inarg = (void 
*)req->args->in_args[0].value;
+               struct fuse_fallocate_in *inarg = (void*) 
args->in_args[0].value;
                size_t sz = READ_ONCE(di->fileinfo.attr.size);
 
                if (pfc->fc->no_fallocate) {
@@ -1071,7 +1055,7 @@ static void pcs_fuse_submit(struct pcs_fuse_cluster *pfc, 
struct fuse_req *req)
                         * and as i_size is still not advanced all the 
following ones are.
                         */
                        WARN_ON_ONCE(inarg->offset + inarg->length > sz &&
-                                    !inode_is_locked(req->args->io_inode));
+                                    !inode_is_locked(&fi->inode));
                }
 
                ret = pcs_fuse_prep_rw(r);
@@ -1106,7 +1090,6 @@ static void pcs_fuse_submit(struct pcs_fuse_cluster *pfc, 
struct fuse_req *req)
 error:
        DTRACE("do fuse_request_end req:%p op:%d err:%d\n", req, 
req->in.h.opcode, req->out.h.error);
 
-       kqueue_remove(di, req);
        __fuse_request_end(req, false);
        return;
 
@@ -1330,8 +1313,6 @@ static void kpcs_req_send(struct fuse_req *req, bool bg)
                refcount_inc(&req->count);
        __clear_bit(FR_PENDING, &req->flags);
 
-       pcs_fuse_submit_prepare(pfc, req);
-
        pcs_fuse_submit(pfc, req);
        if (!bg)
                wait_event(req->waitq,
-- 
2.39.5 (Apple Git-154)

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

Reply via email to