From: Lars Ellenberg <lars.ellenberg@linbit.com>
To: drbd-dev@lists.linbit.com
Subject: Re: [Drbd-dev] [PATCH] drbd: fix discard_zeroes_if_aligned regression
Date: Mon, 3 Jun 2019 14:48:04 +0200 [thread overview]
Message-ID: <20190603124804.GI5803@soda.linbit> (raw)
In-Reply-To: <alpine.LRH.2.11.1906012121470.27699@mx.ewheeler.net>
On Sun, Jun 02, 2019 at 12:28:31AM +0000, Eric Wheeler wrote:
> On Tue, 28 May 2019, Lars Ellenberg wrote:
>
> > On Fri, May 10, 2019 at 05:36:32PM +0000, Eric Wheeler wrote:
> > > Hi Lars,
> > >
> > > We just tried 4.19.x and this bugs still exists. We applied the patch
> > > which was originally submitted to this thread and it still applies cleanly
> > > and seems to work for our use case. You mentioned that you had some older
> > > code which zeroed out unaligned discard requests (or perhaps it was for a
> > > different purpose) that you may be able to use to patch this. Could you
> > > dig those up and see if we can get this solved?
> > >
> > > It would be nice to be able to use drbd with thin backing volumes from the
> > > vanilla kernel. If this has already been fixed in something newer than
> > > 4.19, then please point me to the commit.
> >
> > I think it was merged upstream in 5.0
> > f31e583aa2c2 drbd: introduce P_ZEROES (REQ_OP_WRITE_ZEROES on the "wire")
>
> Thanks Lars, I appreciate your patch.
>
> Your unaligned zerout code in drbd_issue_discard_or_zero_out() looks
> great. I particulary like how you adjusted max_discard_sectors to the
> granularity, as well as alignment handling. Well thought out.
>
> Your commit notes that "for backward compatibility, P_TRIM means zero-out,
> unless the DRBD_FF_WZEROES feature flag is agreed upon during handshake."
>
> We test our environment by deploying the newer kernel on one of the DRBD
> servers and checking for regressions---but this will cause a zero-out on
> the new server because the old server doesn't yet support DRBD_FF_WZEROES.
>
> For our purpose, can you think of any reason that it would be unsafe to
> hack the following into drbd_do_features() so the newer version will not
> zero-out while we test and get both nodes up to the newer version?
If you "fake" agreed_features to include DRBD_FF_WZEROES,
that may start to send the P_ZEROES command,
which the older peer does not understand yet,
triggering a protocol error and disconnect...
You can always use a newer DRBD module with the older kernel,
until you are prepared to upgrade the kernel...
But you knew that.
> diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
> index c7ad88d..76191e6 100644
> --- a/drivers/block/drbd/drbd_receiver.c
> +++ b/drivers/block/drbd/drbd_receiver.c
> @@ -5382,6 +5382,8 @@ static int drbd_do_features(struct drbd_connection *connection)
> connection->agreed_pro_version = min_t(int, PRO_VERSION_MAX, p->protocol_max);
> connection->agreed_features = PRO_FEATURES & be32_to_cpu(p->feature_flags);
>
> + connection->agreed_features |= DRBD_FF_WZEROES;
> +
> drbd_info(connection, "Handshake successful: "
> "Agreed network protocol version %d\n", connection->agreed_pro_version);
--
: Lars Ellenberg
: LINBIT | Keeping the Digital World Running
: DRBD -- Heartbeat -- Corosync -- Pacemaker
: R&D, Integration, Ops, Consulting, Support
DRBD® and LINBIT® are registered trademarks of LINBIT
next prev parent reply other threads:[~2019-06-03 12:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <15124635.GA4107@soda.linbit>
2018-01-15 23:00 ` [Drbd-dev] [PATCH] drbd: fix discard_zeroes_if_aligned regression Eric Wheeler
2018-01-16 7:26 ` Christoph Hellwig
2018-01-16 9:49 ` Lars Ellenberg
2019-05-10 17:36 ` Eric Wheeler
2019-05-28 13:18 ` Lars Ellenberg
2019-06-02 0:28 ` Eric Wheeler
2019-06-03 12:48 ` Lars Ellenberg [this message]
2019-06-06 19:50 ` Eric Wheeler
2018-01-17 0:43 ` Eric Wheeler
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=20190603124804.GI5803@soda.linbit \
--to=lars.ellenberg@linbit.com \
--cc=drbd-dev@lists.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