Sync from SUSE:SLFO:Main drbd revision 92ba344a60ecf13120c13354e3f32f8d
This commit is contained in:
81
0001-drbd-Fix-memory-leak.patch
Normal file
81
0001-drbd-Fix-memory-leak.patch
Normal file
@@ -0,0 +1,81 @@
|
||||
From d64ebe7eb7df8c622b20bca38f3d7f4c7bb033c9 Mon Sep 17 00:00:00 2001
|
||||
From: "zhengbing.huang" <zhengbing.huang@easystack.cn>
|
||||
Date: Sun, 15 Dec 2024 14:50:56 +0800
|
||||
Subject: [PATCH] drbd: Fix memory leak
|
||||
|
||||
In the output of kmemleak, we have the followe backtrace:
|
||||
|
||||
unreferenced object 0xffff8885b57cda80 (size 64):
|
||||
comm "drbd_r_testimg4", pid 37104, jiffies 4494192827 (age 127162.843s)
|
||||
hex dump (first 32 bytes):
|
||||
31 20 6f 66 20 32 20 6e 6f 64 65 73 20 76 69 73 1 of 2 nodes vis
|
||||
69 62 6c 65 2c 20 6e 65 65 64 20 32 20 66 6f 72 ible, need 2 for
|
||||
backtrace:
|
||||
[<000000006d641d68>] __kmalloc_track_caller+0x15c/0x270
|
||||
[<000000006a7ffbcf>] kvasprintf+0xa7/0x120
|
||||
[<000000002d2f15b3>] drbd_state_err+0xa9/0x190 [drbd]
|
||||
[<000000006aa2f3df>] __is_valid_soft_transition+0xe99/0xec0 [drbd]
|
||||
[<0000000009d68cc7>] try_state_change+0x4f0/0x840 [drbd]
|
||||
[<00000000d5640f06>] ___end_state_change+0x140/0x12a0 [drbd]
|
||||
[<000000009f4b8d71>] __end_state_change+0xa1/0x130 [drbd]
|
||||
[<000000001c6de1a7>] change_connection_state+0x5ee/0xbd0 [drbd]
|
||||
[<00000000ce4408d6>] process_twopc+0x1d3e/0x2ce0 [drbd]
|
||||
[<00000000df3af6e8>] receive_twopc+0x17b/0x2b0 [drbd]
|
||||
[<000000009701f919>] drbd_receiver+0x311/0x6e0 [drbd]
|
||||
[<0000000092c4aeb1>] drbd_thread_setup+0x19d/0x430 [drbd]
|
||||
[<0000000098e316ab>] kthread+0x19c/0x1c0
|
||||
[<000000004c72b3a8>] ret_from_fork+0x1f/0x40
|
||||
|
||||
This is a memory leak.
|
||||
|
||||
In drbd_state_err() function, if resource->state_change_err_str is a null pointer,
|
||||
the err_str will not be free.
|
||||
And _drbd_state_err() has same issues.
|
||||
|
||||
So, if err_str has not put to up layer, free it in current function.
|
||||
|
||||
Signed-off-by: zhengbing.huang <zhengbing.huang@easystack.cn>
|
||||
Signed-off-by: Joel Colledge <joel.colledge@linbit.com>
|
||||
---
|
||||
drbd/drbd_state.c | 14 ++++++++++----
|
||||
1 file changed, 10 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/drbd/drbd_state.c b/drbd/drbd_state.c
|
||||
index f498eaa60396..0e693c8e3af0 100644
|
||||
--- a/drbd/drbd_state.c
|
||||
+++ b/drbd/drbd_state.c
|
||||
@@ -1557,10 +1557,13 @@ static __printf(2, 3) void _drbd_state_err(struct change_context *context, const
|
||||
va_end(args);
|
||||
if (!err_str)
|
||||
return;
|
||||
- if (context->err_str)
|
||||
- *context->err_str = err_str;
|
||||
if (context->flags & CS_VERBOSE)
|
||||
drbd_err(resource, "%s\n", err_str);
|
||||
+
|
||||
+ if (context->err_str)
|
||||
+ *context->err_str = err_str;
|
||||
+ else
|
||||
+ kfree(err_str);
|
||||
}
|
||||
|
||||
static __printf(2, 3) void drbd_state_err(struct drbd_resource *resource, const char *fmt, ...)
|
||||
@@ -1573,10 +1576,13 @@ static __printf(2, 3) void drbd_state_err(struct drbd_resource *resource, const
|
||||
va_end(args);
|
||||
if (!err_str)
|
||||
return;
|
||||
- if (resource->state_change_err_str)
|
||||
- *resource->state_change_err_str = err_str;
|
||||
if (resource->state_change_flags & CS_VERBOSE)
|
||||
drbd_err(resource, "%s\n", err_str);
|
||||
+
|
||||
+ if (resource->state_change_err_str)
|
||||
+ *resource->state_change_err_str = err_str;
|
||||
+ else
|
||||
+ kfree(err_str);
|
||||
}
|
||||
|
||||
static enum drbd_state_rv __is_valid_soft_transition(struct drbd_resource *resource)
|
||||
--
|
||||
2.43.0
|
||||
|
@@ -1,82 +0,0 @@
|
||||
From 8c2c783a09d81f0a725e7a3ae48be4ceb2d79a63 Mon Sep 17 00:00:00 2001
|
||||
From: Joel Colledge <joel.colledge@linbit.com>
|
||||
Date: Fri, 8 Sep 2023 11:26:01 +0200
|
||||
Subject: [PATCH 06/20] drbd: log numeric value of drbd_state_rv as well as
|
||||
string form
|
||||
|
||||
"Auto-promote failed: ?" was seen in a log. Logging the numeric value of
|
||||
the state change return value gives us more information about what
|
||||
happened in such a case.
|
||||
---
|
||||
drbd/drbd_main.c | 8 ++++----
|
||||
drbd/drbd_receiver.c | 6 +++---
|
||||
drbd/drbd_state.c | 3 ++-
|
||||
3 files changed, 9 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/drbd/drbd_main.c b/drbd/drbd_main.c
|
||||
index 810df864f60b..e26cf7e2b008 100644
|
||||
--- a/drbd/drbd_main.c
|
||||
+++ b/drbd/drbd_main.c
|
||||
@@ -2698,8 +2698,8 @@ static int drbd_open(struct block_device *bdev, fmode_t mode)
|
||||
if (resource->role[NOW] == R_SECONDARY) {
|
||||
rv = try_to_promote(device, timeout, (mode & FMODE_NDELAY));
|
||||
if (rv < SS_SUCCESS)
|
||||
- drbd_info(resource, "Auto-promote failed: %s\n",
|
||||
- drbd_set_st_err_str(rv));
|
||||
+ drbd_info(resource, "Auto-promote failed: %s (%d)\n",
|
||||
+ drbd_set_st_err_str(rv), rv);
|
||||
}
|
||||
} else if ((mode & FMODE_NDELAY) == 0) {
|
||||
/* Double check peers
|
||||
@@ -2856,8 +2856,8 @@ static void drbd_release(struct gendisk *gd, fmode_t mode)
|
||||
!test_bit(EXPLICIT_PRIMARY, &resource->flags)) {
|
||||
rv = drbd_set_role(resource, R_SECONDARY, false, NULL);
|
||||
if (rv < SS_SUCCESS)
|
||||
- drbd_warn(resource, "Auto-demote failed: %s\n",
|
||||
- drbd_set_st_err_str(rv));
|
||||
+ drbd_warn(resource, "Auto-demote failed: %s (%d)\n",
|
||||
+ drbd_set_st_err_str(rv), rv);
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/drbd/drbd_receiver.c b/drbd/drbd_receiver.c
|
||||
index 95cf7ac36762..2162d13cb25e 100644
|
||||
--- a/drbd/drbd_receiver.c
|
||||
+++ b/drbd/drbd_receiver.c
|
||||
@@ -983,8 +983,8 @@ static int connect_work(struct drbd_work *work, int cancel)
|
||||
drbd_send_disconnect(connection);
|
||||
apply_local_state_change(connection, OUTDATE_DISKS_AND_DISCONNECT, force_demote);
|
||||
} else {
|
||||
- drbd_info(connection, "Failure to connect %d %s; retrying\n",
|
||||
- rv, drbd_set_st_err_str(rv));
|
||||
+ drbd_info(connection, "Failure to connect: %s (%d); retrying\n",
|
||||
+ drbd_set_st_err_str(rv), rv);
|
||||
change_cstate(connection, C_NETWORK_FAILURE, CS_HARD);
|
||||
}
|
||||
|
||||
@@ -6107,7 +6107,7 @@ out:
|
||||
}
|
||||
|
||||
if (rv < SS_SUCCESS) {
|
||||
- drbd_err(resource, "State change failed: %s\n", drbd_set_st_err_str(rv));
|
||||
+ drbd_err(resource, "State change failed: %s (%d)\n", drbd_set_st_err_str(rv), rv);
|
||||
if (rv == SS_PRIMARY_READER)
|
||||
log_openers(resource);
|
||||
}
|
||||
diff --git a/drbd/drbd_state.c b/drbd/drbd_state.c
|
||||
index 8b60afeb097b..23eab7f867aa 100644
|
||||
--- a/drbd/drbd_state.c
|
||||
+++ b/drbd/drbd_state.c
|
||||
@@ -791,7 +791,8 @@ static enum drbd_state_rv ___end_state_change(struct drbd_resource *resource, st
|
||||
rv = try_state_change(resource);
|
||||
if (rv < SS_SUCCESS) {
|
||||
if (flags & CS_VERBOSE) {
|
||||
- drbd_err(resource, "State change failed: %s\n", drbd_set_st_err_str(rv));
|
||||
+ drbd_err(resource, "State change failed: %s (%d)\n",
|
||||
+ drbd_set_st_err_str(rv), rv);
|
||||
print_state_change(resource, "Failed: ");
|
||||
}
|
||||
goto out;
|
||||
--
|
||||
2.35.3
|
||||
|
@@ -1,80 +0,0 @@
|
||||
From c34a13c3df85352124e94456f81e3d4ba4f52440 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Moritz=20=22WanzenBug=22=20Wanzenb=C3=B6ck?=
|
||||
<moritz.wanzenboeck@linbit.com>
|
||||
Date: Fri, 8 Sep 2023 12:20:10 +0200
|
||||
Subject: [PATCH 08/20] compat: block: introduce holder ops
|
||||
|
||||
See also upstream Linux kernel commit
|
||||
0718afd47f70 ("block: introduce holder ops")
|
||||
|
||||
Original message:
|
||||
|
||||
Add a new blk_holder_ops structure, which is passed to blkdev_get_by_* and
|
||||
installed in the block_device for exclusive claims. It will be used to
|
||||
allow the block layer to call back into the user of the block device for
|
||||
thing like notification of a removed device or a device resize.
|
||||
---
|
||||
.../cocci/blkdev_get_by_path__no_has_holder_ops.cocci | 6 ++++++
|
||||
drbd/drbd-kernel-compat/gen_patch_names.c | 3 +++
|
||||
.../tests/blkdev_get_by_path_has_holder_ops.c | 7 +++++++
|
||||
drbd/drbd_nl.c | 3 ++-
|
||||
4 files changed, 18 insertions(+), 1 deletion(-)
|
||||
create mode 100644 drbd/drbd-kernel-compat/cocci/blkdev_get_by_path__no_has_holder_ops.cocci
|
||||
create mode 100644 drbd/drbd-kernel-compat/tests/blkdev_get_by_path_has_holder_ops.c
|
||||
|
||||
diff --git a/drbd/drbd-kernel-compat/cocci/blkdev_get_by_path__no_has_holder_ops.cocci b/drbd/drbd-kernel-compat/cocci/blkdev_get_by_path__no_has_holder_ops.cocci
|
||||
new file mode 100644
|
||||
index 000000000000..050d89e6fe0d
|
||||
--- /dev/null
|
||||
+++ b/drbd/drbd-kernel-compat/cocci/blkdev_get_by_path__no_has_holder_ops.cocci
|
||||
@@ -0,0 +1,6 @@
|
||||
+@@
|
||||
+expression path, mode, holder, ops;
|
||||
+@@
|
||||
+ blkdev_get_by_path(path, mode, holder
|
||||
+- , ops
|
||||
+ )
|
||||
diff --git a/drbd/drbd-kernel-compat/gen_patch_names.c b/drbd/drbd-kernel-compat/gen_patch_names.c
|
||||
index 959bbc351e1b..7071a0a4c5ec 100644
|
||||
--- a/drbd/drbd-kernel-compat/gen_patch_names.c
|
||||
+++ b/drbd/drbd-kernel-compat/gen_patch_names.c
|
||||
@@ -556,6 +556,9 @@ int main(int argc, char **argv)
|
||||
patch(1, "__bio_add_page", true, false,
|
||||
COMPAT_HAVE___BIO_ADD_PAGE, "present");
|
||||
|
||||
+ patch(1, "blkdev_get_by_path", true, false,
|
||||
+ COMPAT_BLKDEV_GET_BY_PATH_HAS_HOLDER_OPS, "has_holder_ops");
|
||||
+
|
||||
/* #define BLKDEV_ISSUE_ZEROOUT_EXPORTED */
|
||||
/* #define BLKDEV_ZERO_NOUNMAP */
|
||||
|
||||
diff --git a/drbd/drbd-kernel-compat/tests/blkdev_get_by_path_has_holder_ops.c b/drbd/drbd-kernel-compat/tests/blkdev_get_by_path_has_holder_ops.c
|
||||
new file mode 100644
|
||||
index 000000000000..02a560782f37
|
||||
--- /dev/null
|
||||
+++ b/drbd/drbd-kernel-compat/tests/blkdev_get_by_path_has_holder_ops.c
|
||||
@@ -0,0 +1,7 @@
|
||||
+/* { "version": "v6.5-rc1", "commit": "0718afd47f70cf46877c39c25d06b786e1a3f36c", "comment": "block: introduce holder ops", "author": "Christoph Hellwig <hch@lst.de>", "date": "Thu Jun 1 11:44:52 2023 +0200" } */
|
||||
+#include <linux/blkdev.h>
|
||||
+
|
||||
+struct block_device *foo(const char *bdev_path, struct blk_holder_ops *ops)
|
||||
+{
|
||||
+ return blkdev_get_by_path(bdev_path, 0, NULL, ops);
|
||||
+}
|
||||
diff --git a/drbd/drbd_nl.c b/drbd/drbd_nl.c
|
||||
index 0fc1d84a996f..0a67bfa4ca52 100644
|
||||
--- a/drbd/drbd_nl.c
|
||||
+++ b/drbd/drbd_nl.c
|
||||
@@ -2560,7 +2560,8 @@ static struct block_device *open_backing_dev(struct drbd_device *device,
|
||||
const char *bdev_path, void *claim_ptr)
|
||||
{
|
||||
struct block_device *bdev = blkdev_get_by_path(bdev_path,
|
||||
- FMODE_READ | FMODE_WRITE | FMODE_EXCL, claim_ptr);
|
||||
+ FMODE_READ | FMODE_WRITE | FMODE_EXCL,
|
||||
+ claim_ptr, NULL);
|
||||
if (IS_ERR(bdev)) {
|
||||
drbd_err(device, "open(\"%s\") failed with %ld\n",
|
||||
bdev_path, PTR_ERR(bdev));
|
||||
--
|
||||
2.35.3
|
||||
|
@@ -1,129 +0,0 @@
|
||||
From b993152e80676f5b9ce583c9471b630cbd0675d7 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Moritz=20=22WanzenBug=22=20Wanzenb=C3=B6ck?=
|
||||
<moritz.wanzenboeck@linbit.com>
|
||||
Date: Fri, 8 Sep 2023 15:09:47 +0200
|
||||
Subject: [PATCH 11/20] compat: block: pass a gendisk to ->open
|
||||
|
||||
See also upstream Linux kernel commit
|
||||
d32e2bf83791 ("block: pass a gendisk to ->open")
|
||||
|
||||
Original message:
|
||||
|
||||
->open is only called on the whole device. Make that explicit by
|
||||
passing a gendisk instead of the block_device.
|
||||
---
|
||||
...ice_operations_open__no_takes_gendisk.cocci | 18 ++++++++++++++++++
|
||||
drbd/drbd-kernel-compat/gen_patch_names.c | 3 +++
|
||||
...lock_device_operations_open_takes_gendisk.c | 17 +++++++++++++++++
|
||||
drbd/drbd_main.c | 10 +++++-----
|
||||
4 files changed, 43 insertions(+), 5 deletions(-)
|
||||
create mode 100644 drbd/drbd-kernel-compat/cocci/block_device_operations_open__no_takes_gendisk.cocci
|
||||
create mode 100644 drbd/drbd-kernel-compat/tests/block_device_operations_open_takes_gendisk.c
|
||||
|
||||
diff --git a/drbd/drbd-kernel-compat/cocci/block_device_operations_open__no_takes_gendisk.cocci b/drbd/drbd-kernel-compat/cocci/block_device_operations_open__no_takes_gendisk.cocci
|
||||
new file mode 100644
|
||||
index 000000000000..2ba2856da9db
|
||||
--- /dev/null
|
||||
+++ b/drbd/drbd-kernel-compat/cocci/block_device_operations_open__no_takes_gendisk.cocci
|
||||
@@ -0,0 +1,18 @@
|
||||
+@ drbd_open_arg @
|
||||
+identifier gd;
|
||||
+fresh identifier bdev = "" ## "bdev";
|
||||
+@@
|
||||
+ drbd_open(
|
||||
+- struct gendisk *gd,
|
||||
++ struct block_device *bdev,
|
||||
+ ... ) {
|
||||
+<...
|
||||
+(
|
||||
+- gd->part0
|
||||
++ bdev
|
||||
+|
|
||||
+- gd
|
||||
++ bdev->bd_disk
|
||||
+)
|
||||
+...>
|
||||
+}
|
||||
diff --git a/drbd/drbd-kernel-compat/gen_patch_names.c b/drbd/drbd-kernel-compat/gen_patch_names.c
|
||||
index 7071a0a4c5ec..6e4f06d9a3a7 100644
|
||||
--- a/drbd/drbd-kernel-compat/gen_patch_names.c
|
||||
+++ b/drbd/drbd-kernel-compat/gen_patch_names.c
|
||||
@@ -559,6 +559,9 @@ int main(int argc, char **argv)
|
||||
patch(1, "blkdev_get_by_path", true, false,
|
||||
COMPAT_BLKDEV_GET_BY_PATH_HAS_HOLDER_OPS, "has_holder_ops");
|
||||
|
||||
+ patch(1, "block_device_operations_open", true, false,
|
||||
+ COMPAT_BLOCK_DEVICE_OPERATIONS_OPEN_TAKES_GENDISK, "takes_gendisk");
|
||||
+
|
||||
/* #define BLKDEV_ISSUE_ZEROOUT_EXPORTED */
|
||||
/* #define BLKDEV_ZERO_NOUNMAP */
|
||||
|
||||
diff --git a/drbd/drbd-kernel-compat/tests/block_device_operations_open_takes_gendisk.c b/drbd/drbd-kernel-compat/tests/block_device_operations_open_takes_gendisk.c
|
||||
new file mode 100644
|
||||
index 000000000000..d5f20fd569fb
|
||||
--- /dev/null
|
||||
+++ b/drbd/drbd-kernel-compat/tests/block_device_operations_open_takes_gendisk.c
|
||||
@@ -0,0 +1,17 @@
|
||||
+/* { "version": "v6.5-rc1", "commit": "d32e2bf83791727a84ad5d3e3d713e82f9adbe30", "comment": "block: pass a gendisk to ->open", "author": "Christoph Hellwig <hch@lst.de>", "date": "Thu Jun 8 13:02:36 2023 +0200" } */
|
||||
+#include <linux/blkdev.h>
|
||||
+
|
||||
+#ifndef __same_type
|
||||
+# define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
|
||||
+#endif
|
||||
+
|
||||
+int foo_open(struct gendisk *disk, unsigned int mode)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+void foo(void)
|
||||
+{
|
||||
+ struct block_device_operations ops;
|
||||
+ BUILD_BUG_ON(!(__same_type(ops.open, &foo_open)));
|
||||
+}
|
||||
diff --git a/drbd/drbd_main.c b/drbd/drbd_main.c
|
||||
index e6ed1185c710..53cb4c9e7db3 100644
|
||||
--- a/drbd/drbd_main.c
|
||||
+++ b/drbd/drbd_main.c
|
||||
@@ -52,7 +52,7 @@
|
||||
#include "drbd_meta_data.h"
|
||||
#include "drbd_dax_pmem.h"
|
||||
|
||||
-static int drbd_open(struct block_device *bdev, fmode_t mode);
|
||||
+static int drbd_open(struct gendisk *gd, fmode_t mode);
|
||||
static void drbd_release(struct gendisk *gd, fmode_t mode);
|
||||
static void md_sync_timer_fn(struct timer_list *t);
|
||||
static int w_bitmap_io(struct drbd_work *w, int unused);
|
||||
@@ -2646,9 +2646,9 @@ out:
|
||||
spin_unlock(&device->openers_lock);
|
||||
}
|
||||
|
||||
-static int drbd_open(struct block_device *bdev, fmode_t mode)
|
||||
+static int drbd_open(struct gendisk *gd, fmode_t mode)
|
||||
{
|
||||
- struct drbd_device *device = bdev->bd_disk->private_data;
|
||||
+ struct drbd_device *device = gd->private_data;
|
||||
struct drbd_resource *resource = device->resource;
|
||||
long timeout = resource->res_opts.auto_promote_timeout * HZ / 10;
|
||||
enum ioc_rv r;
|
||||
@@ -2664,7 +2664,7 @@ static int drbd_open(struct block_device *bdev, fmode_t mode)
|
||||
|
||||
/* Fail read-write open early,
|
||||
* in case someone explicitly set us read-only (blockdev --setro) */
|
||||
- if (bdev_read_only(bdev) && (mode & FMODE_WRITE))
|
||||
+ if (bdev_read_only(gd->part0) && (mode & FMODE_WRITE))
|
||||
return -EACCES;
|
||||
|
||||
if (resource->fail_io[NOW])
|
||||
@@ -2740,7 +2740,7 @@ out:
|
||||
|
||||
mutex_unlock(&resource->open_release);
|
||||
if (err) {
|
||||
- drbd_release(bdev->bd_disk, mode);
|
||||
+ drbd_release(gd, mode);
|
||||
if (err == -EAGAIN && !(mode & FMODE_NDELAY))
|
||||
err = -EMEDIUMTYPE;
|
||||
}
|
||||
--
|
||||
2.35.3
|
||||
|
@@ -1,38 +0,0 @@
|
||||
From 9e087399533445e3df60a34f26a1e6a285b0504a Mon Sep 17 00:00:00 2001
|
||||
From: Joel Colledge <joel.colledge@linbit.com>
|
||||
Date: Tue, 12 Sep 2023 16:36:43 +0200
|
||||
Subject: [PATCH 13/20] drbd: remove unused extern for conn_try_outdate_peer()
|
||||
|
||||
---
|
||||
drbd/drbd_int.h | 1 -
|
||||
drbd/drbd_nl.c | 2 +-
|
||||
2 files changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drbd/drbd_int.h b/drbd/drbd_int.h
|
||||
index 4f3228d5a4d1..f6e7c3ac2629 100644
|
||||
--- a/drbd/drbd_int.h
|
||||
+++ b/drbd/drbd_int.h
|
||||
@@ -1932,7 +1932,6 @@ extern void drbd_reconsider_queue_parameters(struct drbd_device *device,
|
||||
struct drbd_backing_dev *bdev);
|
||||
extern bool barrier_pending(struct drbd_resource *resource);
|
||||
extern enum drbd_state_rv drbd_set_role(struct drbd_resource *, enum drbd_role, bool, struct sk_buff *);
|
||||
-extern bool conn_try_outdate_peer(struct drbd_connection *connection);
|
||||
extern void conn_try_outdate_peer_async(struct drbd_connection *connection);
|
||||
extern int drbd_maybe_khelper(struct drbd_device *, struct drbd_connection *, char *);
|
||||
extern int drbd_create_peer_device_default_config(struct drbd_peer_device *peer_device);
|
||||
diff --git a/drbd/drbd_nl.c b/drbd/drbd_nl.c
|
||||
index 0a67bfa4ca52..cb5cdb184824 100644
|
||||
--- a/drbd/drbd_nl.c
|
||||
+++ b/drbd/drbd_nl.c
|
||||
@@ -768,7 +768,7 @@ static bool intentional_diskless(struct drbd_resource *resource)
|
||||
return intentional_diskless;
|
||||
}
|
||||
|
||||
-bool conn_try_outdate_peer(struct drbd_connection *connection)
|
||||
+static bool conn_try_outdate_peer(struct drbd_connection *connection)
|
||||
{
|
||||
struct drbd_resource *resource = connection->resource;
|
||||
unsigned long last_reconnect_jif;
|
||||
--
|
||||
2.35.3
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,202 +0,0 @@
|
||||
From 3b9fcc2cfaa32766724f371cc2054e057adbc425 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Moritz=20=22WanzenBug=22=20Wanzenb=C3=B6ck?=
|
||||
<moritz.wanzenboeck@linbit.com>
|
||||
Date: Mon, 11 Sep 2023 13:36:07 +0200
|
||||
Subject: [PATCH 15/20] compat: block: use the holder as indication for
|
||||
exclusive opens
|
||||
|
||||
See also upstream Linux kernel commit
|
||||
2736e8eeb0cc ("block: use the holder as indication for exclusive opens")
|
||||
Original message:
|
||||
|
||||
The current interface for exclusive opens is rather confusing as it
|
||||
requires both the FMODE_EXCL flag and a holder. Remove the need to pass
|
||||
FMODE_EXCL and just key off the exclusive open off a non-NULL holder.
|
||||
|
||||
For blkdev_put this requires adding the holder argument, which provides
|
||||
better debug checking that only the holder actually releases the hold,
|
||||
but at the same time allows removing the now superfluous mode argument.
|
||||
---
|
||||
.../cocci/blkdev_put__no_has_holder.cocci | 38 +++++++++++++++++++
|
||||
drbd/drbd-kernel-compat/gen_patch_names.c | 3 ++
|
||||
.../tests/blkdev_put_has_holder.c | 17 +++++++++
|
||||
drbd/drbd_nl.c | 28 ++++++++------
|
||||
4 files changed, 75 insertions(+), 11 deletions(-)
|
||||
create mode 100644 drbd/drbd-kernel-compat/cocci/blkdev_put__no_has_holder.cocci
|
||||
create mode 100644 drbd/drbd-kernel-compat/tests/blkdev_put_has_holder.c
|
||||
|
||||
diff --git a/drbd/drbd-kernel-compat/cocci/blkdev_put__no_has_holder.cocci b/drbd/drbd-kernel-compat/cocci/blkdev_put__no_has_holder.cocci
|
||||
new file mode 100644
|
||||
index 000000000000..c903bc2d529c
|
||||
--- /dev/null
|
||||
+++ b/drbd/drbd-kernel-compat/cocci/blkdev_put__no_has_holder.cocci
|
||||
@@ -0,0 +1,38 @@
|
||||
+@@
|
||||
+expression path, mode;
|
||||
+@@
|
||||
+ blkdev_get_by_path(
|
||||
+ path,
|
||||
+- mode,
|
||||
++ mode | FMODE_EXCL,
|
||||
+ ...
|
||||
+ )
|
||||
+
|
||||
+@@
|
||||
+expression bdev, holder;
|
||||
+@@
|
||||
+ blkdev_put(
|
||||
+ bdev,
|
||||
+- holder
|
||||
++ FMODE_READ | FMODE_WRITE | FMODE_EXCL
|
||||
+ )
|
||||
+
|
||||
+@@
|
||||
+identifier device, bdev, holder, do_bd_unlink;
|
||||
+@@
|
||||
+ void close_backing_dev(
|
||||
+ struct drbd_device *device,
|
||||
+ struct block_device *bdev,
|
||||
+- void *holder,
|
||||
+ bool do_bd_unlink
|
||||
+ ) { ... }
|
||||
+
|
||||
+@@
|
||||
+expression device, bdev, holder, do_bd_unlink;
|
||||
+@@
|
||||
+ close_backing_dev(
|
||||
+ device,
|
||||
+ bdev,
|
||||
+- holder,
|
||||
+ do_bd_unlink
|
||||
+ )
|
||||
diff --git a/drbd/drbd-kernel-compat/gen_patch_names.c b/drbd/drbd-kernel-compat/gen_patch_names.c
|
||||
index 6e4f06d9a3a7..4761c1ef7d0c 100644
|
||||
--- a/drbd/drbd-kernel-compat/gen_patch_names.c
|
||||
+++ b/drbd/drbd-kernel-compat/gen_patch_names.c
|
||||
@@ -562,6 +562,9 @@ int main(int argc, char **argv)
|
||||
patch(1, "block_device_operations_open", true, false,
|
||||
COMPAT_BLOCK_DEVICE_OPERATIONS_OPEN_TAKES_GENDISK, "takes_gendisk");
|
||||
|
||||
+ patch(1, "blkdev_put", true, false,
|
||||
+ COMPAT_BLKDEV_PUT_HAS_HOLDER, "has_holder");
|
||||
+
|
||||
/* #define BLKDEV_ISSUE_ZEROOUT_EXPORTED */
|
||||
/* #define BLKDEV_ZERO_NOUNMAP */
|
||||
|
||||
diff --git a/drbd/drbd-kernel-compat/tests/blkdev_put_has_holder.c b/drbd/drbd-kernel-compat/tests/blkdev_put_has_holder.c
|
||||
new file mode 100644
|
||||
index 000000000000..d5f0c5dd0355
|
||||
--- /dev/null
|
||||
+++ b/drbd/drbd-kernel-compat/tests/blkdev_put_has_holder.c
|
||||
@@ -0,0 +1,17 @@
|
||||
+/* { "version": "v6.5-rc1", "commit": "ae220766d87cd6799dbf918fea10613ae14c0654", "comment": "block: remove the unused mode argument to ->release", "author": "Christoph Hellwig <hch@lst.de>", "date": "Thu Jun 8 13:02:37 2023 +0200" } */
|
||||
+#include <linux/blkdev.h>
|
||||
+
|
||||
+#ifndef __same_type
|
||||
+# define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
|
||||
+#endif
|
||||
+
|
||||
+void foo_blkdev_put(struct block_device *bdev, void *holder)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
+
|
||||
+void foo(void)
|
||||
+{
|
||||
+ BUILD_BUG_ON(!(__same_type(&blkdev_put, &foo_blkdev_put)));
|
||||
+}
|
||||
+
|
||||
diff --git a/drbd/drbd_nl.c b/drbd/drbd_nl.c
|
||||
index b7e9e43312f9..8c968cf252ca 100644
|
||||
--- a/drbd/drbd_nl.c
|
||||
+++ b/drbd/drbd_nl.c
|
||||
@@ -2536,13 +2536,13 @@ bool want_bitmap(struct drbd_peer_device *peer_device)
|
||||
}
|
||||
|
||||
static void close_backing_dev(struct drbd_device *device, struct block_device *bdev,
|
||||
- bool do_bd_unlink)
|
||||
+ void *holder, bool do_bd_unlink)
|
||||
{
|
||||
if (!bdev)
|
||||
return;
|
||||
if (do_bd_unlink)
|
||||
bd_unlink_disk_holder(bdev, device->vdisk);
|
||||
- blkdev_put(bdev, FMODE_READ | FMODE_WRITE | FMODE_EXCL);
|
||||
+ blkdev_put(bdev, holder);
|
||||
}
|
||||
|
||||
void drbd_backing_dev_free(struct drbd_device *device, struct drbd_backing_dev *ldev)
|
||||
@@ -2552,8 +2552,11 @@ void drbd_backing_dev_free(struct drbd_device *device, struct drbd_backing_dev *
|
||||
|
||||
drbd_dax_close(ldev);
|
||||
|
||||
- close_backing_dev(device, ldev->md_bdev, ldev->md_bdev != ldev->backing_bdev);
|
||||
- close_backing_dev(device, ldev->backing_bdev, true);
|
||||
+ close_backing_dev(device,
|
||||
+ ldev->md_bdev,
|
||||
+ ldev->md.meta_dev_idx < 0 ? (void *)device : (void *)drbd_m_holder,
|
||||
+ ldev->md_bdev != ldev->backing_bdev);
|
||||
+ close_backing_dev(device, ldev->backing_bdev, device, true);
|
||||
|
||||
kfree(ldev->disk_conf);
|
||||
kfree(ldev);
|
||||
@@ -2563,7 +2566,7 @@ static struct block_device *open_backing_dev(struct drbd_device *device,
|
||||
const char *bdev_path, void *claim_ptr)
|
||||
{
|
||||
struct block_device *bdev = blkdev_get_by_path(bdev_path,
|
||||
- FMODE_READ | FMODE_WRITE | FMODE_EXCL,
|
||||
+ FMODE_READ | FMODE_WRITE,
|
||||
claim_ptr, NULL);
|
||||
if (IS_ERR(bdev)) {
|
||||
drbd_err(device, "open(\"%s\") failed with %ld\n",
|
||||
@@ -2588,6 +2591,7 @@ static int open_backing_devices(struct drbd_device *device,
|
||||
struct drbd_backing_dev *nbc)
|
||||
{
|
||||
struct block_device *bdev;
|
||||
+ void *meta_claim_ptr;
|
||||
int err;
|
||||
|
||||
bdev = open_backing_dev(device, new_disk_conf->backing_dev, device);
|
||||
@@ -2597,12 +2601,17 @@ static int open_backing_devices(struct drbd_device *device,
|
||||
err = link_backing_dev(device, new_disk_conf->backing_dev, bdev);
|
||||
if (err) {
|
||||
/* close without unlinking; otherwise error path will try to unlink */
|
||||
- close_backing_dev(device, bdev, false);
|
||||
+ close_backing_dev(device, bdev, device, false);
|
||||
return ERR_OPEN_DISK;
|
||||
}
|
||||
|
||||
nbc->backing_bdev = bdev;
|
||||
|
||||
+ /* meta_claim_ptr: device, if claimed exclusively; shared drbd_m_holder,
|
||||
+ * if potentially shared with other drbd minors
|
||||
+ */
|
||||
+ meta_claim_ptr = (new_disk_conf->meta_dev_idx < 0) ?
|
||||
+ (void *)device : (void *)drbd_m_holder;
|
||||
/*
|
||||
* meta_dev_idx >= 0: external fixed size, possibly multiple
|
||||
* drbd sharing one meta device. TODO in that case, paranoia
|
||||
@@ -2611,10 +2620,7 @@ static int open_backing_devices(struct drbd_device *device,
|
||||
* should check it for you already; but if you don't, or
|
||||
* someone fooled it, we need to double check here)
|
||||
*/
|
||||
- bdev = open_backing_dev(device, new_disk_conf->meta_dev,
|
||||
- /* claim ptr: device, if claimed exclusively; shared drbd_m_holder,
|
||||
- * if potentially shared with other drbd minors */
|
||||
- (new_disk_conf->meta_dev_idx < 0) ? (void*)device : (void*)drbd_m_holder);
|
||||
+ bdev = open_backing_dev(device, new_disk_conf->meta_dev, meta_claim_ptr);
|
||||
if (IS_ERR(bdev))
|
||||
return ERR_OPEN_MD_DISK;
|
||||
|
||||
@@ -2624,7 +2630,7 @@ static int open_backing_devices(struct drbd_device *device,
|
||||
err = link_backing_dev(device, new_disk_conf->meta_dev, bdev);
|
||||
if (err) {
|
||||
/* close without unlinking; otherwise error path will try to unlink */
|
||||
- close_backing_dev(device, bdev, false);
|
||||
+ close_backing_dev(device, bdev, meta_claim_ptr, false);
|
||||
return ERR_OPEN_MD_DISK;
|
||||
}
|
||||
}
|
||||
--
|
||||
2.35.3
|
||||
|
@@ -1,185 +0,0 @@
|
||||
From e3ef0e229a6ae88346164d1507697ae1b397cdf9 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Moritz=20=22WanzenBug=22=20Wanzenb=C3=B6ck?=
|
||||
<moritz.wanzenboeck@linbit.com>
|
||||
Date: Tue, 12 Sep 2023 10:17:08 +0200
|
||||
Subject: [PATCH 18/20] drbd: rework autopromote
|
||||
|
||||
With upstream commit ae220766d87c we lost the ability to keep separate
|
||||
counts for RW and RO openers. Instead, we keep track of openers using a
|
||||
single count, and a flag indicating if the device was opened RW once.
|
||||
|
||||
Once a device was opened RW, it will stay "writable" for DRBD, until all
|
||||
openers are gone. This should offer a good compromise between keeping
|
||||
the old auto-promote behaviour, and the changed device interface.
|
||||
---
|
||||
drbd/drbd_int.h | 3 ++-
|
||||
drbd/drbd_main.c | 38 +++++++++++++++++++++-----------------
|
||||
drbd/drbd_nl.c | 9 +++++----
|
||||
drbd/drbd_state.c | 7 ++++---
|
||||
4 files changed, 32 insertions(+), 25 deletions(-)
|
||||
|
||||
diff --git a/drbd/drbd_int.h b/drbd/drbd_int.h
|
||||
index b705f26e71a4..cf593c09cda1 100644
|
||||
--- a/drbd/drbd_int.h
|
||||
+++ b/drbd/drbd_int.h
|
||||
@@ -1399,7 +1399,8 @@ struct drbd_device {
|
||||
|
||||
struct drbd_bitmap *bitmap;
|
||||
|
||||
- int open_rw_cnt, open_ro_cnt;
|
||||
+ int open_cnt;
|
||||
+ bool writable;
|
||||
/* FIXME clean comments, restructure so it is more obvious which
|
||||
* members are protected by what */
|
||||
|
||||
diff --git a/drbd/drbd_main.c b/drbd/drbd_main.c
|
||||
index 4b0b967c2c97..bb05b2215dfb 100644
|
||||
--- a/drbd/drbd_main.c
|
||||
+++ b/drbd/drbd_main.c
|
||||
@@ -2579,10 +2579,9 @@ static enum ioc_rv inc_open_count(struct drbd_device *device, fmode_t mode)
|
||||
r = IOC_ABORT;
|
||||
else if (!resource->remote_state_change) {
|
||||
r = IOC_OK;
|
||||
+ device->open_cnt++;
|
||||
if (mode & FMODE_WRITE)
|
||||
- device->open_rw_cnt++;
|
||||
- else
|
||||
- device->open_ro_cnt++;
|
||||
+ device->writable = true;
|
||||
}
|
||||
read_unlock_irq(&resource->state_rwlock);
|
||||
|
||||
@@ -2756,8 +2755,10 @@ void drbd_open_counts(struct drbd_resource *resource, int *rw_count_ptr, int *ro
|
||||
|
||||
rcu_read_lock();
|
||||
idr_for_each_entry(&resource->devices, device, vnr) {
|
||||
- rw_count += device->open_rw_cnt;
|
||||
- ro_count += device->open_ro_cnt;
|
||||
+ if (device->writable)
|
||||
+ rw_count += device->open_cnt;
|
||||
+ else
|
||||
+ ro_count += device->open_cnt;
|
||||
}
|
||||
rcu_read_unlock();
|
||||
*rw_count_ptr = rw_count;
|
||||
@@ -2825,33 +2826,35 @@ static void drbd_release(struct gendisk *gd, fmode_t mode)
|
||||
{
|
||||
struct drbd_device *device = gd->private_data;
|
||||
struct drbd_resource *resource = device->resource;
|
||||
+ bool was_writable = device->writable;
|
||||
int open_rw_cnt, open_ro_cnt;
|
||||
|
||||
mutex_lock(&resource->open_release);
|
||||
- if (mode & FMODE_WRITE)
|
||||
- device->open_rw_cnt--;
|
||||
- else
|
||||
- device->open_ro_cnt--;
|
||||
+ device->open_cnt--;
|
||||
|
||||
drbd_open_counts(resource, &open_rw_cnt, &open_ro_cnt);
|
||||
|
||||
- /* last one to close will be responsible for write-out of all dirty pages */
|
||||
- if (mode & FMODE_WRITE && device->open_rw_cnt == 0)
|
||||
+ /* last one to close will be responsible for write-out of all dirty pages.
|
||||
+ * We also reset the writable flag for this device here: later code may
|
||||
+ * check if the device is still opened for writes to determine things
|
||||
+ * like auto-demote.
|
||||
+ */
|
||||
+ if (was_writable && device->open_cnt == 0) {
|
||||
drbd_fsync_device(device);
|
||||
+ device->writable = false;
|
||||
+ }
|
||||
|
||||
if (open_ro_cnt == 0)
|
||||
wake_up_all(&resource->state_wait);
|
||||
|
||||
- if (test_bit(UNREGISTERED, &device->flags) &&
|
||||
- device->open_rw_cnt == 0 && device->open_ro_cnt == 0 &&
|
||||
+ if (test_bit(UNREGISTERED, &device->flags) && device->open_cnt == 0 &&
|
||||
!test_and_set_bit(DESTROYING_DEV, &device->flags))
|
||||
call_rcu(&device->rcu, drbd_reclaim_device);
|
||||
|
||||
if (resource->res_opts.auto_promote) {
|
||||
enum drbd_state_rv rv;
|
||||
|
||||
- if (mode & FMODE_WRITE &&
|
||||
- open_rw_cnt == 0 &&
|
||||
+ if (was_writable && open_rw_cnt == 0 &&
|
||||
resource->role[NOW] == R_PRIMARY &&
|
||||
!test_bit(EXPLICIT_PRIMARY, &resource->flags)) {
|
||||
rv = drbd_set_role(resource, R_SECONDARY, false, "auto-demote", NULL);
|
||||
@@ -2869,9 +2872,10 @@ static void drbd_release(struct gendisk *gd, fmode_t mode)
|
||||
end_state_change(resource, &irq_flags, "release");
|
||||
}
|
||||
|
||||
- /* if the open counts are 0, we free the whole list, otherwise we remove the specific pid */
|
||||
+ /* if the open count is 0, we free the whole list, otherwise we remove the specific pid */
|
||||
prune_or_free_openers(device,
|
||||
- (open_ro_cnt == 0 && open_rw_cnt == 0) ? 0 : task_pid_nr(current));
|
||||
+ (open_ro_cnt == 0 && open_rw_cnt == 0) ?
|
||||
+ 0 : task_pid_nr(current));
|
||||
|
||||
mutex_unlock(&resource->open_release);
|
||||
|
||||
diff --git a/drbd/drbd_nl.c b/drbd/drbd_nl.c
|
||||
index b0a1e6fa46f1..71ed4272614e 100644
|
||||
--- a/drbd/drbd_nl.c
|
||||
+++ b/drbd/drbd_nl.c
|
||||
@@ -4541,8 +4541,10 @@ int drbd_open_ro_count(struct drbd_resource *resource)
|
||||
int vnr, open_ro_cnt = 0;
|
||||
|
||||
read_lock_irq(&resource->state_rwlock);
|
||||
- idr_for_each_entry(&resource->devices, device, vnr)
|
||||
- open_ro_cnt += device->open_ro_cnt;
|
||||
+ idr_for_each_entry(&resource->devices, device, vnr) {
|
||||
+ if (!device->writable)
|
||||
+ open_ro_cnt += device->open_cnt;
|
||||
+ }
|
||||
read_unlock_irq(&resource->state_rwlock);
|
||||
|
||||
return open_ro_cnt;
|
||||
@@ -6394,8 +6396,7 @@ static enum drbd_ret_code adm_del_minor(struct drbd_device *device)
|
||||
notify_device_state(NULL, 0, device, NULL, NOTIFY_DESTROY);
|
||||
mutex_unlock(¬ification_mutex);
|
||||
|
||||
- if (device->open_ro_cnt == 0 && device->open_rw_cnt == 0 &&
|
||||
- !test_and_set_bit(DESTROYING_DEV, &device->flags))
|
||||
+ if (device->open_cnt == 0 && !test_and_set_bit(DESTROYING_DEV, &device->flags))
|
||||
call_rcu(&device->rcu, drbd_reclaim_device);
|
||||
|
||||
return ret;
|
||||
diff --git a/drbd/drbd_state.c b/drbd/drbd_state.c
|
||||
index 22cd134be962..fa70507df425 100644
|
||||
--- a/drbd/drbd_state.c
|
||||
+++ b/drbd/drbd_state.c
|
||||
@@ -1634,7 +1634,7 @@ handshake_found:
|
||||
return SS_TWO_PRIMARIES;
|
||||
if (!fail_io[NEW]) {
|
||||
idr_for_each_entry(&resource->devices, device, vnr) {
|
||||
- if (device->open_ro_cnt)
|
||||
+ if (!device->writable && device->open_cnt)
|
||||
return SS_PRIMARY_READER;
|
||||
/*
|
||||
* One might be tempted to add "|| open_rw_cont" here.
|
||||
@@ -1661,7 +1661,7 @@ handshake_found:
|
||||
(disk_state[OLD] > D_DETACHING && disk_state[NEW] == D_DETACHING)))
|
||||
return SS_IN_TRANSIENT_STATE;
|
||||
|
||||
- if (role[OLD] == R_PRIMARY && role[NEW] == R_SECONDARY && device->open_rw_cnt &&
|
||||
+ if (role[OLD] == R_PRIMARY && role[NEW] == R_SECONDARY && device->writable &&
|
||||
!(resource->state_change_flags & CS_FS_IGN_OPENERS))
|
||||
return SS_DEVICE_IN_USE;
|
||||
|
||||
@@ -1693,7 +1693,8 @@ handshake_found:
|
||||
return SS_NO_UP_TO_DATE_DISK;
|
||||
|
||||
/* Prevent detach or disconnect while held open read only */
|
||||
- if (device->open_ro_cnt && any_disk_up_to_date[OLD] && !any_disk_up_to_date[NEW])
|
||||
+ if (!device->writable && device->open_cnt &&
|
||||
+ any_disk_up_to_date[OLD] && !any_disk_up_to_date[NEW])
|
||||
return SS_NO_UP_TO_DATE_DISK;
|
||||
|
||||
if (disk_state[NEW] == D_NEGOTIATING)
|
||||
--
|
||||
2.35.3
|
||||
|
@@ -1,107 +0,0 @@
|
||||
From bf287c15359c4495a706ca270e7dcab4c2d6ebcc Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Moritz=20=22WanzenBug=22=20Wanzenb=C3=B6ck?=
|
||||
<moritz.wanzenboeck@linbit.com>
|
||||
Date: Tue, 12 Sep 2023 15:27:01 +0200
|
||||
Subject: [PATCH 19/20] compat: block: remove the unused mode argument to
|
||||
->release
|
||||
|
||||
See also upstream Linux kernel commit
|
||||
ae220766d87c ("block: remove the unused mode argument to ->release")
|
||||
|
||||
Original message:
|
||||
|
||||
The mode argument to the ->release block_device_operation is never used,
|
||||
so remove it.
|
||||
---
|
||||
...ions_release__no_takes_single_argument.cocci | 17 +++++++++++++++++
|
||||
drbd/drbd-kernel-compat/gen_patch_names.c | 3 +++
|
||||
...e_operations_release_takes_single_argument.c | 7 +++++++
|
||||
drbd/drbd_main.c | 6 +++---
|
||||
4 files changed, 30 insertions(+), 3 deletions(-)
|
||||
create mode 100644 drbd/drbd-kernel-compat/cocci/block_device_operations_release__no_takes_single_argument.cocci
|
||||
create mode 100644 drbd/drbd-kernel-compat/tests/block_device_operations_release_takes_single_argument.c
|
||||
|
||||
diff --git a/drbd/drbd-kernel-compat/cocci/block_device_operations_release__no_takes_single_argument.cocci b/drbd/drbd-kernel-compat/cocci/block_device_operations_release__no_takes_single_argument.cocci
|
||||
new file mode 100644
|
||||
index 000000000000..b0a0ee9eef39
|
||||
--- /dev/null
|
||||
+++ b/drbd/drbd-kernel-compat/cocci/block_device_operations_release__no_takes_single_argument.cocci
|
||||
@@ -0,0 +1,17 @@
|
||||
+@@
|
||||
+identifier gd;
|
||||
+fresh identifier mode = "" ## "mode";
|
||||
+@@
|
||||
+ drbd_release(
|
||||
+ struct gendisk *gd
|
||||
++ , fmode_t mode
|
||||
+ ) { ... }
|
||||
+
|
||||
+@@
|
||||
+symbol drbd_release;
|
||||
+expression gd;
|
||||
+@@
|
||||
+ drbd_release(
|
||||
+ gd
|
||||
++ , 0
|
||||
+ )
|
||||
diff --git a/drbd/drbd-kernel-compat/gen_patch_names.c b/drbd/drbd-kernel-compat/gen_patch_names.c
|
||||
index 4761c1ef7d0c..608be8b4f099 100644
|
||||
--- a/drbd/drbd-kernel-compat/gen_patch_names.c
|
||||
+++ b/drbd/drbd-kernel-compat/gen_patch_names.c
|
||||
@@ -565,6 +565,9 @@ int main(int argc, char **argv)
|
||||
patch(1, "blkdev_put", true, false,
|
||||
COMPAT_BLKDEV_PUT_HAS_HOLDER, "has_holder");
|
||||
|
||||
+ patch(1, "block_device_operations_release", true, false,
|
||||
+ COMPAT_BLOCK_DEVICE_OPERATIONS_RELEASE_TAKES_SINGLE_ARGUMENT, "takes_single_argument");
|
||||
+
|
||||
/* #define BLKDEV_ISSUE_ZEROOUT_EXPORTED */
|
||||
/* #define BLKDEV_ZERO_NOUNMAP */
|
||||
|
||||
diff --git a/drbd/drbd-kernel-compat/tests/block_device_operations_release_takes_single_argument.c b/drbd/drbd-kernel-compat/tests/block_device_operations_release_takes_single_argument.c
|
||||
new file mode 100644
|
||||
index 000000000000..d51c863e359a
|
||||
--- /dev/null
|
||||
+++ b/drbd/drbd-kernel-compat/tests/block_device_operations_release_takes_single_argument.c
|
||||
@@ -0,0 +1,7 @@
|
||||
+/* { "version": "v6.5-rc1", "commit": "ae220766d87cd6799dbf918fea10613ae14c0654", "comment": "block: remove the unused mode argument to ->release", "author": "Christoph Hellwig <hch@lst.de>", "date": "Thu Jun 8 13:02:37 2023 +0200" } */
|
||||
+#include <linux/blkdev.h>
|
||||
+
|
||||
+void foo(struct block_device_operations *ops, struct gendisk *gd)
|
||||
+{
|
||||
+ ops->release(gd);
|
||||
+}
|
||||
diff --git a/drbd/drbd_main.c b/drbd/drbd_main.c
|
||||
index bb05b2215dfb..1864861db21d 100644
|
||||
--- a/drbd/drbd_main.c
|
||||
+++ b/drbd/drbd_main.c
|
||||
@@ -53,7 +53,7 @@
|
||||
#include "drbd_dax_pmem.h"
|
||||
|
||||
static int drbd_open(struct gendisk *gd, fmode_t mode);
|
||||
-static void drbd_release(struct gendisk *gd, fmode_t mode);
|
||||
+static void drbd_release(struct gendisk *gd);
|
||||
static void md_sync_timer_fn(struct timer_list *t);
|
||||
static int w_bitmap_io(struct drbd_work *w, int unused);
|
||||
static int flush_send_buffer(struct drbd_connection *connection, enum drbd_stream drbd_stream);
|
||||
@@ -2740,7 +2740,7 @@ out:
|
||||
|
||||
mutex_unlock(&resource->open_release);
|
||||
if (err) {
|
||||
- drbd_release(gd, mode);
|
||||
+ drbd_release(gd);
|
||||
if (err == -EAGAIN && !(mode & FMODE_NDELAY))
|
||||
err = -EMEDIUMTYPE;
|
||||
}
|
||||
@@ -2822,7 +2822,7 @@ void drbd_fsync_device(struct drbd_device *device)
|
||||
drbd_flush_peer_acks(resource);
|
||||
}
|
||||
|
||||
-static void drbd_release(struct gendisk *gd, fmode_t mode)
|
||||
+static void drbd_release(struct gendisk *gd)
|
||||
{
|
||||
struct drbd_device *device = gd->private_data;
|
||||
struct drbd_resource *resource = device->resource;
|
||||
--
|
||||
2.35.3
|
||||
|
@@ -1,183 +0,0 @@
|
||||
From 2d3c3fd6546174a0452c9bbd64d4f4193c0c39e2 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Moritz=20WanzenBug=20Wanzenb=C3=B6ck?=
|
||||
<moritz.wanzenboeck@linbit.com>
|
||||
Date: Wed, 13 Sep 2023 11:26:35 +0200
|
||||
Subject: [PATCH] compat: block: replace fmode_t with a block-specific type for
|
||||
block open flags
|
||||
|
||||
See also upstream Linux kernel commit
|
||||
05bdb9965305 ("block: replace fmode_t with a block-specific type for block open flags"
|
||||
|
||||
Original message:
|
||||
|
||||
The only overlap between the block open flags mapped into the fmode_t and
|
||||
other uses of fmode_t are FMODE_READ and FMODE_WRITE. Define a new
|
||||
blk_mode_t instead for use in blkdev_get_by_{dev,path}, ->open and
|
||||
->ioctl and stop abusing fmode_t.
|
||||
---
|
||||
.../cocci/blk_mode_t__no_present.cocci | 19 ++++++++++++++
|
||||
drbd/drbd-kernel-compat/gen_patch_names.c | 3 +++
|
||||
.../tests/have_blk_mode_t.c | 4 +++
|
||||
drbd/drbd_main.c | 26 +++++++++----------
|
||||
4 files changed, 39 insertions(+), 13 deletions(-)
|
||||
create mode 100644 drbd/drbd-kernel-compat/cocci/blk_mode_t__no_present.cocci
|
||||
create mode 100644 drbd/drbd-kernel-compat/tests/have_blk_mode_t.c
|
||||
|
||||
diff --git a/drbd/drbd-kernel-compat/cocci/blk_mode_t__no_present.cocci b/drbd/drbd-kernel-compat/cocci/blk_mode_t__no_present.cocci
|
||||
new file mode 100644
|
||||
index 000000000000..030723c817de
|
||||
--- /dev/null
|
||||
+++ b/drbd/drbd-kernel-compat/cocci/blk_mode_t__no_present.cocci
|
||||
@@ -0,0 +1,19 @@
|
||||
+@@
|
||||
+identifier fn;
|
||||
+identifier mode;
|
||||
+@@
|
||||
+ fn (
|
||||
+ ...,
|
||||
+- blk_mode_t mode
|
||||
++ fmode_t mode
|
||||
+ ) {
|
||||
+ <...
|
||||
+(
|
||||
+- BLK_OPEN_WRITE
|
||||
++ FMODE_WRITE
|
||||
+|
|
||||
+- BLK_OPEN_NDELAY
|
||||
++ FMODE_NDELAY
|
||||
+)
|
||||
+ ...>
|
||||
+ }
|
||||
diff --git a/drbd/drbd-kernel-compat/gen_patch_names.c b/drbd/drbd-kernel-compat/gen_patch_names.c
|
||||
index 6a96c5b89f11..e4a65a3c451e 100644
|
||||
--- a/drbd/drbd-kernel-compat/gen_patch_names.c
|
||||
+++ b/drbd/drbd-kernel-compat/gen_patch_names.c
|
||||
@@ -571,6 +571,9 @@ int main(int argc, char **argv)
|
||||
patch(1, "block_device_operations_release", true, false,
|
||||
COMPAT_BLOCK_DEVICE_OPERATIONS_RELEASE_TAKES_SINGLE_ARGUMENT, "takes_single_argument");
|
||||
|
||||
+ patch(1, "blk_mode_t", true, false,
|
||||
+ COMPAT_HAVE_BLK_MODE_T, "present");
|
||||
+
|
||||
/* #define BLKDEV_ISSUE_ZEROOUT_EXPORTED */
|
||||
/* #define BLKDEV_ZERO_NOUNMAP */
|
||||
|
||||
diff --git a/drbd/drbd-kernel-compat/tests/have_blk_mode_t.c b/drbd/drbd-kernel-compat/tests/have_blk_mode_t.c
|
||||
new file mode 100644
|
||||
index 000000000000..e063bdc30f43
|
||||
--- /dev/null
|
||||
+++ b/drbd/drbd-kernel-compat/tests/have_blk_mode_t.c
|
||||
@@ -0,0 +1,4 @@
|
||||
+/* { "version": "v6.5-rc1", "commit": "05bdb9965305bbfdae79b31d22df03d1e2cfcb22", "comment": "block: replace fmode_t with a block-specific type for block open flags", "author": "Christoph Hellwig <hch@lst.de>", "date": "Thu Jun 8 13:02:55 2023 +0200" } */
|
||||
+#include <linux/blkdev.h>
|
||||
+
|
||||
+void foo(blk_mode_t mode) {}
|
||||
diff --git a/drbd/drbd_main.c b/drbd/drbd_main.c
|
||||
index 0719229f210e..f9560bdff63f 100644
|
||||
--- a/drbd/drbd_main.c
|
||||
+++ b/drbd/drbd_main.c
|
||||
@@ -52,7 +52,7 @@
|
||||
#include "drbd_meta_data.h"
|
||||
#include "drbd_dax_pmem.h"
|
||||
|
||||
-static int drbd_open(struct gendisk *gd, fmode_t mode);
|
||||
+static int drbd_open(struct gendisk *gd, blk_mode_t mode);
|
||||
static void drbd_release(struct gendisk *gd);
|
||||
static void md_sync_timer_fn(struct timer_list *t);
|
||||
static int w_bitmap_io(struct drbd_work *w, int unused);
|
||||
@@ -2566,10 +2566,10 @@ enum ioc_rv {
|
||||
IOC_ABORT = 2,
|
||||
};
|
||||
|
||||
-static enum ioc_rv inc_open_count(struct drbd_device *device, fmode_t mode)
|
||||
+static enum ioc_rv inc_open_count(struct drbd_device *device, blk_mode_t mode)
|
||||
{
|
||||
struct drbd_resource *resource = device->resource;
|
||||
- enum ioc_rv r = mode & FMODE_NDELAY ? IOC_ABORT : IOC_SLEEP;
|
||||
+ enum ioc_rv r = mode & BLK_OPEN_NDELAY ? IOC_ABORT : IOC_SLEEP;
|
||||
|
||||
if (test_bit(DOWN_IN_PROGRESS, &resource->flags))
|
||||
return IOC_ABORT;
|
||||
@@ -2580,7 +2580,7 @@ static enum ioc_rv inc_open_count(struct drbd_device *device, fmode_t mode)
|
||||
else if (!resource->remote_state_change) {
|
||||
r = IOC_OK;
|
||||
device->open_cnt++;
|
||||
- if (mode & FMODE_WRITE)
|
||||
+ if (mode & BLK_OPEN_WRITE)
|
||||
device->writable = true;
|
||||
}
|
||||
read_unlock_irq(&resource->state_rwlock);
|
||||
@@ -2646,7 +2646,7 @@ out:
|
||||
spin_unlock(&device->openers_lock);
|
||||
}
|
||||
|
||||
-static int drbd_open(struct gendisk *gd, fmode_t mode)
|
||||
+static int drbd_open(struct gendisk *gd, blk_mode_t mode)
|
||||
{
|
||||
struct drbd_device *device = gd->private_data;
|
||||
struct drbd_resource *resource = device->resource;
|
||||
@@ -2655,7 +2655,7 @@ static int drbd_open(struct gendisk *gd, fmode_t mode)
|
||||
int err = 0;
|
||||
|
||||
/* Fail read-only open from systemd-udev (version <= 238) */
|
||||
- if (!(mode & FMODE_WRITE) && !drbd_allow_oos) {
|
||||
+ if (!(mode & BLK_OPEN_WRITE) && !drbd_allow_oos) {
|
||||
char comm[TASK_COMM_LEN];
|
||||
get_task_comm(comm, current);
|
||||
if (!strcmp("systemd-udevd", comm))
|
||||
@@ -2664,7 +2664,7 @@ static int drbd_open(struct gendisk *gd, fmode_t mode)
|
||||
|
||||
/* Fail read-write open early,
|
||||
* in case someone explicitly set us read-only (blockdev --setro) */
|
||||
- if (bdev_read_only(gd->part0) && (mode & FMODE_WRITE))
|
||||
+ if (bdev_read_only(gd->part0) && (mode & BLK_OPEN_WRITE))
|
||||
return -EACCES;
|
||||
|
||||
if (resource->fail_io[NOW])
|
||||
@@ -2693,14 +2693,14 @@ static int drbd_open(struct gendisk *gd, fmode_t mode)
|
||||
This avoids split brain when the drbd volume gets opened
|
||||
temporarily by udev while it scans for PV signatures. */
|
||||
|
||||
- if (mode & FMODE_WRITE) {
|
||||
+ if (mode & BLK_OPEN_WRITE) {
|
||||
if (resource->role[NOW] == R_SECONDARY) {
|
||||
- rv = try_to_promote(device, timeout, (mode & FMODE_NDELAY));
|
||||
+ rv = try_to_promote(device, timeout, (mode & BLK_OPEN_NDELAY));
|
||||
if (rv < SS_SUCCESS)
|
||||
drbd_info(resource, "Auto-promote failed: %s (%d)\n",
|
||||
drbd_set_st_err_str(rv), rv);
|
||||
}
|
||||
- } else if ((mode & FMODE_NDELAY) == 0) {
|
||||
+ } else if ((mode & BLK_OPEN_NDELAY) == 0) {
|
||||
/* Double check peers
|
||||
*
|
||||
* Some services may try to first open ro, and only if that
|
||||
@@ -2720,14 +2720,14 @@ static int drbd_open(struct gendisk *gd, fmode_t mode)
|
||||
}
|
||||
}
|
||||
} else if (resource->role[NOW] != R_PRIMARY &&
|
||||
- !(mode & FMODE_WRITE) && !drbd_allow_oos) {
|
||||
+ !(mode & BLK_OPEN_WRITE) && !drbd_allow_oos) {
|
||||
err = -EMEDIUMTYPE;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (test_bit(UNREGISTERED, &device->flags)) {
|
||||
err = -ENODEV;
|
||||
- } else if (mode & FMODE_WRITE) {
|
||||
+ } else if (mode & BLK_OPEN_WRITE) {
|
||||
if (resource->role[NOW] != R_PRIMARY)
|
||||
err = -EROFS;
|
||||
} else /* READ access only */ {
|
||||
@@ -2741,7 +2741,7 @@ out:
|
||||
mutex_unlock(&resource->open_release);
|
||||
if (err) {
|
||||
drbd_release(gd);
|
||||
- if (err == -EAGAIN && !(mode & FMODE_NDELAY))
|
||||
+ if (err == -EAGAIN && !(mode & BLK_OPEN_NDELAY))
|
||||
err = -EMEDIUMTYPE;
|
||||
}
|
||||
|
||||
--
|
||||
2.42.1
|
||||
|
@@ -1,96 +0,0 @@
|
||||
From 1412792a443ddc696fd1c8981a6cc544272f54bf Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Moritz=20WanzenBug=20Wanzenb=C3=B6ck?=
|
||||
<moritz.wanzenboeck@linbit.com>
|
||||
Date: Wed, 13 Sep 2023 15:46:12 +0200
|
||||
Subject: [PATCH] compat: genetlink: remove userhdr from struct genl_info
|
||||
|
||||
See also upstream Linux kernel commit
|
||||
bffcc6882a1b ("genetlink: remove userhdr from struct genl_info")
|
||||
|
||||
Original message:
|
||||
|
||||
Only three families use info->userhdr today and going forward
|
||||
we discourage using fixed headers in new families.
|
||||
So having the pointer to user header in struct genl_info
|
||||
is an overkill. Compute the header pointer at runtime.
|
||||
---
|
||||
.../cocci/genl_info_userhdr__no_present.cocci | 5 +++++
|
||||
drbd/drbd-kernel-compat/gen_patch_names.c | 3 +++
|
||||
drbd/drbd-kernel-compat/tests/have_genl_info_userhdr.c | 7 +++++++
|
||||
drbd/drbd_nl.c | 6 +++---
|
||||
4 files changed, 18 insertions(+), 3 deletions(-)
|
||||
create mode 100644 drbd/drbd-kernel-compat/cocci/genl_info_userhdr__no_present.cocci
|
||||
create mode 100644 drbd/drbd-kernel-compat/tests/have_genl_info_userhdr.c
|
||||
|
||||
diff --git a/drbd/drbd-kernel-compat/cocci/genl_info_userhdr__no_present.cocci b/drbd/drbd-kernel-compat/cocci/genl_info_userhdr__no_present.cocci
|
||||
new file mode 100644
|
||||
index 000000000000..75e787797068
|
||||
--- /dev/null
|
||||
+++ b/drbd/drbd-kernel-compat/cocci/genl_info_userhdr__no_present.cocci
|
||||
@@ -0,0 +1,5 @@
|
||||
+@@
|
||||
+expression info;
|
||||
+@@
|
||||
+- genl_info_userhdr(info)
|
||||
++ info->userhdr
|
||||
diff --git a/drbd/drbd-kernel-compat/gen_patch_names.c b/drbd/drbd-kernel-compat/gen_patch_names.c
|
||||
index e4a65a3c451e..b136acf3148a 100644
|
||||
--- a/drbd/drbd-kernel-compat/gen_patch_names.c
|
||||
+++ b/drbd/drbd-kernel-compat/gen_patch_names.c
|
||||
@@ -574,6 +574,9 @@ int main(int argc, char **argv)
|
||||
patch(1, "blk_mode_t", true, false,
|
||||
COMPAT_HAVE_BLK_MODE_T, "present");
|
||||
|
||||
+ patch(1, "genl_info_userhdr", true, false,
|
||||
+ COMPAT_HAVE_GENL_INFO_USERHDR, "present");
|
||||
+
|
||||
/* #define BLKDEV_ISSUE_ZEROOUT_EXPORTED */
|
||||
/* #define BLKDEV_ZERO_NOUNMAP */
|
||||
|
||||
diff --git a/drbd/drbd-kernel-compat/tests/have_genl_info_userhdr.c b/drbd/drbd-kernel-compat/tests/have_genl_info_userhdr.c
|
||||
new file mode 100644
|
||||
index 000000000000..3c69dacce244
|
||||
--- /dev/null
|
||||
+++ b/drbd/drbd-kernel-compat/tests/have_genl_info_userhdr.c
|
||||
@@ -0,0 +1,7 @@
|
||||
+/* { "version": "v6.6-rc1", "commit": "bffcc6882a1bb2be8c9420184966f4c2c822078e", "comment": "genetlink: remove userhdr from struct genl_info", "author": "Jakub Kicinski <kuba@kernel.org>", "date": "Mon Aug 14 14:47:16 2023 -0700" } */
|
||||
+#include <net/genetlink.h>
|
||||
+
|
||||
+void *foo(struct genl_info *info)
|
||||
+{
|
||||
+ return genl_info_userhdr(info);
|
||||
+}
|
||||
diff --git a/drbd/drbd_nl.c b/drbd/drbd_nl.c
|
||||
index 71ed4272614e..538c31202e4b 100644
|
||||
--- a/drbd/drbd_nl.c
|
||||
+++ b/drbd/drbd_nl.c
|
||||
@@ -203,7 +203,7 @@ static struct drbd_path *first_path(struct drbd_connection *connection)
|
||||
static int drbd_adm_prepare(struct drbd_config_context *adm_ctx,
|
||||
struct sk_buff *skb, struct genl_info *info, unsigned flags)
|
||||
{
|
||||
- struct drbd_genlmsghdr *d_in = info->userhdr;
|
||||
+ struct drbd_genlmsghdr *d_in = genl_info_userhdr(info);
|
||||
const u8 cmd = info->genlhdr->cmd;
|
||||
int err;
|
||||
|
||||
@@ -2106,7 +2106,7 @@ static void drbd_try_suspend_al(struct drbd_device *device)
|
||||
|
||||
static bool should_set_defaults(struct genl_info *info)
|
||||
{
|
||||
- unsigned flags = ((struct drbd_genlmsghdr*)info->userhdr)->flags;
|
||||
+ unsigned int flags = ((struct drbd_genlmsghdr *)genl_info_userhdr(info))->flags;
|
||||
return 0 != (flags & DRBD_GENL_F_SET_DEFAULTS);
|
||||
}
|
||||
|
||||
@@ -6279,7 +6279,7 @@ out_no_unlock:
|
||||
int drbd_adm_new_minor(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
struct drbd_config_context adm_ctx;
|
||||
- struct drbd_genlmsghdr *dh = info->userhdr;
|
||||
+ struct drbd_genlmsghdr *dh = genl_info_userhdr(info);
|
||||
struct device_conf device_conf;
|
||||
struct drbd_resource *resource;
|
||||
struct drbd_device *device;
|
||||
--
|
||||
2.42.1
|
||||
|
73
boo1235399-fix_the_warning_of_blk_validate_limits.patch
Normal file
73
boo1235399-fix_the_warning_of_blk_validate_limits.patch
Normal file
@@ -0,0 +1,73 @@
|
||||
Subject: [PATCH] drbd: Fix block layer warning
|
||||
|
||||
drbdadm down r0 trigger kernel warning
|
||||
|
||||
drbd_reconsider_queue_parameters
|
||||
+ get_common_queue_limits
|
||||
| blk_set_stacking_limits
|
||||
| lim->max_zone_append_sectors = UINT_MAX; <=== set
|
||||
|
|
||||
+ ... ...
|
||||
|
|
||||
+ queue_limits_commit_update
|
||||
blk_validate_limits
|
||||
WARN_ON_ONCE(lim->max_zone_append_sectors) <== trigger
|
||||
|
||||
log:
|
||||
|
||||
```
|
||||
Jan 08 14:43:37 tw-2 kernel: drbd r0/0 drbd0: disk( UpToDate -> Detaching ) [down]
|
||||
Jan 08 14:43:37 tw-2 kernel: drbd r0/0 drbd0: disk( Detaching -> Diskless ) [go-diskless]
|
||||
------------[ cut here ]------------
|
||||
WARNING: CPU: 0 PID: 1773 at block/blk-settings.c:75 blk_validate_limits+0x41d/0x440
|
||||
... ...
|
||||
Call Trace:
|
||||
<TASK>
|
||||
? blk_validate_limits+0x41d/0x440
|
||||
? __warn.cold+0x93/0xf7
|
||||
? blk_validate_limits+0x41d/0x440
|
||||
? report_bug+0xff/0x140
|
||||
? handle_bug+0x58/0x90
|
||||
? exc_invalid_op+0x17/0x70
|
||||
? asm_exc_invalid_op+0x1a/0x20
|
||||
? blk_validate_limits+0x41d/0x440
|
||||
queue_limits_commit_update+0x1b/0xa0
|
||||
drbd_reconsider_queue_parameters+0x1d2/0x240 [drbd 9a1d8dc285f5b1fe449ab4495af7893c660ff3ea]
|
||||
w_after_state_change+0x1997/0x20a0 [drbd 9a1d8dc285f5b1fe449ab4495af7893c660ff3ea]
|
||||
? idr_get_next_ul+0xee/0x110
|
||||
? do_unqueued_device_work+0x1da/0x2a0 [drbd 9a1d8dc285f5b1fe449ab4495af7893c660ff3ea]
|
||||
drbd_worker+0x109/0x530 [drbd 9a1d8dc285f5b1fe449ab4495af7893c660ff3ea]
|
||||
? __pfx_autoremove_wake_function+0x10/0x10
|
||||
? __pfx_drbd_thread_setup+0x10/0x10 [drbd 9a1d8dc285f5b1fe449ab4495af7893c660ff3ea]
|
||||
drbd_thread_setup+0x6d/0x170 [drbd 9a1d8dc285f5b1fe449ab4495af7893c660ff3ea]
|
||||
kthread+0xcf/0x100
|
||||
? __pfx_kthread+0x10/0x10
|
||||
ret_from_fork+0x31/0x50
|
||||
? __pfx_kthread+0x10/0x10
|
||||
ret_from_fork_asm+0x1a/0x30
|
||||
</TASK>
|
||||
Jan 08 14:43:37 tw-2 kernel: ---[ end trace 0000000000000000 ]---
|
||||
Jan 08 14:43:37 tw-2 kernel: drbd r0/0 drbd0: setting new queue limits failed
|
||||
Jan 08 14:43:37 tw-2 kernel: drbd r0/0 drbd0: drbd_bm_resize called with capacity == 0
|
||||
Jan 08 14:43:37 tw-2 kernel: drbd /unregistered/r0: Terminating worker thread
|
||||
|
||||
---[ end trace 0000000000000000 ]---
|
||||
drbd /unregistered/r0/0 drbd0: setting new queue limits failed
|
||||
drbd /unregistered/r0: Terminating worker thread
|
||||
```
|
||||
|
||||
Signed-off-by: Heming Zhao <heming.zhao@suse.com>
|
||||
---
|
||||
|
||||
diff -Nupr a/drbd/drbd_nl.c b/drbd/drbd_nl.c
|
||||
--- a/drbd/drbd_nl.c 2025-01-08 14:25:56.369599242 +0800
|
||||
+++ b/drbd/drbd_nl.c 2025-01-08 14:32:07.260157474 +0800
|
||||
@@ -2068,6 +2068,8 @@ static void get_common_queue_limits(stru
|
||||
common_limits->physical_block_size = device->device_conf.block_size;
|
||||
common_limits->logical_block_size = device->device_conf.block_size;
|
||||
common_limits->io_min = device->device_conf.block_size;
|
||||
+ if (!(common_limits->features & BLK_FEAT_ZONED))
|
||||
+ common_limits->max_zone_append_sectors = 0;
|
||||
|
||||
rcu_read_lock();
|
||||
for_each_peer_device_rcu(peer_device, device) {
|
@@ -1,107 +0,0 @@
|
||||
From 6fd35546c2d2afd10afe04ab9cdf4ac9ca0b3e94 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Moritz=20=22WanzenBug=22=20Wanzenb=C3=B6ck?=
|
||||
<moritz.wanzenboeck@linbit.com>
|
||||
Date: Wed, 13 Sep 2023 13:30:57 +0200
|
||||
Subject: [PATCH] compat: sock: Remove ->sendpage*() in favour of
|
||||
sendmsg(MSG_SPLICE_PAGES)
|
||||
|
||||
See also upstream Linux kernel commits
|
||||
dc97391e6610 ("sock: Remove ->sendpage*() in favour of sendmsg(MSG_SPLICE_PAGES)")
|
||||
eeac7405c735 ("drbd: Use sendmsg(MSG_SPLICE_PAGES) rather than sendpage()")
|
||||
4b9c2edaf728 ("drbd: swap bvec_set_page len and offset")
|
||||
|
||||
Original message:
|
||||
|
||||
Remove ->sendpage() and ->sendpage_locked(). sendmsg() with
|
||||
MSG_SPLICE_PAGES should be used instead. This allows multiple pages and
|
||||
multipage folios to be passed through.
|
||||
---
|
||||
.../cocci/msg_splice_pages__no_present.cocci | 16 ++++++++++++++++
|
||||
drbd/drbd-kernel-compat/gen_patch_names.c | 3 +++
|
||||
.../tests/have_msg_splice_pages.c | 7 +++++++
|
||||
drbd/drbd_transport_tcp.c | 8 ++++++--
|
||||
4 files changed, 32 insertions(+), 2 deletions(-)
|
||||
create mode 100644 drbd/drbd-kernel-compat/cocci/msg_splice_pages__no_present.cocci
|
||||
create mode 100644 drbd/drbd-kernel-compat/tests/have_msg_splice_pages.c
|
||||
|
||||
diff --git a/drbd/drbd-kernel-compat/cocci/msg_splice_pages__no_present.cocci b/drbd/drbd-kernel-compat/cocci/msg_splice_pages__no_present.cocci
|
||||
new file mode 100644
|
||||
index 000000000000..0fdf77e43737
|
||||
--- /dev/null
|
||||
+++ b/drbd/drbd-kernel-compat/cocci/msg_splice_pages__no_present.cocci
|
||||
@@ -0,0 +1,16 @@
|
||||
+@@
|
||||
+expression flags;
|
||||
+@@
|
||||
+ flags
|
||||
+- | MSG_SPLICE_PAGES
|
||||
+
|
||||
+@@
|
||||
+identifier bvec, page, len, offset, msg, socket;
|
||||
+@@
|
||||
+- struct bio_vec bvec;
|
||||
+ ...
|
||||
+ int sent;
|
||||
+- bvec_set_page(&bvec, page, len, offset);
|
||||
+- iov_iter_bvec(&msg.msg_iter, ITER_SOURCE, &bvec, 1, len);
|
||||
+- sent = sock_sendmsg(socket, &msg);
|
||||
++ sent = socket->ops->sendpage(socket, page, offset, len, msg.msg_flags);
|
||||
diff --git a/drbd/drbd-kernel-compat/gen_patch_names.c b/drbd/drbd-kernel-compat/gen_patch_names.c
|
||||
index 228386f448a5..e4a65a3c451e 100644
|
||||
--- a/drbd/drbd-kernel-compat/gen_patch_names.c
|
||||
+++ b/drbd/drbd-kernel-compat/gen_patch_names.c
|
||||
@@ -127,6 +127,9 @@ int main(int argc, char **argv)
|
||||
patch(1, "bvec_kmap_local", true, false,
|
||||
COMPAT_HAVE_BVEC_KMAP_LOCAL, "present");
|
||||
|
||||
+ patch(1, "msg_splice_pages", true, false,
|
||||
+ COMPAT_HAVE_MSG_SPLICE_PAGES, "present");
|
||||
+
|
||||
patch(1, "struct_bvec_iter", true, false,
|
||||
COMPAT_HAVE_STRUCT_BVEC_ITER, "present");
|
||||
|
||||
diff --git a/drbd/drbd-kernel-compat/tests/have_msg_splice_pages.c b/drbd/drbd-kernel-compat/tests/have_msg_splice_pages.c
|
||||
new file mode 100644
|
||||
index 000000000000..0bb23ef6d39a
|
||||
--- /dev/null
|
||||
+++ b/drbd/drbd-kernel-compat/tests/have_msg_splice_pages.c
|
||||
@@ -0,0 +1,7 @@
|
||||
+/* { "version": "v6.5-rc1", "commit": "dc97391e661009eab46783030d2404c9b6e6f2e7", "comment": "sock: Remove ->sendpage*() in favour of sendmsg(MSG_SPLICE_PAGES)", "author": "David Howells <dhowells@redhat.com>", "date": "Fri Jun 23 23:55:12 2023 +0100" } */
|
||||
+#include <linux/net.h>
|
||||
+
|
||||
+int foo(void)
|
||||
+{
|
||||
+ return MSG_SPLICE_PAGES;
|
||||
+}
|
||||
diff --git a/drbd/drbd_transport_tcp.c b/drbd/drbd_transport_tcp.c
|
||||
index ca60833f73d7..5dcba50dd0eb 100644
|
||||
--- a/drbd/drbd_transport_tcp.c
|
||||
+++ b/drbd/drbd_transport_tcp.c
|
||||
@@ -1193,18 +1193,22 @@ static int dtt_send_page(struct drbd_transport *transport, enum drbd_stream stre
|
||||
struct drbd_tcp_transport *tcp_transport =
|
||||
container_of(transport, struct drbd_tcp_transport, transport);
|
||||
struct socket *socket = tcp_transport->stream[stream];
|
||||
+ struct msghdr msg = { .msg_flags = msg_flags | MSG_NOSIGNAL | MSG_SPLICE_PAGES };
|
||||
+ struct bio_vec bvec;
|
||||
int len = size;
|
||||
int err = -EIO;
|
||||
|
||||
if (!socket)
|
||||
return -ENOTCONN;
|
||||
|
||||
- msg_flags |= MSG_NOSIGNAL;
|
||||
dtt_update_congested(tcp_transport);
|
||||
do {
|
||||
int sent;
|
||||
|
||||
- sent = socket->ops->sendpage(socket, page, offset, len, msg_flags);
|
||||
+ bvec_set_page(&bvec, page, len, offset);
|
||||
+ iov_iter_bvec(&msg.msg_iter, ITER_SOURCE, &bvec, 1, len);
|
||||
+
|
||||
+ sent = sock_sendmsg(socket, &msg);
|
||||
if (sent <= 0) {
|
||||
if (sent == -EAGAIN) {
|
||||
if (drbd_stream_send_timed_out(transport, stream))
|
||||
--
|
||||
2.35.3
|
||||
|
BIN
drbd-9.1.16.tar.gz
(Stored with Git LFS)
BIN
drbd-9.1.16.tar.gz
(Stored with Git LFS)
Binary file not shown.
BIN
drbd-9.1.23.tar.gz
(Stored with Git LFS)
Normal file
BIN
drbd-9.1.23.tar.gz
(Stored with Git LFS)
Normal file
Binary file not shown.
340
drbd.changes
340
drbd.changes
@@ -1,3 +1,306 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Jan 8 07:08:00 UTC 2025 - Heming Zhao <heming.zhao@suse.com>
|
||||
|
||||
- fix the warning of blk_validate_limits when running drbdadm down (boo#1235399)
|
||||
* add patch
|
||||
boo1235399-fix_the_warning_of_blk_validate_limits.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Dec 11 02:35:00 UTC 2024 - Heming Zhao <heming.zhao@suse.com>
|
||||
|
||||
- Update DRBD version from 9.1.22 to 9.1.23 (boo#1234849)
|
||||
|
||||
* Changelog from Linbit:
|
||||
|
||||
9.1.23 (api:genl2/proto:86-101,118-121/transport:18)
|
||||
--------
|
||||
* Fix a corner case that can happen when DRBD establishes multiple
|
||||
connections in parallel, which could lead one connection to end up in
|
||||
an inconsistent replication state of WFBitMapT/Established
|
||||
* Fix a corner case in which a reconciliation resync ends up in
|
||||
WFBitMapT/Established
|
||||
* Restrict protocol compatibility to the most recent 8.4 and 9.0 releases
|
||||
* Fix a corner case causing a module ref leak on drbd_transport_tcp;
|
||||
if it hits, you can not rmmod it
|
||||
* rate-limit resync progress while resync is paused
|
||||
* resync-target inherits history UUIDs when resync finishes,
|
||||
this can prevent unexpected "unrelared data" events later
|
||||
* Updated compatibility code for Linux 6.11 and 6.12
|
||||
|
||||
* remove patches which already included in the new version:
|
||||
0001-drbd-properly-rate-limit-resync-progress-reports.patch
|
||||
0002-drbd-inherit-history-UUIDs-from-sync-source-when-res.patch
|
||||
0003-build-compat-fix-line-offset-in-annotation-pragmas-p.patch
|
||||
0004-drbd-fix-exposed_uuid-going-backward.patch
|
||||
0005-drbd-Proper-locking-around-new_current_uuid-on-a-dis.patch
|
||||
0006-build-CycloneDX-fix-bom-ref-add-purl.patch
|
||||
0007-build-Another-update-to-the-spdx-files.patch
|
||||
0008-build-generate-spdx.json-not-tag-value-format.patch
|
||||
0009-compat-fix-gen_patch_names-for-bdev_file_open_by_pat.patch
|
||||
0010-compat-fix-nla_nest_start_noflag-test.patch
|
||||
0011-compat-fix-blk_alloc_disk-rule.patch
|
||||
0012-drbd-remove-const-from-function-return-type.patch
|
||||
0013-drbd-don-t-set-max_write_zeroes_sectors-in-decide_on.patch
|
||||
0014-drbd-split-out-a-drbd_discard_supported-helper.patch
|
||||
0015-drbd-atomically-update-queue-limits-in-drbd_reconsid.patch
|
||||
0016-compat-test-and-patch-for-queue_limits_start_update.patch
|
||||
0017-compat-specify-which-essential-change-was-not-made.patch
|
||||
0018-gen_patch_names-reorder-blk_mode_t.patch
|
||||
0019-compat-fix-blk_queue_update_readahead-patch.patch
|
||||
0020-compat-test-and-patch-for-que_limits-max_hw_discard_.patch
|
||||
0021-compat-fixup-write_zeroes__no_capable.patch
|
||||
0022-compat-fixup-queue_flag_discard__yes_present.patch
|
||||
0023-drbd-move-flags-to-queue_limits.patch
|
||||
0024-compat-test-and-patch-for-queue_limits.features.patch
|
||||
0025-drbd-Annotate-struct-fifo_buffer-with-__counted_by.patch
|
||||
0026-compat-test-and-patch-for-__counted_by.patch
|
||||
0027-drbd-fix-function-cast-warnings-in-state-machine.patch
|
||||
0028-Add-missing-documentation-of-peer_device-parameter-t.patch
|
||||
0030-drbd-kref_put-path-when-kernel_accept-fails.patch
|
||||
0031-build-fix-typo-in-Makefile.spatch.patch
|
||||
0032-drbd-open-do-not-delay-open-if-already-Primary.patch
|
||||
|
||||
* removed patch which is not needed anymore:
|
||||
boo1231290_fix_drbd_build_error_against_kernel_v6.11.0.patch
|
||||
boo1233222_fix_drbd_build_error_against_kernel_v6.11.6.patch
|
||||
bsc-1216666-compat-sock-Remove-sendpage-in-favour-of-sendmsg-MSG.patch
|
||||
|
||||
* update:
|
||||
drbd_git_revision
|
||||
drbd.spec
|
||||
|
||||
* add upstream patches to align commit d64ebe7eb7df:
|
||||
0001-drbd-Fix-memory-leak.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Nov 11 12:23:17 UTC 2024 - Glass Su <glass.su@suse.com>
|
||||
|
||||
- drbd: fix build error against kernel v6.11.6 (boo#1233222)
|
||||
* add patch
|
||||
+ boo1233222_fix_drbd_build_error_against_kernel_v6.11.6.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Oct 11 03:30:00 UTC 2024 - heming zhao <heming.zhao@suse.com>
|
||||
|
||||
- Update DRBD version from 9.1.16 to 9.1.22
|
||||
|
||||
* Changelog from Linbit:
|
||||
|
||||
9.1.22 (api:genl2/proto:86-121/transport:18)
|
||||
--------
|
||||
* Upgrade from partial resync to a full resync if necessary when the
|
||||
user manually resolves a split-brain situation
|
||||
* Fix a potential NULL deref when a disk fails while doing a
|
||||
forget-peer operation.
|
||||
* Fix a rcu_read_lock()/rcu_read_unlock() imbalance
|
||||
* Restart the open() syscall when a process auto promoting a drbd device gets
|
||||
interrupted by a signal
|
||||
* Remove a deadlock that caused DRBD to connect sometimes
|
||||
exceptionally slow
|
||||
* Make detach operations interruptible
|
||||
* Added dev_is_open to events2 status information
|
||||
* Improve log readability for 2PC state changes and drbd-threads
|
||||
* Updated compability code for Linux 6.9
|
||||
|
||||
9.1.21 (api:genl2/proto:86-121/transport:18)
|
||||
--------
|
||||
* fix a deadlock that can trigger when deleting a connection and
|
||||
another connection going down in parallel. This is a regression of
|
||||
9.1.20
|
||||
* Fix an out-of-bounds access when scanning the bitmap. It leads to a
|
||||
crash when the bitmap ends on a page boundary, and this is also a
|
||||
regression in 9.1.20.
|
||||
|
||||
9.1.20 (api:genl2/proto:86-121/transport:18)
|
||||
--------
|
||||
* Fix a kernel crash that is sometimes triggered when downing drbd
|
||||
resources in a specific, unusual order (was triggered by the
|
||||
Kubernetes CSI driver)
|
||||
* Fix a rarely triggering kernel crash upon adding paths to a
|
||||
connection by rehauling the path lists' locking
|
||||
* Fix the continuation of an interrupted initial resync
|
||||
* Fix the state engine so that an incapable primary does not outdate
|
||||
indirectly reachable secondary nodes
|
||||
* Fix a logic bug that caused drbd to pretend that a peer's disk is
|
||||
outdated when doing a manual disconnect on a down connection; with
|
||||
that cured impact on fencing and quorum.
|
||||
* Fix forceful demotion of suspended devices
|
||||
* Rehaul of the build system to apply compatibility patches out of
|
||||
place that allows one to build for different target kernels from a
|
||||
single drbd source tree
|
||||
* Updated compability code for Linux 6.8
|
||||
|
||||
9.1.19 (api:genl2/proto:86-121/transport:18)
|
||||
--------
|
||||
* Fix a resync decision case where drbd wrongly decided to do a full
|
||||
resync, where a partial resync was sufficient; that happened in a
|
||||
specific connect order when all nodes were on the same data
|
||||
generation (UUID)
|
||||
* Fix the online resize code to obey cached size information about
|
||||
temporal unreachable nodes
|
||||
* Fix a rare corner case in which DRBD on a diskless primary node
|
||||
failed to re-issue a read request to another node with a backing
|
||||
disk upon connection loss on the connection where it shipped the
|
||||
read request initially
|
||||
* Make timeout during promotion attempts interruptible
|
||||
* No longer write activity-log updates on the secondary node in a
|
||||
cluster with precisely two nodes with backing disk; this is a
|
||||
performance optimization
|
||||
* Reduce CPU usage of acknowledgment processing
|
||||
|
||||
9.1.18 (api:genl2/proto:86-121/transport:18)
|
||||
--------
|
||||
* Fixed connecting nodes with differently sized backing disks,
|
||||
specifically when the smaller node is primary, before establishing
|
||||
the connections
|
||||
* Fixed thawing a device that has I/O frozen after loss of quorum
|
||||
when a configuration change eases its quorum requirements
|
||||
* Properly fail TLS if requested (only available in drbd-9.2)
|
||||
* Fixed a race condition that can cause auto-demote to trigger right
|
||||
after an explicit promote
|
||||
* Fixed a rare race condition that could mess up the handshake result
|
||||
before it is committed to the replication state.
|
||||
* Preserve "tiebreaker quorum" over a reboot of the last node (3-node
|
||||
clusters only)
|
||||
* Update compatibility code for Linux 6.6
|
||||
|
||||
9.1.17 (api:genl2/proto:86-121/transport:18)
|
||||
--------
|
||||
* fix a potential crash when configuring drbd to bind to a
|
||||
non-existent local IP address (this is a regression of drbd-9.1.8)
|
||||
* Cure a very seldom triggering race condition bug during
|
||||
establishing connections; when you triggered it, you got an OOPS
|
||||
hinting to list corruption
|
||||
* fix a race condition regarding operations on the bitmap while
|
||||
forgetting a bitmap slot and a pointless warning
|
||||
* Fix handling of unexpected (on a resource in secondary role) write
|
||||
requests
|
||||
* Fix a corner case that can cause a process to hang when closing the
|
||||
DRBD device, while a connection gets re-established
|
||||
* Correctly block signal delivery during auto-demote
|
||||
* Improve the reliability of establishing connections
|
||||
* Do not clear the transport with `net-options --set-defaults`. This
|
||||
fix avoids unexpected disconnect/connect cycles upon an `adjust`
|
||||
when using the 'lb-tcp' or 'rdma' transports in drbd-9.2.
|
||||
* New netlink packet to report path status to drbdsetup
|
||||
* Improvements to the content and rate-limiting of many log messages
|
||||
* Update compatibility code and follow Linux upstream development
|
||||
until Linux 6.5
|
||||
|
||||
* remove patches which already included in the new version:
|
||||
0001-drbd-allow-transports-to-take-additional-krefs-on-a-.patch
|
||||
0002-drbd-improve-decision-about-marking-a-failed-disk-Ou.patch
|
||||
0003-drbd-fix-error-path-in-drbd_get_listener.patch
|
||||
0004-drbd-build-fix-spurious-re-build-attempt-of-compat.p.patch
|
||||
0005-drbd-log-error-code-when-thread-fails-to-start.patch
|
||||
0006-drbd-log-numeric-value-of-drbd_state_rv-as-well-as-s.patch
|
||||
0007-drbd-stop-defining-__KERNEL_SYSCALLS__.patch
|
||||
0008-compat-block-introduce-holder-ops.patch
|
||||
0009-drbd-reduce-net_ee-not-empty-info-to-a-dynamic-debug.patch
|
||||
0010-drbd-do-not-send-P_CURRENT_UUID-to-DRBD-8-peer-when-.patch
|
||||
0011-compat-block-pass-a-gendisk-to-open.patch
|
||||
0012-drbd-Restore-DATA_CORKED-and-CONTROL_CORKED-bits.patch
|
||||
0013-drbd-remove-unused-extern-for-conn_try_outdate_peer.patch
|
||||
0014-drbd-include-source-of-state-change-in-log.patch
|
||||
0015-compat-block-use-the-holder-as-indication-for-exclus.patch
|
||||
0016-drbd-Fix-net-options-set-defaults-to-not-clear-the-t.patch
|
||||
0017-drbd-propagate-exposed-UUIDs-only-into-established-c.patch
|
||||
0018-drbd-rework-autopromote.patch
|
||||
0019-compat-block-remove-the-unused-mode-argument-to-rele.patch
|
||||
0020-drbd-do-not-allow-auto-demote-to-be-interrupted-by-s.patch
|
||||
0021-compat-sock-Remove-sendpage-in-favour-of-sendmsg-MSG.patch
|
||||
0022-compat-block-replace-fmode_t-with-a-block-specific-t.patch
|
||||
0023-compat-genetlink-remove-userhdr-from-struct-genl_inf.patch
|
||||
0024-compat-fixup-FMODE_READ-FMODE_WRITE-usage.patch
|
||||
0025-compat-drdb-Convert-to-use-bdev_open_by_path.patch
|
||||
0026-compat-gate-blkdev_-patches-behind-bdev_open_by_path.patch
|
||||
boo1230635_01-compat-fix-nla_nest_start_noflag-test.patch
|
||||
boo1230635_02-drbd-port-block-device-access-to-file.patch
|
||||
|
||||
* removed patches which are not needed anymore:
|
||||
boo1229062-re-enable-blk_queue_max_hw_sectors.patch
|
||||
bsc1226510-fix-build-err-against-6.9.3.patch
|
||||
|
||||
* update:
|
||||
drbd_git_revision
|
||||
suse-coccinelle.patch
|
||||
drbd.spec
|
||||
|
||||
* add upstream patches to align commit 13ada1be201e:
|
||||
0001-drbd-properly-rate-limit-resync-progress-reports.patch
|
||||
0002-drbd-inherit-history-UUIDs-from-sync-source-when-res.patch
|
||||
0003-build-compat-fix-line-offset-in-annotation-pragmas-p.patch
|
||||
0004-drbd-fix-exposed_uuid-going-backward.patch
|
||||
0005-drbd-Proper-locking-around-new_current_uuid-on-a-dis.patch
|
||||
0006-build-CycloneDX-fix-bom-ref-add-purl.patch
|
||||
0007-build-Another-update-to-the-spdx-files.patch
|
||||
0008-build-generate-spdx.json-not-tag-value-format.patch
|
||||
0009-compat-fix-gen_patch_names-for-bdev_file_open_by_pat.patch
|
||||
0010-compat-fix-nla_nest_start_noflag-test.patch
|
||||
0011-compat-fix-blk_alloc_disk-rule.patch
|
||||
0012-drbd-remove-const-from-function-return-type.patch
|
||||
0013-drbd-don-t-set-max_write_zeroes_sectors-in-decide_on.patch
|
||||
0014-drbd-split-out-a-drbd_discard_supported-helper.patch
|
||||
0015-drbd-atomically-update-queue-limits-in-drbd_reconsid.patch
|
||||
0016-compat-test-and-patch-for-queue_limits_start_update.patch
|
||||
0017-compat-specify-which-essential-change-was-not-made.patch
|
||||
0018-gen_patch_names-reorder-blk_mode_t.patch
|
||||
0019-compat-fix-blk_queue_update_readahead-patch.patch
|
||||
0020-compat-test-and-patch-for-que_limits-max_hw_discard_.patch
|
||||
0021-compat-fixup-write_zeroes__no_capable.patch
|
||||
0022-compat-fixup-queue_flag_discard__yes_present.patch
|
||||
0023-drbd-move-flags-to-queue_limits.patch
|
||||
0024-compat-test-and-patch-for-queue_limits.features.patch
|
||||
0025-drbd-Annotate-struct-fifo_buffer-with-__counted_by.patch
|
||||
0026-compat-test-and-patch-for-__counted_by.patch
|
||||
0027-drbd-fix-function-cast-warnings-in-state-machine.patch
|
||||
0028-Add-missing-documentation-of-peer_device-parameter-t.patch
|
||||
0030-drbd-kref_put-path-when-kernel_accept-fails.patch
|
||||
0031-build-fix-typo-in-Makefile.spatch.patch
|
||||
0032-drbd-open-do-not-delay-open-if-already-Primary.patch
|
||||
|
||||
* add patch to fix kernel imcompatibility issue (boo#1231290):
|
||||
boo1231290_fix_drbd_build_error_against_kernel_v6.11.0.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Sep 17 11:38:00 UTC 2024 - heming zhao <heming.zhao@suse.com>
|
||||
|
||||
- drbdadm down fails to remove sysfs holder file (boo#1230635)
|
||||
* add patch
|
||||
+ boo1230635_01-compat-fix-nla_nest_start_noflag-test.patch
|
||||
+ boo1230635_02-drbd-port-block-device-access-to-file.patch
|
||||
* update patch
|
||||
+ bsc1226510-fix-build-err-against-6.9.3.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Aug 12 07:37:42 UTC 2024 - heming zhao <heming.zhao@suse.com>
|
||||
|
||||
- drbd: fix build error against kernel v6.10.3 (boo#1229062)
|
||||
* add patch
|
||||
+ boo1229062-re-enable-blk_queue_max_hw_sectors.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Jun 19 07:54:17 UTC 2024 - heming zhao <heming.zhao@suse.com>
|
||||
|
||||
- drbd: fix build error against kernel v6.9.3 (boo#1226510)
|
||||
* add patch
|
||||
+ bsc1226510-fix-build-err-against-6.9.3.patch
|
||||
|
||||
------------------------------------------------------------------
|
||||
Tue Apr 15 07:50:00 UTC 2024 - Glass Su <glass.su@suse.com>
|
||||
|
||||
- drbd: fix build error against kernel v6.8.2 (boo#1222397)
|
||||
* add upstream patches
|
||||
+ 0024-compat-fixup-FMODE_READ-FMODE_WRITE-usage.patch
|
||||
+ 0025-compat-drdb-Convert-to-use-bdev_open_by_path.patch
|
||||
+ 0026-compat-gate-blkdev_-patches-behind-bdev_open_by_path.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Feb 26 07:45:54 UTC 2024 - Dominique Leuenberger <dimstar@opensuse.org>
|
||||
|
||||
- Use %autosetup macro. Allows to eliminate the usage of deprecated
|
||||
PatchN.
|
||||
|
||||
------------------------------------------------------------------
|
||||
Wed Jan 10 01:55:00 UTC 2024 - Heming Zhao <heming.zhao@suse.com>
|
||||
|
||||
@@ -12,6 +315,16 @@ Wed Jan 10 01:55:00 UTC 2024 - Heming Zhao <heming.zhao@suse.com>
|
||||
+ 0019-compat-block-remove-the-unused-mode-argument-to-rele.patch
|
||||
+ 0022-compat-block-replace-fmode_t-with-a-block-specific-t.patch
|
||||
+ 0023-compat-genetlink-remove-userhdr-from-struct-genl_inf.patch
|
||||
------------------------------------------------------------------
|
||||
Tue Nov 13 11:56:00 UTC 2023 - Glass Su <glass.su@suse.com>
|
||||
|
||||
- drbd: fix build error against kernel v6.6.1 (boo#1217078)
|
||||
* add upstream patches
|
||||
+ 0021-compat-sock-Remove-sendpage-in-favour-of-sendmsg-MSG.patch
|
||||
+ 0022-compat-block-replace-fmode_t-with-a-block-specific-t.patch
|
||||
+ 0023-compat-genetlink-remove-userhdr-from-struct-genl_inf.patch
|
||||
* remove patch which are already included in upstream patches:
|
||||
- bsc-1215699_fix-build-error-against-kernel-v6.5.4.patch
|
||||
|
||||
------------------------------------------------------------------
|
||||
Wed Nov 8 07:47:00 UTC 2023 - Heming Zhao <heming.zhao@suse.com>
|
||||
@@ -26,6 +339,33 @@ Tue Oct 31 10:16:00 UTC 2023 - Heming Zhao <heming.zhao@suse.com>
|
||||
- drbd failed to build after 15sp6/dolomit updated kernel (bsc#1216666)
|
||||
* Add patch
|
||||
+ 0008-compat-block-introduce-holder-ops.patch
|
||||
------------------------------------------------------------------
|
||||
Tue Sep 26 03:35:00 UTC 2023 - Heming Zhao <heming.zhao@suse.com>
|
||||
|
||||
- drbd: fix build error against kernel v6.5.4 (boo#1215699)
|
||||
* add upstream patch
|
||||
+ 0001-drbd-allow-transports-to-take-additional-krefs-on-a-.patch
|
||||
+ 0002-drbd-improve-decision-about-marking-a-failed-disk-Ou.patch
|
||||
+ 0003-drbd-fix-error-path-in-drbd_get_listener.patch
|
||||
+ 0004-drbd-build-fix-spurious-re-build-attempt-of-compat.p.patch
|
||||
+ 0005-drbd-log-error-code-when-thread-fails-to-start.patch
|
||||
+ 0006-drbd-log-numeric-value-of-drbd_state_rv-as-well-as-s.patch
|
||||
+ 0007-drbd-stop-defining-__KERNEL_SYSCALLS__.patch
|
||||
+ 0008-compat-block-introduce-holder-ops.patch
|
||||
+ 0009-drbd-reduce-net_ee-not-empty-info-to-a-dynamic-debug.patch
|
||||
+ 0010-drbd-do-not-send-P_CURRENT_UUID-to-DRBD-8-peer-when-.patch
|
||||
+ 0011-compat-block-pass-a-gendisk-to-open.patch
|
||||
+ 0012-drbd-Restore-DATA_CORKED-and-CONTROL_CORKED-bits.patch
|
||||
+ 0013-drbd-remove-unused-extern-for-conn_try_outdate_peer.patch
|
||||
+ 0014-drbd-include-source-of-state-change-in-log.patch
|
||||
+ 0015-compat-block-use-the-holder-as-indication-for-exclus.patch
|
||||
+ 0016-drbd-Fix-net-options-set-defaults-to-not-clear-the-t.patch
|
||||
+ 0017-drbd-propagate-exposed-UUIDs-only-into-established-c.patch
|
||||
+ 0018-drbd-rework-autopromote.patch
|
||||
+ 0019-compat-block-remove-the-unused-mode-argument-to-rele.patch
|
||||
+ 0020-drbd-do-not-allow-auto-demote-to-be-interrupted-by-s.patch
|
||||
* add suse special patch
|
||||
+ bsc-1215699_fix-build-error-against-kernel-v6.5.4.patch
|
||||
|
||||
------------------------------------------------------------------
|
||||
Mon Sep 04 11:35:00 UTC 2023 - Heming Zhao <heming.zhao@suse.com>
|
||||
|
66
drbd.spec
66
drbd.spec
@@ -23,31 +23,26 @@
|
||||
%define buildrt 1
|
||||
%endif
|
||||
%endif
|
||||
|
||||
Name: drbd
|
||||
Version: 9.1.16
|
||||
Version: 9.1.23
|
||||
Release: 0
|
||||
Summary: Linux driver for the "Distributed Replicated Block Device"
|
||||
License: GPL-2.0-or-later
|
||||
URL: https://drbd.linbit.com/
|
||||
URL: https://pkg.linbit.com/
|
||||
Source: %{name}-%{version}.tar.gz
|
||||
Source1: preamble
|
||||
Source2: Module.supported
|
||||
Source3: drbd_git_revision
|
||||
|
||||
Patch1: bsc-1025089_fix-resync-finished-with-syncs-have-bits-set.patch
|
||||
Patch2: 0006-drbd-log-numeric-value-of-drbd_state_rv-as-well-as-s.patch
|
||||
Patch3: 0008-compat-block-introduce-holder-ops.patch
|
||||
Patch4: 0011-compat-block-pass-a-gendisk-to-open.patch
|
||||
Patch5: 0013-drbd-remove-unused-extern-for-conn_try_outdate_peer.patch
|
||||
Patch6: 0014-drbd-include-source-of-state-change-in-log.patch
|
||||
Patch7: 0015-compat-block-use-the-holder-as-indication-for-exclus.patch
|
||||
Patch8: 0018-drbd-rework-autopromote.patch
|
||||
Patch9: 0019-compat-block-remove-the-unused-mode-argument-to-rele.patch
|
||||
Patch10: 0022-compat-block-replace-fmode_t-with-a-block-specific-t.patch
|
||||
Patch11: 0023-compat-genetlink-remove-userhdr-from-struct-genl_inf.patch
|
||||
Patch12: bsc-1216666-compat-sock-Remove-sendpage-in-favour-of-sendmsg-MSG.patch
|
||||
Patch99: suse-coccinelle.patch
|
||||
########################
|
||||
# upstream patch
|
||||
Patch0001: 0001-drbd-Fix-memory-leak.patch
|
||||
|
||||
# suse special patch
|
||||
Patch1001: bsc-1025089_fix-resync-finished-with-syncs-have-bits-set.patch
|
||||
Patch1002: suse-coccinelle.patch
|
||||
Patch1003: boo1235399-fix_the_warning_of_blk_validate_limits.patch
|
||||
########################
|
||||
|
||||
#https://github.com/openSUSE/rpmlint-checks/blob/master/KMPPolicyCheck.py
|
||||
BuildRequires: coccinelle >= 1.0.8
|
||||
@@ -55,6 +50,7 @@ BuildRequires: kernel-source
|
||||
BuildRequires: kernel-syms
|
||||
BuildRequires: libelf-devel
|
||||
BuildRequires: modutils
|
||||
BuildRequires: perl
|
||||
BuildRequires: %kernel_module_package_buildreqs
|
||||
Requires: drbd-utils >= 9.3.0
|
||||
Supplements: drbd-utils >= 9.3.0
|
||||
@@ -81,24 +77,7 @@ that multiple kernel driver versions can be installed, one for each
|
||||
installed kernel.
|
||||
|
||||
%prep
|
||||
%setup -q -n drbd-%{version}
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
%patch8 -p1
|
||||
%patch9 -p1
|
||||
%patch10 -p1
|
||||
%patch11 -p1
|
||||
%patch12 -p1
|
||||
%patch99 -p1
|
||||
|
||||
mkdir source
|
||||
cp -a drbd/. source/. || :
|
||||
cp $RPM_SOURCE_DIR/drbd_git_revision source/.drbd_git_revision
|
||||
%autosetup -p1 -n drbd-%{version}
|
||||
|
||||
%build
|
||||
rm -rf obj
|
||||
@@ -114,26 +93,33 @@ export SPAAS='false'
|
||||
|
||||
for flavor in %{flavors_to_build}; do
|
||||
rm -rf $flavor
|
||||
cp -a -r source $flavor
|
||||
cp -a %{_sourcedir}/Module.supported $flavor
|
||||
cp -a -r drbd $flavor
|
||||
cp $RPM_SOURCE_DIR/drbd_git_revision ${flavor}/.drbd_git_revision
|
||||
|
||||
export DRBDSRC="$PWD/obj/$flavor"
|
||||
# bsc#1160194, check the coccicheck work.
|
||||
#make coccicheck
|
||||
make %{?_smp_mflags} -C %{kernel_source $flavor} modules M=$PWD/$flavor SPAAS=${SPAAS}
|
||||
|
||||
# call make prep to generate drbd build dir
|
||||
make %{?_smp_mflags} -C $flavor KDIR=%{kernel_source $flavor} prep SPAAS=${SPAAS}
|
||||
|
||||
cp -a %{_sourcedir}/Module.supported ${flavor}/build-current
|
||||
|
||||
make %{?_smp_mflags} -C %{kernel_source $flavor} modules M=$PWD/$flavor/build-current SPAAS=${SPAAS}
|
||||
|
||||
# Check the compat result
|
||||
cat $PWD/$flavor/compat.h
|
||||
cat $PWD/${flavor}/build-current/compat.h
|
||||
done
|
||||
|
||||
%install
|
||||
export INSTALL_MOD_PATH=%{buildroot}
|
||||
export INSTALL_MOD_DIR=updates
|
||||
for flavor in %{flavors_to_build}; do
|
||||
make -C %{kernel_source $flavor} modules_install M=$PWD/$flavor
|
||||
make -C %{kernel_source $flavor} modules_install M=$PWD/$flavor/build-current
|
||||
done
|
||||
|
||||
mkdir -p %{buildroot}/%{_sbindir}
|
||||
ln -s -f %{_sbindir}/service %{buildroot}/%{_sbindir}/rc%{name}
|
||||
ln -s service %{buildroot}/%{_sbindir}/rc%{name}
|
||||
rm -f drbd.conf
|
||||
|
||||
%files
|
||||
|
@@ -1 +1 @@
|
||||
GIT-hash: 288abda1fb8c93e385960af01ab28729fefdaa38
|
||||
GIT-hash: d64ebe7eb7df8c622b20bca38f3d7f4c7bb033c9
|
||||
|
@@ -1,76 +1,71 @@
|
||||
diff -Naur drbd-9.0.29~0+git.9a7bc817.orig/drbd/drbd-kernel-compat/gen_compat_patch.sh drbd-9.0.29~0+git.9a7bc817/drbd/drbd-kernel-compat/gen_compat_patch.sh
|
||||
--- drbd-9.0.29~0+git.9a7bc817.orig/drbd/drbd-kernel-compat/gen_compat_patch.sh 2021-05-07 11:24:44.877547149 +0800
|
||||
+++ drbd-9.0.29~0+git.9a7bc817/drbd/drbd-kernel-compat/gen_compat_patch.sh 2021-05-07 12:30:58.385703306 +0800
|
||||
@@ -44,9 +44,19 @@
|
||||
diff -Nupr a/drbd/drbd-kernel-compat/gen_compat_patch.sh b/drbd/drbd-kernel-compat/gen_compat_patch.sh
|
||||
--- a/drbd/drbd-kernel-compat/gen_compat_patch.sh 2024-09-16 10:24:47.044861735 +0800
|
||||
+++ b/drbd/drbd-kernel-compat/gen_compat_patch.sh 2024-09-16 10:32:03.256040980 +0800
|
||||
@@ -43,9 +43,19 @@ fi
|
||||
|
||||
if hash spatch && spatch_is_recent; then
|
||||
K=$(cat $incdir/kernelrelease.txt)
|
||||
K=$(cat $incdir/kernelrelease.txt || echo unknown kernel release)
|
||||
+
|
||||
+ echo " compat.h content ";
|
||||
+ cat $incdir/compat.h;
|
||||
+ echo " ------------------- ";
|
||||
+ echo " compat.h content ";
|
||||
+ cat $incdir/compat.h;
|
||||
+ echo " ------------------- ";
|
||||
+
|
||||
echo " GENPATCHNAMES "$K
|
||||
gcc -I $incdir -o $incdir/gen_patch_names -std=c99 drbd-kernel-compat/gen_patch_names.c
|
||||
$incdir/gen_patch_names > $incdir/applied_cocci_files.txt
|
||||
echo " GENPATCHNAMES "$K
|
||||
gcc -I $incdir -o $incdir/gen_patch_names -std=c99 drbd-kernel-compat/gen_patch_names.c
|
||||
$incdir/gen_patch_names > $incdir/applied_cocci_files.txt
|
||||
+
|
||||
+ echo " APPLIED_COCCI_FILES ";
|
||||
+ cat $incdir/applied_cocci_files.txt;
|
||||
+ echo " ------------------- ";
|
||||
+ echo " APPLIED_COCCI_FILES ";
|
||||
+ cat $incdir/applied_cocci_files.txt;
|
||||
+ echo " ------------------- ";
|
||||
+
|
||||
rm $incdir/gen_patch_names
|
||||
rm -f $incdir/.compat.cocci
|
||||
rm -f $incdir/.compat.patch
|
||||
@@ -67,7 +77,15 @@
|
||||
< drbd-kernel-compat/cocci/debugfs_compat_template.cocci.in \
|
||||
>> $incdir/.compat.cocci
|
||||
done
|
||||
+
|
||||
+ coccilibpath=$(rpm -ql coccinelle|grep standard.h|xargs dirname);
|
||||
+ echo " SPATCH_SOURCES: "$*;
|
||||
+ echo " COCCI_LIBPATH: "$coccilibpath;
|
||||
+
|
||||
if [ -e $incdir/.compat.cocci ]; then
|
||||
+ echo " GENCOCCIRULES .compat.cocci";
|
||||
+ cat $incdir/.compat.cocci;
|
||||
+
|
||||
echo " SPATCH $chksum "$K
|
||||
# Note: $* (or $@) is NOT make magic variable now, this is a shell script
|
||||
# make $@, the target file, was passed as $1, and is now $compat_patch
|
||||
@@ -77,8 +95,14 @@
|
||||
# we know we don't have white-space in the argument list
|
||||
rm $incdir/gen_patch_names
|
||||
# truncat them all
|
||||
: > $incdir/.compat.cocci
|
||||
@@ -72,15 +82,28 @@ if hash spatch && spatch_is_recent; then
|
||||
>> $incdir/.compat.cocci.tmp
|
||||
done
|
||||
|
||||
set +e
|
||||
+ coccilibpath=$(rpm -ql coccinelle|grep standard.h|xargs dirname);
|
||||
+ echo " SPATCH_SOURCES: "$*;
|
||||
+ echo " COCCI_LIBPATH: "$coccilibpath;
|
||||
+
|
||||
+ command="spatch --sp-file $incdir/.compat.cocci $@ --macro-file drbd-kernel-compat/cocci_macros.h --macro-file-builtins $coccilibpath/standard.h --iso-file $coccilibpath/standard.iso --very-quiet --all-includes > $compat_patch.tmp 2> $incdir/.spatch.stderr"
|
||||
+ echo " SPATCH COMMAND $command ";
|
||||
mv $incdir/.compat.cocci.tmp $incdir/.compat.cocci
|
||||
mv $incdir/.compat.patch.tmp $incdir/.compat.patch
|
||||
|
||||
if [ -s $incdir/.compat.cocci ]; then
|
||||
+ echo " GENCOCCIRULES .compat.cocci";
|
||||
+ cat $incdir/.compat.cocci;
|
||||
+
|
||||
spatch --sp-file "$incdir/.compat.cocci" "$@" \
|
||||
--macro-file drbd-kernel-compat/cocci_macros.h \
|
||||
+ --macro-file-builtins $coccilibpath/standard.h \
|
||||
+ --iso-file $coccilibpath/standard.iso \
|
||||
--very-quiet \
|
||||
--all-includes \
|
||||
> "$compat_patch.tmp" \
|
||||
@@ -94,9 +118,21 @@
|
||||
echo " SPATCH $chksum "$K" - nothing to do"
|
||||
touch $compat_patch.tmp
|
||||
fi
|
||||
# sources=( ... ) passed in via environment
|
||||
echo " SPATCH $chksum "$K
|
||||
set +e
|
||||
+
|
||||
+ echo " GENSPATCHFILE $compat_patch.tmp ";
|
||||
+ cat $compat_patch.tmp;
|
||||
+ command="spatch --sp-file $incdir/.compat.cocci $@ --macro-file drbd-kernel-compat/cocci_macros.h --macro-file-builtins $coccilibpath/standard.h --iso-file $coccilibpath/standard.iso --very-quiet --all-includes > $compat_patch.tmp 2> $incdir/.spatch.stderr"
|
||||
+ echo " SPATCH COMMAND $command ";
|
||||
+
|
||||
if [ -e $incdir/.compat.patch ]; then
|
||||
+ echo " EXIST $incdir/.compat.patch ";
|
||||
cat $incdir/.compat.patch >> $compat_patch.tmp
|
||||
spatch --sp-file "$incdir/.compat.cocci" "${sources[@]}" \
|
||||
--macro-file drbd-kernel-compat/cocci_macros.h \
|
||||
+ --macro-file-builtins $coccilibpath/standard.h \
|
||||
+ --iso-file $coccilibpath/standard.iso \
|
||||
--very-quiet \
|
||||
--all-includes \
|
||||
${SPATCH_DEBUG:+ --debug} \
|
||||
@@ -101,8 +124,18 @@ if hash spatch && spatch_is_recent; then
|
||||
echo " SPATCH $chksum "$K" - nothing to do"
|
||||
fi
|
||||
|
||||
+ echo " GENSPATCHFILE $compat_patch.tmp ";
|
||||
+ cat $compat_patch.tmp;
|
||||
fi
|
||||
+
|
||||
+ if [ -e $incdir/.spatch.stderr ]; then
|
||||
+ echo " GENSPATCHERR .spatch.stderr";
|
||||
+ cat $incdir/.spatch.stderr;
|
||||
+ fi
|
||||
if [ -s $incdir/.compat.patch ]; then
|
||||
+ echo " EXIST $incdir/.compat.patch ";
|
||||
cat $incdir/.compat.patch >> $compat_patch.tmp
|
||||
+ cat $compat_patch.tmp;
|
||||
+ fi
|
||||
+
|
||||
mv $compat_patch.tmp $compat_patch
|
||||
# keep it around
|
||||
# to better be able to match the "stderr" warnings to their source files
|
||||
+ if [ -e $incdir/.spatch.stderr ]; then
|
||||
+ echo " GENSPATCHERR .spatch.stderr";
|
||||
+ cat $incdir/.spatch.stderr;
|
||||
fi
|
||||
|
||||
if [ -s $compat_patch.tmp ]; then
|
||||
|
Reference in New Issue
Block a user