Skip to contentSkip to conversation

fadump: allow duplicate assignment to /sys/kernel/fadump_registered when it's assigned the desired value already

PATCH In review Wang Sheng-Hui 2 participants 2 messages Apr 10, 2013 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fadump: allow duplicate assignment to /sys/kernel/fadump_registered when it's assigned the desired value already

When the fadump is enabled, we have /sys/kernel/fadump_enabled assigned 1. But sometimes we need to restart the fadump service by 'service kdump restart', in case the kdump script has added the fadump detect/support already. In current implementation, we cannot re-assign 1 to /sys/kernel/fadump_enabled if 1 is already set and we have added more logic check in the user space script.

I think we can enable the duplicate assignment to ease the user space tools, as long as the value is the right 1 or 0.

---
 arch/powerpc/kernel/fadump.c |    8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
arch/powerpc/kernel/fadump.c +2 -6
index 06c8202..e1347e5 100644
@@ -1140,18 +1140,14 @@ static ssize_t fadump_register_store(struct kobject *kobj,
 
 	switch (buf[0]) {
 	case '0':
-		if (fw_dump.dump_registered == 0) {
-			ret = -EINVAL;
+		if (fw_dump.dump_registered == 0)
 			goto unlock_out;
-		}
 		/* Un-register Firmware-assisted dump */
 		fadump_unregister_dump(&fdm);
 		break;
 	case '1':
-		if (fw_dump.dump_registered == 1) {
-			ret = -EINVAL;
+		if (fw_dump.dump_registered == 1)
 			goto unlock_out;
-		}
 		/* Register Firmware-assisted dump */
 		register_fadump();
 		break;
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 6 lines · Wang Sheng-Hui

When the fadump is enabled, we have /sys/kernel/fadump_enabled assigned 1. But sometimes we need to restart the fadump service by 'service kdump restart',
in case the kdump script has added the fadump detect/support already. In current implementation, we cannot re-assign 1 to /sys/kernel/fadump_enabled

I assume you meant /sys/kernel/fadump_registered here. Ideally service kdump restart should first echo 0 to /sys/kernel/fadump_registered to un-register fadump before echo 1 to /sys/kernel/fadump_registered for re-registration. I would fix the user space tool than changing the kernel code.

Quoted 38 lines

if 1 is already set and we have added more logic check in the user space script.

I think we can enable the duplicate assignment to ease the user space tools,
as long as the value is the right 1 or 0.

---
 arch/powerpc/kernel/fadump.c |    8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
arch/powerpc/kernel/fadump.c +2 -6
index 06c8202..e1347e5 100644
@@ -1140,18 +1140,14 @@ static ssize_t fadump_register_store(struct
 kobject *kobj,
 
     switch (buf[0]) {
     case '0':
-        if (fw_dump.dump_registered == 0) {
-            ret = -EINVAL;
+        if (fw_dump.dump_registered == 0)
             goto unlock_out;
-        }
         /* Un-register Firmware-assisted dump */
         fadump_unregister_dump(&fdm);
         break;
     case '1':
-        if (fw_dump.dump_registered == 1) {
-            ret = -EINVAL;
+        if (fw_dump.dump_registered == 1)
             goto unlock_out;
-        }
         /* Register Firmware-assisted dump */
         register_fadump();
         break;