lkml.org 
[lkml]   [2020]   [Nov]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/2] reboot: allow to override reboot type if quirks are found
Date
From: Matteo Croce <mcroce@microsoft.com>

On some machines a quirk can force a specific reboot type.
Quirks are found during a DMI scan, the list of machines which need
special reboot handling is defined in reboot_dmi_table.

The kernel command line reboot= option overrides this via a global
variable `reboot_default`, so that the reboot type requested in
the command line is really performed.

This was not true when setting the reboot type via the new sysfs
interface. Fix this by setting reboot_default upon the first change,
like reboot_setup() does for the command line.

Signed-off-by: Matteo Croce <mcroce@microsoft.com>
---
kernel/reboot.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/kernel/reboot.c b/kernel/reboot.c
index ea6347b99b14..d80e3d64fe23 100644
--- a/kernel/reboot.c
+++ b/kernel/reboot.c
@@ -656,6 +656,8 @@ static ssize_t mode_store(struct kobject *kobj, struct kobj_attribute *attr,
else
return -EINVAL;

+ reboot_default = 0;
+
return count;
}
static struct kobj_attribute reboot_mode_attr = __ATTR_RW(mode);
@@ -710,6 +712,8 @@ static ssize_t type_store(struct kobject *kobj, struct kobj_attribute *attr,
else
return -EINVAL;

+ reboot_default = 0;
+
return count;
}
static struct kobj_attribute reboot_type_attr = __ATTR_RW(type);
@@ -735,6 +739,7 @@ static ssize_t cpu_store(struct kobject *kobj, struct kobj_attribute *attr,
if (cpunum >= num_possible_cpus())
return -ERANGE;

+ reboot_default = 0;
reboot_cpu = cpunum;

return count;
@@ -756,6 +761,7 @@ static ssize_t force_store(struct kobject *kobj, struct kobj_attribute *attr,
if (kstrtobool(buf, &res))
return -EINVAL;

+ reboot_default = 0;
reboot_force = res;

return count;
--
2.28.0
\
 
 \ /
  Last update: 2020-11-30 18:40    [W:0.049 / U:0.268 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site