drbd,drbd-utils: Upgrade to 9.2.1 and drbd-utils to 9.22.0

Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Khem Raj 2022-12-21 19:34:13 -08:00
parent 3d921bff4e
commit 8d332a4508
4 changed files with 151 additions and 6 deletions

View File

@ -0,0 +1,48 @@
From 5adae6737e919d957a08df437951ccb6996f9882 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 21 Dec 2022 19:16:03 -0800
Subject: [PATCH 1/2] replace off64_t with off_t
off_t is already 64-bits when _FILE_OFFSET_BITS=64
using off_t also makes it portable on musl systems
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
user/v9/drbdadm_main.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/user/v9/drbdadm_main.c b/user/v9/drbdadm_main.c
index 91e9507d..2030946c 100644
--- a/user/v9/drbdadm_main.c
+++ b/user/v9/drbdadm_main.c
@@ -1264,11 +1264,11 @@ static int adm_resource(const struct cfg_ctx *ctx)
return ex;
}
-static off64_t read_drbd_dev_size(int minor)
+static off_t read_drbd_dev_size(int minor)
{
char *path;
FILE *file;
- off64_t val;
+ off_t val;
int r;
m_asprintf(&path, "/sys/block/drbd%d/size", minor);
@@ -1289,9 +1289,9 @@ int adm_resize(const struct cfg_ctx *ctx)
char *argv[MAX_ARGS];
struct d_option *opt;
bool is_resize = !strcmp(ctx->cmd->name, "resize");
- off64_t old_size = -1;
- off64_t target_size = 0;
- off64_t new_size;
+ off_t old_size = -1;
+ off_t target_size = 0;
+ off_t new_size;
int argc = 0;
int silent;
int ex;
--
2.39.0

View File

@ -0,0 +1,96 @@
From b70e5bf5bfa5fa2c2fffe08bcf300da1d3583602 Mon Sep 17 00:00:00 2001
From: Lars Ellenberg <lars.ellenberg@linbit.com>
Date: Wed, 9 Nov 2022 11:01:54 +0100
Subject: [PATCH 2/2] drbdadm: drop use of GLOB_MAGCHAR, use strchr heuristic only
Fixup for
2022-09-05 4a1b5900 drbdadm: allow files from an expanded include glob to vanish
When using the `include` statement, if the glob did not match any file,
there is nothing to do, silently ignore. Unless it was no glob, but a literal,
which we would expect to exist.
Also, there is a race between expanding a glob and accessing the file.
That also should not happen for literals, though.
Since we still had the heuristic anyways, because apparently |GLOB_MAGCHAR
does not happen for GLOB_NOMATCH returns, and there exist non-GNU libc that
don't (and likely won't) implement that extension, just forget about
(gl_flags & GLOB_MAGCHAR) but use the incomplete strchr heuristic only.
Sourced From Alpine: https://git.alpinelinux.org/aports/tree/main/drbd-utils/drop_use_of_GLOB_MAGCHAR.patch
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
user/v9/drbdadm_parser.c | 35 ++++++++++++++++++++---------------
1 file changed, 20 insertions(+), 15 deletions(-)
diff --git a/user/v9/drbdadm_parser.c b/user/v9/drbdadm_parser.c
index b2f6ed8a..9a0a775d 100644
--- a/user/v9/drbdadm_parser.c
+++ b/user/v9/drbdadm_parser.c
@@ -1947,14 +1947,29 @@ void include_stmt(char *str)
size_t i;
int r;
- cwd = pushd_to_current_config_file_unless_stdin();
-
- /* """
+ /*
+ * If the glob did not match any file,
+ * there is nothing to do, silently ignore.
+ * Unless it was no glob, but a literal,
+ * which we would expect to exist.
+ *
+ * """
* As a GNU extension, pglob->gl_flags is set to the
* flags specified, ored with GLOB_MAGCHAR if any
* metacharacters were found.
* """
+ *
+ * But apparently |GLOB_MAGCHAR does not happen for GLOB_NOMATCH returns,
+ * at least not consistently :-(
+ * Also, there exist non-GNU libc
+ * So we have this incomplete strchr heuristic anyways.
*/
+ bool contains_glob_magic_char =
+ strchr(str, '*') ||
+ strchr(str, '?') ||
+ strchr(str, '[');
+
+ cwd = pushd_to_current_config_file_unless_stdin();
r = glob(str, 0, NULL, &glob_buf);
if (r == 0) {
for (i=0; i<glob_buf.gl_pathc; i++) {
@@ -1965,7 +1980,7 @@ void include_stmt(char *str)
if (f) {
include_file(f, strdup(glob_buf.gl_pathv[i]));
fclose(f);
- } else if (errno == ENOENT && glob_buf.gl_flags & GLOB_MAGCHAR) {
+ } else if (errno == ENOENT && contains_glob_magic_char) {
/* Noisily ignore race between glob expansion
* and actual open. */
err("%s:%d: include file vanished after glob expansion '%s'.\n",
@@ -1979,17 +1994,7 @@ void include_stmt(char *str)
}
globfree(&glob_buf);
} else if (r == GLOB_NOMATCH) {
- /*
- * If the glob did not match any file,
- * there is nothing to do, silently ignore.
- * Unless it was no glob, but a literal,
- * which we would expect to exist.
- * Apparently |GLOB_MAGCHAR does not happen for GLOB_NOMATCH returns,
- * at least not consistently :-(
- * So we have this strchr heuristic anyways.
- */
- /* if (!(glob_buf.gl_flags & GLOB_MAGCHAR)) { */
- if (!strchr(str, '?') && !strchr(str, '*') && !strchr(str, '[')) {
+ if (!contains_glob_magic_char) {
err("%s:%d: Failed to open include file '%s'.\n",
config_save, line, str);
config_valid = 0;
--
2.39.0

View File

@ -8,14 +8,15 @@ SECTION = "admin"
LICENSE = "GPL-2.0-or-later"
LIC_FILES_CHKSUM = "file://COPYING;md5=5574c6965ae5f583e55880e397fbb018"
SRC_URI = "git://github.com/LINBIT/drbd-utils;name=drbd-utils;branch=${PV};protocol=https \
SRC_URI = "git://github.com/LINBIT/drbd-utils;name=drbd-utils;branch=master;protocol=https \
git://github.com/LINBIT/drbd-headers;name=drbd-headers;destsuffix=git/drbd-headers;branch=master;protocol=https \
file://0001-drbdmon-add-LDFLAGS-when-linking.patch \
file://0001-replace-off64_t-with-off_t.patch \
${@bb.utils.contains('DISTRO_FEATURES','usrmerge','file://0001-drbd-utils-support-usrmerge.patch','',d)} \
"
SRCREV_drbd-utils = "087ee6b4961ca154d76e4211223b03149373bed8"
SRCREV_drbd-headers = "f1529aa84e9d2f66c96ad283a1bbb708aabf03f7"
SRC_URI:append:libc-musl = " file://0002-drbdadm-drop-use-of-GLOB_MAGCHAR-use-strchr-heuristi.patch "
SRCREV_drbd-utils = "409097fe02187f83790b88ac3e0d94f3c167adab"
SRCREV_drbd-headers = "9a0f151fa0085f57910a2dcbbd658d6069554f62"
SRCREV_FORMAT = "drbd-utils_drbd-headers"

View File

@ -8,10 +8,10 @@ LICENSE = "GPL-2.0-only"
LIC_FILES_CHKSUM = "file://COPYING;md5=5574c6965ae5f583e55880e397fbb018"
DEPENDS = "virtual/kernel"
SRC_URI = "http://www.linbit.com/downloads/drbd/9.0/drbd-${PV}.tar.gz \
SRC_URI = "https://pkg.linbit.com//downloads/drbd/9/${BP}.tar.gz \
file://check_existence_of_modules_before_installing.patch \
"
SRC_URI[sha256sum] = "14970459f55bc465503b88b24d1a266b2ace0d69fe3cb387005b8477cd6475ed"
SRC_URI[sha256sum] = "f59ee795188f21d4a62c5319c371ebad65ab3fb9b55e5212c3f1dd558978a843"
inherit module