drbd: Ensure compatibility with kernel versions >= v5.2
Prior to this commit, the Ansible bootstrap procedure on StarlingX would fail with drbd-related errors when a v5.10-based kernel was in use. The error reported by the kernel was "invalid argument". Upon further debugging, it was discovered that generic-netlink (genl) messages generated by drbdsetup would be rejected by the v5.10 kernel. After looking at the git history of the drbd-utils repository, the following two commits were found: $ git log -2 --pretty=ref 859151b228d3b3aacefb09d06d515a2589c22e35 859151b228d3 (netlink: Add NLA_F_NESTED flag to nested attribute, 2019-07-12) 92ade5989027 (netlink: prepare for kernel v5.2, 2019-07-12) This issue appears to be caused by kernel versions >= 5.2 being more strict with the validation of nested netlink attributes. The patches required very minor context adjustments and enable the Ansible bootstrap procedure to succeed. Story: 2008921 Task: 42787 Change-Id: I573d0caafc741c7668be8ee8e494fde826437a98 Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
This commit is contained in:
parent
145e0d5756
commit
b2c04a8fab
@ -46,6 +46,8 @@ Patch0008: 0008-Increase-short-cmd-timeout-to-15-secs.patch
|
||||
Patch0009: 0009-Check-for-mounted-device-before-demoting-Primary-DRB.patch
|
||||
Patch0010: 0010-backport-drbd-main-ipv6-Fix-interface-indices-larger.patch
|
||||
Patch0011: 0011-Unmount-all-targets-during-drbd-stop.patch
|
||||
Patch0012: 0012-netlink-prepare-for-kernel-v5.2.patch
|
||||
Patch0013: 0013-netlink-Add-NLA_F_NESTED-flag-to-nested-attribute.patch
|
||||
|
||||
License: GPLv2+
|
||||
ExclusiveOS: linux
|
||||
@ -277,6 +279,8 @@ management utility.
|
||||
%patch0009 -p1
|
||||
%patch0010 -p1
|
||||
%patch0011 -p1
|
||||
%patch0012 -p1
|
||||
%patch0013 -p1
|
||||
|
||||
%build
|
||||
%configure \
|
||||
|
@ -0,0 +1,29 @@
|
||||
From 536eac16f1b6636ce4153fa58c74c417c4f69753 Mon Sep 17 00:00:00 2001
|
||||
From: Roland Kammerer <roland.kammerer@linbit.com>
|
||||
Date: Fri, 12 Jul 2019 13:36:50 +0200
|
||||
Subject: [PATCH] netlink: prepare for kernel v5.2
|
||||
|
||||
[mvb: Adapted to drbd-utils 8.4.3.]
|
||||
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
|
||||
---
|
||||
user/libgenl.h | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/user/libgenl.h b/user/libgenl.h
|
||||
index a37493a6e528..b1c3eab345ec 100644
|
||||
--- a/user/libgenl.h
|
||||
+++ b/user/libgenl.h
|
||||
@@ -23,6 +23,10 @@
|
||||
#define SOL_NETLINK 270
|
||||
#endif
|
||||
|
||||
+#ifndef NLA_F_NESTED
|
||||
+#define NLA_F_NESTED 0
|
||||
+#endif
|
||||
+
|
||||
#define DEBUG_LEVEL 1
|
||||
|
||||
#define dbg(lvl, fmt, arg...) \
|
||||
--
|
||||
2.29.2
|
||||
|
@ -0,0 +1,49 @@
|
||||
From 062ec873e733d278c9024be3783f59c532333b75 Mon Sep 17 00:00:00 2001
|
||||
From: He Zhe <zhe.he@windriver.com>
|
||||
Date: Fri, 12 Jul 2019 15:07:27 +0800
|
||||
Subject: [PATCH] netlink: Add NLA_F_NESTED flag to nested attribute
|
||||
|
||||
The mainline kernel v5.2 commit b424e432e770
|
||||
("netlink: add validation of NLA_F_NESTED flag") imposes strict validation
|
||||
against nested attribute as follow.
|
||||
|
||||
"
|
||||
Add new validation flag NL_VALIDATE_NESTED which adds three consistency
|
||||
checks of NLA_F_NESTED_FLAG:
|
||||
|
||||
- the flag is set on attributes with NLA_NESTED{,_ARRAY} policy
|
||||
- the flag is not set on attributes with other policies except NLA_UNSPEC
|
||||
- the flag is set on attribute passed to nla_parse_nested()
|
||||
"
|
||||
|
||||
Sending messages with nested attribute without NLA_F_NESTED would cause failed
|
||||
validation. For example,
|
||||
|
||||
$ drbdsetup new-resource r0
|
||||
Invalid argument
|
||||
|
||||
This patch adds NLA_F_NESTED flag to all nested attributes.
|
||||
|
||||
Signed-off-by: He Zhe <zhe.he@windriver.com>
|
||||
[mvb: Adapted to drbd-utils 8.4.3.]
|
||||
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
|
||||
---
|
||||
user/libgenl.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/user/libgenl.h b/user/libgenl.h
|
||||
index b1c3eab345ec..3b1146109772 100644
|
||||
--- a/user/libgenl.h
|
||||
+++ b/user/libgenl.h
|
||||
@@ -851,7 +851,7 @@ static inline struct nlattr *nla_nest_start(struct msg_buff *msg, int attrtype)
|
||||
{
|
||||
struct nlattr *start = (struct nlattr *)msg->tail;
|
||||
|
||||
- if (nla_put(msg, attrtype, 0, NULL) < 0)
|
||||
+ if (nla_put(msg, attrtype | NLA_F_NESTED, 0, NULL) < 0)
|
||||
return NULL;
|
||||
|
||||
return start;
|
||||
--
|
||||
2.29.2
|
||||
|
Loading…
Reference in New Issue
Block a user