All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
From: Vladimir Riabchun <vladimir.riabchun@virtuozzo.com>
To: ptikhomirov@virtuozzo.com, Konstantin Khorenko <khorenko@virtuozzo.com>
Cc: devel@openvz.org
Subject: [Devel] [PATCH hci-8.1 v3 3/5] ve: Defer ve context drop until ve is completely destroyed
Date: Tue, 03 Nov 2026 10:24:39 +0100	[thread overview]
Message-ID: <20261103-ovl-use-orig-ve-v3-3-add042cdd087@virtuozzo.com> (raw)
In-Reply-To: <20261103-ovl-use-orig-ve-v3-0-add042cdd087@virtuozzo.com>

We may have a case, when VE is dead, but there are some users of it,
overlayfs superblock for example.

This user may want to use VE creds, so we need to keep ve->init_cred alive.
Drop creds in ve_destroy. We need to drop ve_nsproxy early because
ploop waits for refcount going to zero, dropping ve_nsproxy in destroy
causes CT suspend/resume hangs.

https://virtuozzo.atlassian.net/browse/VSTOR-142405
Signed-off-by: Vladimir Riabchun <vladimir.riabchun@virtuozzo.com>
---
 kernel/ve/ve.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
index d74f74ca958a..0dc3778b6ba0 100644
--- a/kernel/ve/ve.c
+++ b/kernel/ve/ve.c
@@ -377,7 +377,10 @@ static void ve_drop_context(struct ve_struct *ve)
 	rcu_assign_pointer(ve->ve_nsproxy, NULL);
 	synchronize_rcu();
 	put_nsproxy(ve_nsproxy);
+}
 
+static void ve_drop_cred(struct ve_struct *ve)
+{
 	put_cred(ve->init_cred);
 	ve->init_cred = NULL;
 }
@@ -925,6 +928,7 @@ static void ve_destroy(struct cgroup_subsys_state *css)
 {
 	struct ve_struct *ve = css_to_ve(css);
 
+	ve_drop_cred(ve);
 	free_ve_devmnts(ve);
 
 	kmapset_unlink(&ve->sysfs_perms_key, &sysfs_ve_perms_set);

-- 
2.52.0

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

  parent reply	other threads:[~2026-11-03  9:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03  9:24 [Devel] [PATCH hci-8.1 v3 0/5] Fix kernel crash in overlayfs Vladimir Riabchun
2026-11-03  9:24 ` [Devel] [PATCH hci-8.1 v3 1/5] ve: Remove STOPPED state Vladimir Riabchun
2026-11-03  9:28   ` no-reply
2026-11-03  9:24 ` [Devel] [PATCH hci-8.1 v3 2/5] ve: Introduce override_ve/revert_ve helpers Vladimir Riabchun
2026-11-03  9:30   ` no-reply
2026-11-03  9:24 ` Vladimir Riabchun [this message]
2026-11-03  9:30   ` [Devel] [PATCH hci-8.1 v3 3/5] ve: Defer ve context drop until ve is completely destroyed no-reply
2026-11-03  9:24 ` [Devel] [PATCH hci-8.1 v3 4/5] ovl: Keep creator VE in overlayfs superblock Vladimir Riabchun
2026-11-03  9:31   ` no-reply
2026-11-03  9:24 ` [Devel] [PATCH hci-8.1 v3 5/5] ve/overlayfs: Override VE together with creds Vladimir Riabchun
2026-11-03  9:34   ` no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261103-ovl-use-orig-ve-v3-3-add042cdd087@virtuozzo.com \
    --to=vladimir.riabchun@virtuozzo.com \
    --cc=devel@openvz.org \
    --cc=khorenko@virtuozzo.com \
    --cc=ptikhomirov@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.