[Devel] [PATCH RHEL8 COMMIT] ve/proc: increment position in "next" seq_operations callback
Konstantin Khorenko
khorenko at virtuozzo.com
Thu Jun 10 19:43:11 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.39
------>
commit 1f4b6a6907b0f7954adaaaafe95d1c316cb17c37
Author: Vasily Averin <vvs at virtuozzo.com>
Date: Thu Jun 10 19:43:11 2021 +0300
ve/proc: increment position in "next" seq_operations callback
"next" callback of struct "seq_operations" should move the iterator
forward to the next position in the sequence.
Some Virtuozzo specific proc files skip such increment,
and trigger incorrect file output.
https://bugs.openvz.org/browse/OVZ-7158
Signed-off-by: Vasily Averin <vvs at virtuozzo.com>
(cherry-picked from vz7 commit 0a458a0598b4 ("ve/proc: increment position in
"next" seq_operations callback"))
https://jira.sw.ru/browse/PSBM-127849
Signed-off-by: Valeriy Vdovin <valeriy.vdovin at virtuozzo.com>
---
drivers/net/venetdev.c | 2 +-
kernel/ve/vecalls.c | 5 +++--
kernel/ve/vzstat.c | 1 +
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/net/venetdev.c b/drivers/net/venetdev.c
index 4c5e3cb180e7..9d898bcbc6db 100644
--- a/drivers/net/venetdev.c
+++ b/drivers/net/venetdev.c
@@ -841,6 +841,7 @@ static void *veip_seq_next(struct seq_file *m, void *v, loff_t *pos)
struct hlist_node *p;
int i;
+ (*pos)++;
if (v == SEQ_START_TOKEN)
goto find;
@@ -854,7 +855,6 @@ static void *veip_seq_next(struct seq_file *m, void *v, loff_t *pos)
if (p != NULL) {
m->private = (void *)(long)(i + 1);
found:
- (*pos)++;
return p;
}
}
diff --git a/kernel/ve/vecalls.c b/kernel/ve/vecalls.c
index dcda8c0753c8..04e3d41dfed6 100644
--- a/kernel/ve/vecalls.c
+++ b/kernel/ve/vecalls.c
@@ -181,9 +181,10 @@ static void *ve_seq_start(struct seq_file *m, loff_t *pos)
static void *ve_seq_next(struct seq_file *m, void *v, loff_t *pos)
{
- if (!ve_is_super(get_exec_env()))
+ if (!ve_is_super(get_exec_env())) {
+ (*pos)++;
return NULL;
- else
+ } else
return seq_list_next(v, &ve_list_head, pos);
}
diff --git a/kernel/ve/vzstat.c b/kernel/ve/vzstat.c
index 0fb0cfbb0407..db8de1b9dba0 100644
--- a/kernel/ve/vzstat.c
+++ b/kernel/ve/vzstat.c
@@ -626,6 +626,7 @@ static void *empty_seq_start(struct seq_file *m, loff_t *pos)
static void *empty_seq_next(struct seq_file *m, void *v, loff_t *pos)
{
+ (*pos)++;
return NULL;
}
More information about the Devel
mailing list