The commit is pushed to "branch-rh9-5.14.0-427.44.1.vz9.80.x-ovz" and will 
appear at g...@bitbucket.org:openvz/vzkernel.git
after rh9-5.14.0-427.44.1.vz9.80.36
------>
commit 8c0fed63c075dcbb5d3576a2993a2db0551800ac
Author: Liu Kui <kui....@virtuozzo.com>
Date:   Fri May 30 07:32:05 2025 +0800

    fs/fuse kio: set correct accounting weight for FIEMAP request msg.
    
    This is an ancient bug that was never tested. For FIEMAP request,
    its iochunk.size could be much larger than the size of actual msg
    flying around. And its accounting weight should be PCS_CS_HOLE_WEIGHT,
    just like WRITE_HOLE or WRITE_ZERO, instead of its iochunk.size.
    Otherwise it'll make cs->in_flight overflow, crashing the kernel.
    
    Fixes: #ASUP-1567
    https://virtuozzo.atlassian.net/browse/ASUP-1567
    
    Signed-off-by: Liu Kui <kui....@virtuozzo.com>
    Acked-by: Alexey Kuznetsov <kuz...@virtuozzo.com>
    
    Feature: vStorage
---
 fs/fuse/kio/pcs/pcs_map.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/fs/fuse/kio/pcs/pcs_map.c b/fs/fuse/kio/pcs/pcs_map.c
index b491f38bb053c..62b083b4947ff 100644
--- a/fs/fuse/kio/pcs/pcs_map.c
+++ b/fs/fuse/kio/pcs/pcs_map.c
@@ -1481,7 +1481,8 @@ static void pcs_cs_deaccount(struct pcs_int_request 
*ireq, struct pcs_cs * cs, i
        spin_lock(&cs->lock);
        if (ireq->type == PCS_IREQ_IOCHUNK) {
                if (ireq->iochunk.cmd == PCS_REQ_T_WRITE_HOLE ||
-                   ireq->iochunk.cmd == PCS_REQ_T_WRITE_ZERO)
+                   ireq->iochunk.cmd == PCS_REQ_T_WRITE_ZERO ||
+                       ireq->iochunk.cmd == PCS_REQ_T_FIEMAP)
                        cost = PCS_CS_HOLE_WEIGHT;
                else
                        cost = (ireq->flags & IREQ_F_RND_WEIGHT) ? 512*1024 : 
cong_roundup(ireq->iochunk.size);
@@ -2108,7 +2109,9 @@ static int pcs_cslist_submit_read(struct pcs_int_request 
*ireq, struct pcs_cs_li
 
                sreq->flags &= ~(IREQ_F_RND_WEIGHT | IREQ_F_SEQ);
                BUG_ON(sreq->flags & IREQ_F_SEQ_READ);
-               if (pcs_flow_sequential(sreq->iochunk.flow)) {
+               if (ireq->iochunk.cmd != PCS_REQ_T_READ) {
+                       weight = PCS_CS_HOLE_WEIGHT;
+               } else if (pcs_flow_sequential(sreq->iochunk.flow)) {
                        sreq->flags |= IREQ_F_SEQ_READ | IREQ_F_SEQ;
                        atomic_inc(&csl->seq_read_in_flight);
                        weight = cong_roundup(sreq->iochunk.size);
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to