The commit is pushed to "branch-rh10-6.12.0-55.13.1.2.x.vz10-ovz" and will
appear at [email protected]:openvz/vzkernel.git
after rh10-6.12.0-55.13.1.2.22.vz10
------>
commit dfab48c7a9d6206178e6b6e5e5ef18aa15730f4e
Author: Pavel Tikhomirov <[email protected]>
Date: Tue Dec 2 18:17:47 2025 +0800
ve_namespace: Use scoped_guard() with task_lock
It is more consistent to use guards everywhere in the patch and not only
in some places and in other places don't.
Fixes: 8a771a3d6bea ("ve: Introduce VE namespace")
https://virtuozzo.atlassian.net/browse/VSTOR-118289
Signed-off-by: Pavel Tikhomirov <[email protected]>
Feature: ve: ve generic structures
---
kernel/nsproxy.c | 10 +++++-----
kernel/ve/ve_namespace.c | 18 +++++++++---------
2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/kernel/nsproxy.c b/kernel/nsproxy.c
index ccf53bd9579d6..2827d4f277ad6 100644
--- a/kernel/nsproxy.c
+++ b/kernel/nsproxy.c
@@ -430,11 +430,11 @@ static int validate_nsset(struct nsset *nsset, struct pid
*pid)
#endif
#ifdef CONFIG_VE
if (flags & CLONE_NEWVE) {
- task_lock(tsk);
- ve_ns = tsk->ve_ns;
- if (ve_ns)
- get_ve_ns(ve_ns);
- task_unlock(tsk);
+ scoped_guard(task_lock, tsk) {
+ ve_ns = tsk->ve_ns;
+ if (ve_ns)
+ get_ve_ns(ve_ns);
+ }
if (!ve_ns) {
rcu_read_unlock();
ret = -ESRCH;
diff --git a/kernel/ve/ve_namespace.c b/kernel/ve/ve_namespace.c
index a8dcc63b023af..b71c0a93a3e1b 100644
--- a/kernel/ve/ve_namespace.c
+++ b/kernel/ve/ve_namespace.c
@@ -136,11 +136,11 @@ void switch_ve_namespace(struct task_struct *p, struct
ve_namespace *new)
* task p to confirm to the ve_ns
*/
- task_lock(p);
- old = p->ve_ns;
- p->ve_ns = new;
- p->task_ve = new ? new->ve : &ve0;
- task_unlock(p);
+ scoped_guard(task_lock, p) {
+ old = p->ve_ns;
+ p->ve_ns = new;
+ p->task_ve = new ? new->ve : &ve0;
+ }
if (old)
put_ve_ns(old);
@@ -167,10 +167,10 @@ static struct ns_common *ve_ns_get(struct task_struct
*task)
{
struct ve_namespace *ns = NULL;
- task_lock(task);
- if (task->ve_ns)
- ns = get_ve_ns(task->ve_ns);
- task_unlock(task);
+ scoped_guard(task_lock, task) {
+ if (task->ve_ns)
+ ns = get_ve_ns(task->ve_ns);
+ }
return ns ? &ns->ns : NULL;
}
_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel