mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Christoph Böhmwalder" <christoph.boehmwalder@linbit.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: "Philipp Reisner" <philipp.reisner@linbit.com>,
	"Lars Ellenberg" <lars.ellenberg@linbit.com>,
	drbd-dev@lists.linux.dev, linux-block@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	"Christoph Böhmwalder" <christoph.boehmwalder@linbit.com>
Subject: [PATCH 3/4] drbd: resize: do not silently "truncate" the effective size
Date: Thu, 26 Nov 2026 15:52:56 +0100	[thread overview]
Message-ID: <20261126145257.592085-4-christoph.boehmwalder@linbit.com> (raw)
In-Reply-To: <20261126145257.592085-1-christoph.boehmwalder@linbit.com>

From: Lars Ellenberg <lars.ellenberg@linbit.com>

During the connection handshake, a node with an established "effective"
(aka last agreed to) size can detect that a peer has a "too small"
backing disk, and refuse to connect to that peer.

Unfortunately it still "caches" the maximum size that peer could
support. We remember that size so we could still grow to an agreeable
size on an unconnected node, if this node's backend size was the
limiting factor and the peer was known to be able to support more.

Now, if we remember a size we rejected because it was too small, that
same logic will silently truncate our own size if we are asked to
"resize" before that cached information is properly reset (by taking
DRBD down/up, or by connecting to a peer that has a backing device of
sufficient size).

Workaround: only ask DRBD to resize when the connection to the peer is
fully established.

Fix: reset that cached size to zero in the moment we refuse the
connection.

Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Signed-off-by: Christoph Böhmwalder <christoph.boehmwalder@linbit.com>
---
 drivers/block/drbd/drbd_receiver.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index 101192d8398f..9cc41bc07ae5 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -3931,6 +3931,11 @@ static int receive_sizes(struct drbd_connection *connection, struct packet_info
 		    (device->state.conn < C_CONNECTED || device->state.pdsk == D_DISKLESS)) {
 			drbd_err(device, "The peer's disk size is too small! (%llu < %llu sectors)\n",
 					(unsigned long long)new_size, (unsigned long long)cur_size);
+			/* We rejected that size, reset to zero so it won't
+			 * confuse the aggregation with min_not_zero() if
+			 * someone requests a resize later.
+			 */
+			device->p_size = 0;
 			conn_request_state(peer_device->connection, NS(conn, C_DISCONNECTING), CS_HARD);
 			put_ldev(device);
 			return -EIO;
-- 
2.56.0


  parent reply	other threads:[~2026-11-26 14:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26 14:52 [PATCH 0/4] drbd: assorted fixes for discard limits, bitmap IO and resize Christoph Böhmwalder
2026-11-26 14:52 ` [PATCH 1/4] drbd: assume a capable peer for the discard limit before the handshake Christoph Böhmwalder
2026-11-26 14:52 ` [PATCH 2/4] drbd: fix lost bitmap-work wakeup on weakly ordered CPUs Christoph Böhmwalder
2026-11-26 14:52 ` Christoph Böhmwalder [this message]
2026-11-26 14:52 ` [PATCH 4/4] drbd: refuse to shrink on resize unless an explicit size is requested Christoph Böhmwalder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261126145257.592085-4-christoph.boehmwalder@linbit.com \
    --to=christoph.boehmwalder@linbit.com \
    --cc=axboe@kernel.dk \
    --cc=drbd-dev@lists.linux.dev \
    --cc=lars.ellenberg@linbit.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=philipp.reisner@linbit.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®