From: Dan Williams <dan.j.williams@intel.com>
To: Neil Brown <neilb@suse.de>
Cc: "Neubauer, Wojciech" <Wojciech.Neubauer@intel.com>,
Doug Ledford <dledford@redhat.com>,
"Ciechanowski, Ed" <ed.ciechanowski@intel.com>,
"Hawrylewicz Czarnowski,
Przemyslaw" <przemyslaw.hawrylewicz.czarnowski@intel.com>,
"Labun, Marcin" <Marcin.Labun@intel.com>,
linux-raid <linux-raid@vger.kernel.org>,
"Jiang, Dave" <dave.jiang@intel.com>
Subject: fixes for 3.1.3 (was: Re: [mdadm GIT PULL] rebuild checkpoints...)
Date: Tue, 06 Jul 2010 12:51:49 -0700 [thread overview]
Message-ID: <1278445909.3949.11.camel@dwillia2-linux> (raw)
In-Reply-To: <20100706145043.107f7f76@notabene.brown>
On Mon, 2010-07-05 at 21:50 -0700, Neil Brown wrote:
> I'm fairly seriously considering cutting a 3.1.3 shortly (Thursday?) so that
> I have a clean slate to build the policy frame work and aim it for 3.2.0.
>
> If you have anything that you would like to see included in (or addressed
> for) 3.1.3, please let me know.
>
The pthread_create() vs clone(2) issue is still being discussed, but in
the meantime using pthreads seems the safe thing to do. So, here is
that implementation and another trivial build-warning fixup.
The following changes since commit 1538aca5cbbd99be47657e0ca0b7e2186426a1b1:
NeilBrown (1):
Merge branch 'master' of git://github.com/djbw/mdadm
are available in the git repository at:
git://github.com/djbw/mdadm.git master
Dan Williams (2):
mdmon: satisfy glibc tls abi requirements with pthreads
imsm: fix a -O2 build warning
Makefile | 14 +++++++++++---
mdmon.c | 42 +++++++++++++++++++++++++++++++++++++++---
super-intel.c | 4 ++--
3 files changed, 52 insertions(+), 8 deletions(-)
commit f4190c2f12527e37304f7c185afa0449fa9dee1c
Author: Dan Williams <dan.j.williams@intel.com>
Date: Tue Jul 6 12:48:56 2010 -0700
mdmon: satisfy glibc tls abi requirements with pthreads
Setting up a proper tls descriptor is required to conform to the abi
[1]. Until it can be implemented in mdmon use pthreads instead of
clone(2) to let glibc handle the details. The old behaviour can be had
by un-defining USE_PTHREADS.
Note, the "O2" builds need LDFLAGS now to pick up the '-pthread' option.
[1]: http://people.redhat.com/drepper/tls.pdf
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
diff --git a/Makefile b/Makefile
index 237f4fc..0f42f88 100644
--- a/Makefile
+++ b/Makefile
@@ -75,6 +75,14 @@ ALTFLAGS = -DALT_RUN=\"$(ALT_RUN)\" -DALT_MAPFILE=\"$(ALT_MAPFILE)\"
VARFLAGS = -DVAR_RUN=\"$(VAR_RUN)\"
CFLAGS = $(CWFLAGS) $(CXFLAGS) -DSendmail=\""$(MAILCMD)"\" $(CONFFILEFLAGS) $(ALTFLAGS) $(VARFLAGS)
+# The glibc TLS ABI requires applications that call clone(2) to set up
+# TLS data structures, use pthreads until mdmon implements this support
+USE_PTHREADS = 1
+ifdef USE_PTHREADS
+CFLAGS += -DUSE_PTHREADS
+LDFLAGS += -pthread
+endif
+
# If you want a static binary, you might uncomment these
# LDFLAGS = -static
# STRIP = -s
@@ -149,13 +157,13 @@ mdadm.klibc : $(SRCS) mdadm.h
$(CC) -nostdinc -iwithprefix include -I$(KLIBC)/klibc/include -I$(KLIBC)/linux/include -I$(KLIBC)/klibc/arch/i386/include -I$(KLIBC)/klibc/include/bits32 $(CFLAGS) $(SRCS)
mdadm.Os : $(SRCS) mdadm.h
- $(CC) -o mdadm.Os $(CFLAGS) -DHAVE_STDINT_H -Os $(SRCS)
+ $(CC) -o mdadm.Os $(CFLAGS) $(LDFLAGS) -DHAVE_STDINT_H -Os $(SRCS)
mdadm.O2 : $(SRCS) mdadm.h mdmon.O2
- $(CC) -o mdadm.O2 $(CFLAGS) -DHAVE_STDINT_H -O2 -D_FORTIFY_SOURCE=2 $(SRCS)
+ $(CC) -o mdadm.O2 $(CFLAGS) $(LDFLAGS) -DHAVE_STDINT_H -O2 -D_FORTIFY_SOURCE=2 $(SRCS)
mdmon.O2 : $(MON_SRCS) mdadm.h mdmon.h
- $(CC) -o mdmon.O2 $(CFLAGS) -DHAVE_STDINT_H -O2 -D_FORTIFY_SOURCE=2 $(MON_SRCS)
+ $(CC) -o mdmon.O2 $(CFLAGS) $(LDFLAGS) -DHAVE_STDINT_H -O2 -D_FORTIFY_SOURCE=2 $(MON_SRCS)
# use '-z now' to guarantee no dynamic linker interactions with the monitor thread
mdmon : $(MON_OBJS)
diff --git a/mdmon.c b/mdmon.c
index 0c37426..c4c0181 100644
--- a/mdmon.c
+++ b/mdmon.c
@@ -58,8 +58,11 @@
#include <fcntl.h>
#include <signal.h>
#include <dirent.h>
-
+#ifdef USE_PTHREADS
+#include <pthread.h>
+#else
#include <sched.h>
+#endif
#include "mdadm.h"
#include "mdmon.h"
@@ -71,7 +74,39 @@ int mon_tid, mgr_tid;
int sigterm;
-int run_child(void *v)
+#ifdef USE_PTHREADS
+static void *run_child(void *v)
+{
+ struct supertype *c = v;
+
+ mon_tid = syscall(SYS_gettid);
+ do_monitor(c);
+ return 0;
+}
+
+static int clone_monitor(struct supertype *container)
+{
+ pthread_attr_t attr;
+ pthread_t thread;
+ int rc;
+
+ mon_tid = -1;
+ pthread_attr_init(&attr);
+ pthread_attr_setstacksize(&attr, 4096);
+ pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+ rc = pthread_create(&thread, &attr, run_child, container);
+ if (rc)
+ return rc;
+ while (mon_tid == -1)
+ usleep(10);
+ pthread_attr_destroy(&attr);
+
+ mgr_tid = syscall(SYS_gettid);
+
+ return mon_tid;
+}
+#else /* USE_PTHREADS */
+static int run_child(void *v)
{
struct supertype *c = v;
@@ -85,7 +120,7 @@ int __clone2(int (*fn)(void *),
int flags, void *arg, ...
/* pid_t *pid, struct user_desc *tls, pid_t *ctid */ );
#endif
- int clone_monitor(struct supertype *container)
+static int clone_monitor(struct supertype *container)
{
static char stack[4096];
@@ -103,6 +138,7 @@ int __clone2(int (*fn)(void *),
return mon_tid;
}
+#endif /* USE_PTHREADS */
static int make_pidfile(char *devname)
{
commit 569cc43ffb0634510defee91407d261555c7a991
Author: Dan Williams <dan.j.williams@intel.com>
Date: Tue Jul 6 12:48:59 2010 -0700
imsm: fix a -O2 build warning
super-intel.c: In function ‘imsm_add_spare’:
super-intel.c:4833: error: ‘array_start’ may be used uninitialized in this function
super-intel.c:4834: error: ‘array_end’ may be used uninitialized in this function
This is valid, if we don't find a spare candidate then array_{start,end}
will be uninitialized.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
diff --git a/super-intel.c b/super-intel.c
index daf811f..6826d9b 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -4830,8 +4830,8 @@ static struct dl *imsm_add_spare(struct intel_super *super, int slot,
struct extent *ex;
int i, j;
int found;
- __u32 array_start;
- __u32 array_end;
+ __u32 array_start = 0;
+ __u32 array_end = 0;
struct dl *dl;
for (dl = super->disks; dl; dl = dl->next) {
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2010-07-06 19:51 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-27 0:50 [mdadm GIT PULL] rebuild checkpoints, incremental assembly, volume delete/rename, and fixes Dan Williams
2010-05-31 1:37 ` Neil Brown
2010-06-11 6:42 ` Dan Williams
2010-06-16 6:33 ` Neil Brown
2010-07-02 0:56 ` Dan Williams
2010-07-06 4:50 ` Neil Brown
2010-07-06 19:51 ` Dan Williams [this message]
2010-07-21 18:04 ` fixes for 3.1.3 (was: Re: [mdadm GIT PULL] rebuild checkpoints...) Dan Williams
2010-07-22 7:47 ` Neil Brown
2010-07-06 21:43 ` [mdadm GIT PULL] rebuild checkpoints, incremental assembly, volume delete/rename, and fixes Doug Ledford
2010-07-06 22:17 ` Neil Brown
2010-07-07 14:03 ` Doug Ledford
2010-07-08 7:50 ` Neil Brown
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=1278445909.3949.11.camel@dwillia2-linux \
--to=dan.j.williams@intel.com \
--cc=Marcin.Labun@intel.com \
--cc=Wojciech.Neubauer@intel.com \
--cc=dave.jiang@intel.com \
--cc=dledford@redhat.com \
--cc=ed.ciechanowski@intel.com \
--cc=linux-raid@vger.kernel.org \
--cc=neilb@suse.de \
--cc=przemyslaw.hawrylewicz.czarnowski@intel.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.