[Devel] [PATCH RHEL8 COMMIT] fuse: Handle zero req->num_pages in tree_insert()
Konstantin Khorenko
khorenko at virtuozzo.com
Mon Apr 26 12:17:25 MSK 2021
The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.5.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.vz8.5.19
------>
commit 6f1e6531d35a0d1858ba91ae521566dfa5683b34
Author: Vasily Averin <vvs at virtuozzo.com>
Date: Tue Sep 17 14:52:27 2019 +0300
fuse: Handle zero req->num_pages in tree_insert()
At the moment we (Ildar :) ) do not see how it could happen - i mean
tree_insert() gets in_req->num_pages == 0.
But already faced this once - due to another bug, so let's handle this
corner case. Just in case.
Cherry picked from vz7 commit ad1d32ee38c4 ("fuse: fixup for
e591d87a5819 ("fuse: optimize writepages search")")
https://jira.sw.ru/browse/PSBM-127832
Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
================
Original comment:
fuse: fixup for e591d87a5819 ("fuse: optimize writepages search")
This patch updates backport of "fuse: optimize writepages search"
to rhel77+ kernel and fixes 2 problems:
- tree_insert() should properly handle requests with num_pages=0
- fuse_writepage_end() was added wrong request into tree
https://jira.sw.ru/browse/PSBM-97813
Signed-off-by: Vasily Averin <vvs at virtuozzo.com>
---
fs/fuse/file.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index e08e557ecaf2..a25c2d5d2e25 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -1995,7 +1995,8 @@ __acquires(fi->lock)
static int tree_insert(struct rb_root *root, struct fuse_writepage_args *ins_wpa)
{
pgoff_t idx_from = ins_wpa->ia.write.in.offset >> PAGE_SHIFT;
- pgoff_t idx_to = idx_from + ins_wpa->ia.ap.num_pages - 1;
+ pgoff_t idx_to = ins_wpa->ia.ap.num_pages ?
+ idx_from + ins_wpa->ia.ap.num_pages - 1 : idx_from;
struct rb_node **p = &root->rb_node;
struct rb_node *parent = NULL;
More information about the Devel
mailing list