From: Lars Ellenberg <lars.ellenberg@linbit.com>
To: drbd-dev@lists.linbit.com
Subject: Re: [Drbd-dev] [PATCH] drbdmeta: Fix drbdmeta to support old kernels
Date: Thu, 17 Aug 2017 11:59:25 +0200 [thread overview]
Message-ID: <20170817095925.GD3587@soda.linbit> (raw)
In-Reply-To: <a1c1b596-8259-a2cf-3b1b-6461761bbca4@activecloud.com>
On Thu, Aug 17, 2017 at 04:57:12AM +0300, Artem Pogartsev wrote:
> Hello,
>
> RedHat 6.9
> kernel-2.6.32-431.11.2
> drbd-utils-9.0.0
> drbd-8.4.10
>
> Problem:
>
> drbdmeta 0 v08 /dev/sda internal create-md
> initializing activity log
> initializing bitmap (30524 KB) to all zero
> ioctl(/dev/sda) failed: Invalid argument
Thanks for pointing this out.
I'm about to commit this instead:
drbdmeta compat: fixup fallback path for BLKZEROOUT for older kernels
Based on a suggestion on drbd-dev by
From: Artem Pogartsev <artem.pogartsev@activecloud.com>
Date: Thu, 17 Aug 2017 04:57:12 +0300
To: drbd-dev@lists.linbit.com
Subject: [PATCH] drbdmeta: Fix drbdmeta to support old kernels
Message-ID: <a1c1b596-8259-a2cf-3b1b-6461761bbca4@activecloud.com>
Though I chose to always execute the fallback code
if the ioctl BLKZEROOUT fails, regardless of errno.
As a side note,
just because the define BLKZEROOUT is not in the (userland) headers
(yet) does not necessarily mean the kernel does not know it.
diff --git a/user/shared/drbdmeta.c b/user/shared/drbdmeta.c
index 6ff877a..86f32ed 100644
--- a/user/shared/drbdmeta.c
+++ b/user/shared/drbdmeta.c
@@ -60,7 +60,12 @@
#include "config.h"
-/* BLKZEROOUT, available on linux-3.6 and later. */
+/* BLKZEROOUT, available on linux-3.6 and later,
+ * and maybe backported to distribution kernels,
+ * even if they pretend to be older.
+ * Yes, we encountered a number of systems that already had it in their
+ * kernels, but not yet in the headers used to build userland stuff like this.
+ */
#ifndef BLKZEROOUT
# define BLKZEROOUT _IO(0x12,127)
#endif
@@ -1716,7 +1721,11 @@ static void zeroout_bitmap(struct format *cfg)
if (!err)
return;
- if (errno == ENOTTY) {
+ PERROR("ioctl(%s, BLKZEROOUT, [%llu, %llu]) failed", cfg->md_device_name,
+ (unsigned long long)range[0], (unsigned long long)range[1]);
+ fprintf(stderr, "Using slow(er) fallback.\n");
+
+ {
/* need to sector-align this for O_DIRECT.
* "sector" here means hard-sect size, which may be != 512.
* Note that even though ALIGN does round up, for sector sizes
@@ -1744,9 +1753,6 @@ static void zeroout_bitmap(struct format *cfg)
}
}
fprintf(stderr,"\r100%%\n");
- } else {
- PERROR("ioctl(%s) failed", cfg->md_device_name);
- exit(10);
}
}
prev parent reply other threads:[~2017-08-17 9:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-17 1:57 [Drbd-dev] [PATCH] drbdmeta: Fix drbdmeta to support old kernels Artem Pogartsev
2017-08-17 9:59 ` Lars Ellenberg [this message]
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=20170817095925.GD3587@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.