2023-01-13 12:58:04

by Christoph Böhmwalder

[permalink] [raw]
Subject: [RESEND PATCH 0/8] Miscellaneous DRBD reorganization

Some more mostly trivial "alignment patches" to (slowly but surely)
move further in the direction of re-upstreaming DRBD.

These should be fairly uncontroversial.

Andreas Gruenbacher (1):
drbd: drbd_insert_interval(): Clarify comment

Christoph Böhmwalder (5):
drbd: adjust drbd_limits license header
drbd: make limits unsigned
drbd: remove unnecessary assignment in vli_encode_bits
drbd: remove macros using require_context
MAINTAINERS: add drbd headers

Lars Ellenberg (1):
drbd: interval tree: make removing an "empty" interval a no-op

Robert Altnoeder (1):
drbd: fix DRBD_VOLUME_MAX 65535 -> 65534

MAINTAINERS | 1 +
drivers/block/drbd/drbd_int.h | 12 +-
drivers/block/drbd/drbd_interval.c | 6 +-
drivers/block/drbd/drbd_vli.h | 2 +-
include/linux/drbd_limits.h | 204 ++++++++++++++---------------
5 files changed, 110 insertions(+), 115 deletions(-)


base-commit: f596da3efaf4130ff61cd029558845808df9bf99
--
2.38.1


2023-01-13 12:58:19

by Christoph Böhmwalder

[permalink] [raw]
Subject: [PATCH 7/8] drbd: interval tree: make removing an "empty" interval a no-op

From: Lars Ellenberg <[email protected]>

Trying to remove an "empty" (just initialized, or "cleared") interval
from the tree, this results in an endless loop.

As we typically protect the tree with a spinlock_irq,
the result is a hung system.

Be nice to error cleanup code paths, ignore removal of empty intervals.

Signed-off-by: Lars Ellenberg <[email protected]>
Signed-off-by: Christoph Böhmwalder <[email protected]>
---
drivers/block/drbd/drbd_interval.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/block/drbd/drbd_interval.c b/drivers/block/drbd/drbd_interval.c
index 5024ffd6143d..b6aaf0d4d85b 100644
--- a/drivers/block/drbd/drbd_interval.c
+++ b/drivers/block/drbd/drbd_interval.c
@@ -95,6 +95,10 @@ drbd_contains_interval(struct rb_root *root, sector_t sector,
void
drbd_remove_interval(struct rb_root *root, struct drbd_interval *this)
{
+ /* avoid endless loop */
+ if (drbd_interval_empty(this))
+ return;
+
rb_erase_augmented(&this->rb, root, &augment_callbacks);
}

--
2.38.1

2023-01-13 12:58:21

by Christoph Böhmwalder

[permalink] [raw]
Subject: [PATCH 1/8] drbd: adjust drbd_limits license header

See also commit 93c68cc46a07 ("drbd: use consistent license"). We only
want to license drbd under GPL-2.0, so use the corresponding SPDX header
consistently.

Signed-off-by: Christoph Böhmwalder <[email protected]>
Reviewed-by: Joel Colledge <[email protected]>
---
include/linux/drbd_limits.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/drbd_limits.h b/include/linux/drbd_limits.h
index 9e33f7038bea..d64271ccece4 100644
--- a/include/linux/drbd_limits.h
+++ b/include/linux/drbd_limits.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
/*
drbd_limits.h
This file is part of DRBD by Philipp Reisner and Lars Ellenberg.
--
2.38.1

2023-01-13 12:59:10

by Christoph Böhmwalder

[permalink] [raw]
Subject: [PATCH 4/8] drbd: remove unnecessary assignment in vli_encode_bits

Signed-off-by: Christoph Böhmwalder <[email protected]>
Reviewed-by: Joel Colledge <[email protected]>
---
drivers/block/drbd/drbd_vli.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/drbd/drbd_vli.h b/drivers/block/drbd/drbd_vli.h
index 1ee81e3c2152..941c511cc4da 100644
--- a/drivers/block/drbd/drbd_vli.h
+++ b/drivers/block/drbd/drbd_vli.h
@@ -327,7 +327,7 @@ static inline int bitstream_get_bits(struct bitstream *bs, u64 *out, int bits)
*/
static inline int vli_encode_bits(struct bitstream *bs, u64 in)
{
- u64 code = code;
+ u64 code;
int bits = __vli_encode_bits(&code, in);

if (bits <= 0)
--
2.38.1

2023-01-13 12:59:37

by Christoph Böhmwalder

[permalink] [raw]
Subject: [PATCH 2/8] drbd: fix DRBD_VOLUME_MAX 65535 -> 65534

From: Robert Altnoeder <[email protected]>

The protocol uses -1 as a reserved value for
'no specific volume', and since the protocol field
is a 16 bit unsigned value, -1 is converted to
65535. Therefore, limit the range of valid volume
numbers to [0, 65534].

Signed-off-by: Robert Altnoeder <[email protected]>
Signed-off-by: Christoph Böhmwalder <[email protected]>
Reviewed-by: Joel Colledge <[email protected]>
---
include/linux/drbd_limits.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/drbd_limits.h b/include/linux/drbd_limits.h
index d64271ccece4..058f7600f79c 100644
--- a/include/linux/drbd_limits.h
+++ b/include/linux/drbd_limits.h
@@ -21,7 +21,7 @@
#define DRBD_MINOR_COUNT_DEF 32
#define DRBD_MINOR_COUNT_SCALE '1'

-#define DRBD_VOLUME_MAX 65535
+#define DRBD_VOLUME_MAX 65534

#define DRBD_DIALOG_REFRESH_MIN 0
#define DRBD_DIALOG_REFRESH_MAX 600
--
2.38.1

2023-01-13 13:00:11

by Christoph Böhmwalder

[permalink] [raw]
Subject: [PATCH 5/8] drbd: remove macros using require_context

This require_context attribute originated in a proposed sparse patch by
Philipp Reisner back in 2008. Johannes Berg had a different solution to
a similar problem, and that patch "won" in the end; so the require_context
thing never got merged. The whole history can be read at [0].

DRBD kept using these annotations anyway for a while. Nowadays, on a
modern unmodified sparse, they obviously do nothing, and they are hardly
used anymore anyway.

So, just remove the definitions of these macros.

[0] https://www.spinics.net/lists/linux-sparse/msg01150.html

Signed-off-by: Christoph Böhmwalder <[email protected]>
Reviewed-by: Joel Colledge <[email protected]>
---
drivers/block/drbd/drbd_int.h | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h
index ae713338aa46..edce1f7ac2da 100644
--- a/drivers/block/drbd/drbd_int.h
+++ b/drivers/block/drbd/drbd_int.h
@@ -39,16 +39,6 @@
#include "drbd_protocol.h"
#include "drbd_polymorph_printk.h"

-#ifdef __CHECKER__
-# define __protected_by(x) __attribute__((require_context(x,1,999,"rdwr")))
-# define __protected_read_by(x) __attribute__((require_context(x,1,999,"read")))
-# define __protected_write_by(x) __attribute__((require_context(x,1,999,"write")))
-#else
-# define __protected_by(x)
-# define __protected_read_by(x)
-# define __protected_write_by(x)
-#endif
-
/* shared module parameters, defined in drbd_main.c */
#ifdef CONFIG_DRBD_FAULT_INJECTION
extern int drbd_enable_faults;
@@ -774,7 +764,7 @@ struct drbd_device {
unsigned long flags;

/* configured by drbdsetup */
- struct drbd_backing_dev *ldev __protected_by(local);
+ struct drbd_backing_dev *ldev;

sector_t p_size; /* partner's disk size */
struct request_queue *rq_queue;
--
2.38.1

2023-01-13 21:09:59

by Jens Axboe

[permalink] [raw]
Subject: Re: [RESEND PATCH 0/8] Miscellaneous DRBD reorganization


On Fri, 13 Jan 2023 13:35:30 +0100, Christoph Böhmwalder wrote:
> Some more mostly trivial "alignment patches" to (slowly but surely)
> move further in the direction of re-upstreaming DRBD.
>
> These should be fairly uncontroversial.
>
> Andreas Gruenbacher (1):
> drbd: drbd_insert_interval(): Clarify comment
>
> [...]

Applied, thanks!

[1/8] drbd: adjust drbd_limits license header
commit: f4095e7643c0fd00f1c125388d6d83d60875d489
[2/8] drbd: fix DRBD_VOLUME_MAX 65535 -> 65534
commit: f7fb0227ae90fff4d09d969c353e8a30f2e0edcc
[3/8] drbd: make limits unsigned
commit: 4e5ebce4a5dde36316a78550c9f7b97a9e03302b
[4/8] drbd: remove unnecessary assignment in vli_encode_bits
commit: 93a8026b0d7161597437eb2d87ceac4f194991c4
[5/8] drbd: remove macros using require_context
commit: 00f0c8eccb383782621c74e5bd2ce9b4b8dbad5a
[6/8] MAINTAINERS: add drbd headers
commit: 463afd417b268d18d3c83ec0851e978dd12daaa2
[7/8] drbd: interval tree: make removing an "empty" interval a no-op
commit: 6928e2f7919aa3cd4e31aba5b16f6f212df2bb35
[8/8] drbd: drbd_insert_interval(): Clarify comment
commit: 2b0802d1ac9333d060312b22e9d898614253adcf

Best regards,
--
Jens Axboe