aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-05-25 11:25:43 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-05-31 11:09:41 +0900
commit617d253afad10ca9c7861eb3a2b381a8f95cf4ad (patch)
treef464c9e996093a673a32ae92c288026bbea9312c
parentload-fragment: setting empty string to Nice= resets the previous assignments (diff)
downloadsystemd-617d253afad10ca9c7861eb3a2b381a8f95cf4ad.tar.gz
systemd-617d253afad10ca9c7861eb3a2b381a8f95cf4ad.tar.bz2
systemd-617d253afad10ca9c7861eb3a2b381a8f95cf4ad.zip
load-fragment: make IOScheduling{Class,Priority}= accept the empty string
-rw-r--r--man/systemd.exec.xml7
-rw-r--r--src/core/load-fragment.c12
2 files changed, 17 insertions, 2 deletions
diff --git a/man/systemd.exec.xml b/man/systemd.exec.xml
index b21c5aa10..8fb9ecc6d 100644
--- a/man/systemd.exec.xml
+++ b/man/systemd.exec.xml
@@ -728,7 +728,8 @@ CapabilityBoundingSet=~CAP_B CAP_C</programlisting>
<listitem><para>Sets the I/O scheduling class for executed processes. Takes an integer between 0 and 3 or one
of the strings <option>none</option>, <option>realtime</option>, <option>best-effort</option> or
- <option>idle</option>. See
+ <option>idle</option>. If the empty string is assigned to this option, all prior assignments to both
+ <varname>IOSchedulingClass=</varname> and <varname>IOSchedulingPriority=</varname> have no effect. See
<citerefentry><refentrytitle>ioprio_set</refentrytitle><manvolnum>2</manvolnum></citerefentry> for
details.</para></listitem>
</varlistentry>
@@ -738,7 +739,9 @@ CapabilityBoundingSet=~CAP_B CAP_C</programlisting>
<listitem><para>Sets the I/O scheduling priority for executed processes. Takes an integer between 0 (highest
priority) and 7 (lowest priority). The available priorities depend on the selected I/O scheduling class (see
- above). See <citerefentry><refentrytitle>ioprio_set</refentrytitle><manvolnum>2</manvolnum></citerefentry> for
+ above). If the empty string is assigned to this option, all prior assignments to both
+ <varname>IOSchedulingClass=</varname> and <varname>IOSchedulingPriority=</varname> have no effect.
+ See <citerefentry><refentrytitle>ioprio_set</refentrytitle><manvolnum>2</manvolnum></citerefentry> for
details.</para></listitem>
</varlistentry>
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index d2ce73f72..94583b566 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -1115,6 +1115,12 @@ int config_parse_exec_io_class(const char *unit,
assert(rvalue);
assert(data);
+ if (isempty(rvalue)) {
+ c->ioprio_set = false;
+ c->ioprio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, 0);
+ return 0;
+ }
+
x = ioprio_class_from_string(rvalue);
if (x < 0) {
log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to parse IO scheduling class, ignoring: %s", rvalue);
@@ -1146,6 +1152,12 @@ int config_parse_exec_io_priority(const char *unit,
assert(rvalue);
assert(data);
+ if (isempty(rvalue)) {
+ c->ioprio_set = false;
+ c->ioprio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, 0);
+ return 0;
+ }
+
r = ioprio_parse_priority(rvalue, &i);
if (r < 0) {
log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse IO priority, ignoring: %s", rvalue);