[lkml]   [2019]   [Jun]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
SubjectRe: [PATCH] drbd: fix discard_zeroes_if_aligned regression
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?

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);

Eric Wheeler

> --
> : 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
 \ /
  Last update: 2019-06-02 02:29    [W:0.056 / U:1.308 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site