[Devel] [PATCH 05/13] fs: Lower ioprio in case of ioprio_set() called from CT

Alexander Mikhalitsyn alexander.mikhalitsyn at virtuozzo.com
Wed Apr 14 10:57:52 MSK 2021


From: Kirill Tkhai <ktkhai at virtuozzo.com>

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) {
-- 
2.28.0



More information about the Devel mailing list