diff mbox series

[net-next] bonding: Added -ENODEV interpret for slaves option

Message ID 20210313140210.3940183-1-Jianlin.Lv@arm.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [net-next] bonding: Added -ENODEV interpret for slaves option | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 1 this patch: 1
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 15 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 1 this patch: 1
netdev/header_inline success Link

Commit Message

Jianlin Lv March 13, 2021, 2:02 p.m. UTC
After upgrading the kernel, the slave interface name is changed,
Systemd cannot use the original configuration to create bond interface,
thereby losing the connection with the host.

Adding log for ENODEV will make it easier to find out such problem lies.

Signed-off-by: Jianlin Lv <Jianlin.Lv@arm.com>
---
 drivers/net/bonding/bond_options.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Jay Vosburgh March 13, 2021, 7:50 p.m. UTC | #1
Jianlin Lv <Jianlin.Lv@arm.com> wrote:

>After upgrading the kernel, the slave interface name is changed,
>Systemd cannot use the original configuration to create bond interface,
>thereby losing the connection with the host.
>
>Adding log for ENODEV will make it easier to find out such problem lies.

	To be clear, this specifically affects add/remove of interfaces
to/from the bond via the "slaves" sysfs interface.

	Please update your log to better describe this (that it affects
the sysfs API only) and resubmit.

	I'm sympathetic to the problem this is trying to solve, and the
message shouldn't spam the kernel log particularly, but the commit log
needs to more clearly describe what the problem is and how it's being
fixed.

	Thanks,

	-J

>Signed-off-by: Jianlin Lv <Jianlin.Lv@arm.com>
>---
> drivers/net/bonding/bond_options.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
>diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c
>index 77d7c38bd435..c9d3604ae129 100644
>--- a/drivers/net/bonding/bond_options.c
>+++ b/drivers/net/bonding/bond_options.c
>@@ -640,6 +640,15 @@ static void bond_opt_error_interpret(struct bonding *bond,
> 		netdev_err(bond->dev, "option %s: unable to set because the bond device is up\n",
> 			   opt->name);
> 		break;
>+	case -ENODEV:
>+		if (val && val->string) {
>+			p = strchr(val->string, '\n');
>+			if (p)
>+				*p = '\0';
>+			netdev_err(bond->dev, "option %s: interface %s does not exist!\n",
>+				   opt->name, val->string);
>+		}
>+		break;
> 	default:
> 		break;
> 	}
>-- 
>2.25.1
>

---
	-Jay Vosburgh, jay.vosburgh@canonical.com
diff mbox series

Patch

diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c
index 77d7c38bd435..c9d3604ae129 100644
--- a/drivers/net/bonding/bond_options.c
+++ b/drivers/net/bonding/bond_options.c
@@ -640,6 +640,15 @@  static void bond_opt_error_interpret(struct bonding *bond,
 		netdev_err(bond->dev, "option %s: unable to set because the bond device is up\n",
 			   opt->name);
 		break;
+	case -ENODEV:
+		if (val && val->string) {
+			p = strchr(val->string, '\n');
+			if (p)
+				*p = '\0';
+			netdev_err(bond->dev, "option %s: interface %s does not exist!\n",
+				   opt->name, val->string);
+		}
+		break;
 	default:
 		break;
 	}