[Devel] [PATCH RHEL8 COMMIT] fs: Lower ioprio in case of ioprio_set() called from CT

Konstantin Khorenko khorenko at virtuozzo.com
Thu Apr 15 20:12:04 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.14
------>
commit 47807adcc5f50efdf9367c903d1fb15410c1a47d
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Thu Apr 15 20:12:03 2021 +0300

    fs: Lower ioprio in case of ioprio_set() called from CT
    
    Extracted from "Initial patch".
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
    
    =====================================================================
    Removed UBC-related code.
    
    VZ 8 rebase part https://jira.sw.ru/browse/PSBM-127782
    
    Signed-off-by: Alexander Mikhalitsyn <alexander.mikhalitsyn at virtuozzo.com>
---
 block/ioprio.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/block/ioprio.c b/block/ioprio.c
index 0914343769d5..c56ee7edbbc7 100644
--- a/block/ioprio.c
+++ b/block/ioprio.c
@@ -97,11 +97,27 @@ SYSCALL_DEFINE3(ioprio_set, int, which, int, who, int, ioprio)
 	struct pid *pgrp;
 	kuid_t uid;
 	int ret;
+	int class = IOPRIO_PRIO_CLASS(ioprio);
+	int data = IOPRIO_PRIO_DATA(ioprio);
 
 	ret = ioprio_check_cap(ioprio);
 	if (ret)
 		return ret;
 
+	if (!ve_is_super(get_exec_env())) {
+		switch (class) {
+			case IOPRIO_CLASS_RT:
+				class = IOPRIO_CLASS_BE;
+				data = 0;
+				break;
+			case IOPRIO_CLASS_IDLE:
+				class = IOPRIO_CLASS_BE;
+				data = IOPRIO_BE_NR - 1;
+				break;
+		}
+		ioprio = IOPRIO_PRIO_VALUE(class, data);
+	}
+
 	ret = -ESRCH;
 	rcu_read_lock();
 	switch (which) {


More information about the Devel mailing list