Accepting request 1201602 from network:ha-clustering:Factory

OBS-URL: https://build.opensuse.org/request/show/1201602
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/drbd?expand=0&rev=111
This commit is contained in:
Ana Guerrero 2024-09-17 16:19:33 +00:00 committed by Git OBS Bridge
commit 6c06a89906
5 changed files with 234 additions and 144 deletions

View File

@ -0,0 +1,35 @@
From f6078aa51ed5b776eb2f646553872d576c404c60 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christoph=20B=C3=B6hmwalder?=
<christoph.boehmwalder@linbit.com>
Date: Tue, 13 Aug 2024 12:40:27 +0200
Subject: [PATCH] compat: fix nla_nest_start_noflag test
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
GCC complains:
returning struct nlattr * from a function with return type int makes
integer from pointer without a cast
Return the proper type from this function.
---
drbd/drbd-kernel-compat/tests/have_nla_nest_start_noflag.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drbd/drbd-kernel-compat/tests/have_nla_nest_start_noflag.c b/drbd/drbd-kernel-compat/tests/have_nla_nest_start_noflag.c
index 1d8037c397c5..62ab06c563b7 100644
--- a/drbd/drbd-kernel-compat/tests/have_nla_nest_start_noflag.c
+++ b/drbd/drbd-kernel-compat/tests/have_nla_nest_start_noflag.c
@@ -1,7 +1,7 @@
/* {"version": "5.1-rc7", "commit": "ae0be8de9a53cda3505865c11826d8ff0640237c", "comment": "nla_nest_start was renamed to _noflag, and the original version became a wrapper adding a flag", "author": "Michal Kubecek <mkubecek@suse.cz>", "date": "Fri Apr 26 11:13:06 2019 +0200"} */
#include <net/netlink.h>
-int dummy(struct sk_buff *skb, int attrtype)
+static struct nlattr *dummy(struct sk_buff *skb, int attrtype)
{
return nla_nest_start_noflag(skb, attrtype);
}
--
2.35.3

View File

@ -0,0 +1,180 @@
From cfa95bfaefdc2c4e91806fdeb810901015a42a36 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christoph=20B=C3=B6hmwalder?=
<christoph.boehmwalder@linbit.com>
Date: Thu, 27 Jun 2024 11:19:33 +0200
Subject: [PATCH] drbd: port block device access to file
Equivalent to upstream kernel commit 20e6a8d0dcdc
("drbd: port block device access to file").
---
by heming.zhao@suse.com
change this patch (ignore commit cdd3b8aa03f1a)
from:
```
/* avoid double bd_claim_by_disk() for the same (source,target) tuple,
* as would happen with internal metadata. */
- if (handle->bdev != nbc->backing_bdev) {
- err = link_backing_dev(device, new_disk_conf->meta_dev, handle);
```
to:
```
/* avoid double bd_claim_by_disk() for the same (source,target) tuple,
* as would happen with internal metadata. */
- if (handle != nbc->backing_bdev_handle) {
- err = link_backing_dev(device, new_disk_conf->meta_dev, handle);
```
---
drbd/drbd_int.h | 4 ++--
drbd/drbd_nl.c | 56 ++++++++++++++++++++++++-------------------------
2 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/drbd/drbd_int.h b/drbd/drbd_int.h
index ae7b45b2f8df..0ebd79091af6 100644
--- a/drbd/drbd_int.h
+++ b/drbd/drbd_int.h
@@ -704,9 +704,9 @@ struct drbd_md {
struct drbd_backing_dev {
struct block_device *backing_bdev;
- struct bdev_handle *backing_bdev_handle;
+ struct file *backing_bdev_file;
struct block_device *md_bdev;
- struct bdev_handle *md_bdev_handle;
+ struct file *f_md_bdev;
struct drbd_md md;
struct disk_conf __rcu *disk_conf; /* RCU, for updates: resource->conf_update */
sector_t known_size; /* last known size of that backing device */
diff --git a/drbd/drbd_nl.c b/drbd/drbd_nl.c
index 298db40b22ea..b732fa6f9d60 100644
--- a/drbd/drbd_nl.c
+++ b/drbd/drbd_nl.c
@@ -2710,13 +2710,13 @@ bool want_bitmap(struct drbd_peer_device *peer_device)
}
static void close_backing_dev(struct drbd_device *device,
- struct bdev_handle *handle, bool do_bd_unlink)
+ struct file *bdev_file, bool do_bd_unlink)
{
- if (!handle)
+ if (!bdev_file)
return;
if (do_bd_unlink)
- bd_unlink_disk_holder(handle->bdev, device->vdisk);
- bdev_release(handle);
+ bd_unlink_disk_holder(file_bdev(bdev_file), device->vdisk);
+ fput(bdev_file);
}
void drbd_backing_dev_free(struct drbd_device *device, struct drbd_backing_dev *ldev)
@@ -2727,33 +2727,33 @@ void drbd_backing_dev_free(struct drbd_device *device, struct drbd_backing_dev *
drbd_dax_close(ldev);
close_backing_dev(device,
- ldev->md_bdev_handle,
+ ldev->f_md_bdev,
ldev->md_bdev != ldev->backing_bdev);
- close_backing_dev(device, ldev->backing_bdev_handle, true);
+ close_backing_dev(device, ldev->backing_bdev_file, true);
kfree(ldev->disk_conf);
kfree(ldev);
}
-static struct bdev_handle *open_backing_dev(struct drbd_device *device,
+static struct file *open_backing_dev(struct drbd_device *device,
const char *bdev_path, void *claim_ptr)
{
- struct bdev_handle *handle = bdev_open_by_path(bdev_path,
+ struct file *file = bdev_file_open_by_path(bdev_path,
BLK_OPEN_READ | BLK_OPEN_WRITE,
claim_ptr, NULL);
- if (IS_ERR(handle)) {
+ if (IS_ERR(file)) {
drbd_err(device, "open(\"%s\") failed with %ld\n",
- bdev_path, PTR_ERR(handle));
+ bdev_path, PTR_ERR(file));
}
- return handle;
+ return file;
}
static int link_backing_dev(struct drbd_device *device,
- const char *bdev_path, struct bdev_handle *handle)
+ const char *bdev_path, struct file *file)
{
- int err = bd_link_disk_holder(handle->bdev, device->vdisk);
+ int err = bd_link_disk_holder(file_bdev(file), device->vdisk);
if (err) {
- bdev_release(handle);
+ fput(file);
drbd_err(device, "bd_link_disk_holder(\"%s\", ...) failed with %d\n",
bdev_path, err);
}
@@ -2764,22 +2764,22 @@ static int open_backing_devices(struct drbd_device *device,
struct disk_conf *new_disk_conf,
struct drbd_backing_dev *nbc)
{
- struct bdev_handle *handle;
+ struct file *file;
void *meta_claim_ptr;
int err;
- handle = open_backing_dev(device, new_disk_conf->backing_dev, device);
- if (IS_ERR(handle))
+ file = open_backing_dev(device, new_disk_conf->backing_dev, device);
+ if (IS_ERR(file))
return ERR_OPEN_DISK;
- err = link_backing_dev(device, new_disk_conf->backing_dev, handle);
+ err = link_backing_dev(device, new_disk_conf->backing_dev, file);
if (err) {
/* close without unlinking; otherwise error path will try to unlink */
- close_backing_dev(device, handle, false);
+ close_backing_dev(device, file, false);
return ERR_OPEN_DISK;
}
- nbc->backing_bdev = handle->bdev;
- nbc->backing_bdev_handle = handle;
+ nbc->backing_bdev = file_bdev(file);
+ nbc->backing_bdev_file = file;
/* meta_claim_ptr: device, if claimed exclusively; shared drbd_m_holder,
* if potentially shared with other drbd minors
@@ -2794,23 +2794,23 @@ 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)
*/
- handle = open_backing_dev(device, new_disk_conf->meta_dev, meta_claim_ptr);
- if (IS_ERR(handle))
+ file = open_backing_dev(device, new_disk_conf->meta_dev, meta_claim_ptr);
+ if (IS_ERR(file))
return ERR_OPEN_MD_DISK;
/* avoid double bd_claim_by_disk() for the same (source,target) tuple,
* as would happen with internal metadata. */
- if (handle != nbc->backing_bdev_handle) {
- err = link_backing_dev(device, new_disk_conf->meta_dev, handle);
+ if (file_bdev(file) != nbc->backing_bdev) {
+ err = link_backing_dev(device, new_disk_conf->meta_dev, file);
if (err) {
/* close without unlinking; otherwise error path will try to unlink */
- close_backing_dev(device, handle, false);
+ close_backing_dev(device, file, false);
return ERR_OPEN_MD_DISK;
}
}
- nbc->md_bdev = handle->bdev;
- nbc->md_bdev_handle = handle;
+ nbc->md_bdev = file_bdev(file);
+ nbc->f_md_bdev = file;
return NO_ERROR;
}
--
2.35.3

View File

@ -1,3 +1,9 @@
By heming.zhao@suse.com
This patch was updated/changed after boo#1230635
----
diff -Nupr a/drbd/drbd-kernel-compat/tests/have_bdev_open_by_path.c b/drbd/drbd-kernel-compat/tests/have_bdev_open_by_path.c
--- a/drbd/drbd-kernel-compat/tests/have_bdev_open_by_path.c 2024-06-19 15:02:47.050694378 +0800
+++ b/drbd/drbd-kernel-compat/tests/have_bdev_open_by_path.c 2024-06-19 15:11:39.313298178 +0800
@ -34,21 +40,6 @@ diff -Nupr a/drbd/drbd-kernel-compat/tests/have_blk_alloc_disk.c b/drbd/drbd-ker
+ };
+ return blk_alloc_disk(&lim, node);
}
diff -Nupr a/drbd/drbd_int.h b/drbd/drbd_int.h
--- a/drbd/drbd_int.h 2024-06-19 15:33:16.756027168 +0800
+++ b/drbd/drbd_int.h 2024-06-19 15:32:58.459276389 +0800
@@ -700,9 +700,9 @@ struct drbd_md {
struct drbd_backing_dev {
struct block_device *backing_bdev;
- struct bdev_handle *backing_bdev_handle;
+ struct file *backing_bdev_file;
struct block_device *md_bdev;
- struct bdev_handle *md_bdev_handle;
+ struct file *md_bdev_file;
struct drbd_md md;
struct disk_conf __rcu *disk_conf; /* RCU, for updates: resource->conf_update */
sector_t known_size; /* last known size of that backing device */
diff -Nupr a/drbd/drbd_main.c b/drbd/drbd_main.c
--- a/drbd/drbd_main.c 2024-06-19 11:41:59.409367593 +0800
+++ b/drbd/drbd_main.c 2024-06-19 11:41:40.052600574 +0800
@ -85,132 +76,3 @@ diff -Nupr a/drbd/drbd_main.c b/drbd/drbd_main.c
if (!disk)
goto out_no_disk;
diff -Nupr a/drbd/drbd_nl.c b/drbd/drbd_nl.c
--- a/drbd/drbd_nl.c 2024-06-19 15:16:28.118044330 +0800
+++ b/drbd/drbd_nl.c 2024-06-19 15:32:49.535902019 +0800
@@ -2536,13 +2536,13 @@ bool want_bitmap(struct drbd_peer_device
}
static void close_backing_dev(struct drbd_device *device,
- struct bdev_handle *handle, bool do_bd_unlink)
+ struct file *bdev_file, bool do_bd_unlink)
{
- if (!handle)
+ if (!bdev_file)
return;
if (do_bd_unlink)
- bd_unlink_disk_holder(handle->bdev, device->vdisk);
- bdev_release(handle);
+ bd_unlink_disk_holder(file_bdev(bdev_file), device->vdisk);
+ fput(bdev_file);
}
void drbd_backing_dev_free(struct drbd_device *device, struct drbd_backing_dev *ldev)
@@ -2553,33 +2553,34 @@ void drbd_backing_dev_free(struct drbd_d
drbd_dax_close(ldev);
close_backing_dev(device,
- ldev->md_bdev_handle,
+ ldev->md_bdev_file,
ldev->md_bdev != ldev->backing_bdev);
- close_backing_dev(device, ldev->backing_bdev_handle, true);
+ close_backing_dev(device, ldev->backing_bdev_file, true);
kfree(ldev->disk_conf);
kfree(ldev);
}
-static struct bdev_handle *open_backing_dev(struct drbd_device *device,
+static struct file *open_backing_dev(struct drbd_device *device,
const char *bdev_path, void *claim_ptr)
{
- struct bdev_handle *handle = bdev_open_by_path(bdev_path,
- BLK_OPEN_READ | BLK_OPEN_WRITE,
- claim_ptr, NULL);
- if (IS_ERR(handle)) {
+ struct file *file;
+
+ file = bdev_file_open_by_path(bdev_path, BLK_OPEN_READ | BLK_OPEN_WRITE,
+ claim_ptr, NULL);
+ if (IS_ERR(file)) {
drbd_err(device, "open(\"%s\") failed with %ld\n",
- bdev_path, PTR_ERR(handle));
+ bdev_path, PTR_ERR(file));
}
- return handle;
+ return file;
}
static int link_backing_dev(struct drbd_device *device,
- const char *bdev_path, struct bdev_handle *handle)
+ const char *bdev_path, struct file *file)
{
- int err = bd_link_disk_holder(handle->bdev, device->vdisk);
+ int err = bd_link_disk_holder(file_bdev(file), device->vdisk);
if (err) {
- bdev_release(handle);
+ fput(file);
drbd_err(device, "bd_link_disk_holder(\"%s\", ...) failed with %d\n",
bdev_path, err);
}
@@ -2590,22 +2591,22 @@ static int open_backing_devices(struct d
struct disk_conf *new_disk_conf,
struct drbd_backing_dev *nbc)
{
- struct bdev_handle *handle;
+ struct file *file;
void *meta_claim_ptr;
int err;
- handle = open_backing_dev(device, new_disk_conf->backing_dev, device);
- if (IS_ERR(handle))
+ file = open_backing_dev(device, new_disk_conf->backing_dev, device);
+ if (IS_ERR(file))
return ERR_OPEN_DISK;
- err = link_backing_dev(device, new_disk_conf->backing_dev, handle);
+ err = link_backing_dev(device, new_disk_conf->backing_dev, file);
if (err) {
/* close without unlinking; otherwise error path will try to unlink */
- close_backing_dev(device, handle, false);
+ close_backing_dev(device, file, false);
return ERR_OPEN_DISK;
}
- nbc->backing_bdev = handle->bdev;
- nbc->backing_bdev_handle = handle;
+ nbc->backing_bdev = file_bdev(file);
+ nbc->backing_bdev_file = file;
/* meta_claim_ptr: device, if claimed exclusively; shared drbd_m_holder,
* if potentially shared with other drbd minors
@@ -2620,23 +2621,23 @@ static int open_backing_devices(struct d
* should check it for you already; but if you don't, or
* someone fooled it, we need to double check here)
*/
- handle = open_backing_dev(device, new_disk_conf->meta_dev, meta_claim_ptr);
- if (IS_ERR(handle))
+ file = open_backing_dev(device, new_disk_conf->meta_dev, meta_claim_ptr);
+ if (IS_ERR(file))
return ERR_OPEN_MD_DISK;
/* avoid double bd_claim_by_disk() for the same (source,target) tuple,
* as would happen with internal metadata. */
- if (handle != nbc->backing_bdev_handle) {
- err = link_backing_dev(device, new_disk_conf->meta_dev, handle);
+ if (file != nbc->backing_bdev_file) {
+ err = link_backing_dev(device, new_disk_conf->meta_dev, file);
if (err) {
/* close without unlinking; otherwise error path will try to unlink */
- close_backing_dev(device, handle, false);
+ close_backing_dev(device, file, false);
return ERR_OPEN_MD_DISK;
}
}
- nbc->md_bdev = handle->bdev;
- nbc->md_bdev_handle = handle;
+ nbc->md_bdev = file_bdev(file);
+ nbc->md_bdev_file = file;
return NO_ERROR;
}

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
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>

View File

@ -62,6 +62,9 @@ Patch0023: 0023-compat-genetlink-remove-userhdr-from-struct-genl_inf.patch
Patch0024: 0024-compat-fixup-FMODE_READ-FMODE_WRITE-usage.patch
Patch0025: 0025-compat-drdb-Convert-to-use-bdev_open_by_path.patch
Patch0026: 0026-compat-gate-blkdev_-patches-behind-bdev_open_by_path.patch
Patch0027: boo1230635_01-compat-fix-nla_nest_start_noflag-test.patch
Patch0028: boo1230635_02-drbd-port-block-device-access-to-file.patch
# suse special patch
Patch1001: bsc-1025089_fix-resync-finished-with-syncs-have-bits-set.patch
Patch1002: suse-coccinelle.patch