From: Pete Zaitcev <zaitcev@redhat.com>
To: Jeff Garzik <jeff@garzik.org>
Cc: Project Hail List <hail-devel@vger.kernel.org>
Subject: [tabled patch 1/5] Fix crash when stopping slave
Date: Thu, 12 Aug 2010 13:21:57 -0600 [thread overview]
Message-ID: <20100812132157.66020fef@lembas.zaitcev.lan> (raw)
In-Reply-To: <20100812125517.4edd31db@lembas.zaitcev.lan>
When a slave is shut down, it crashes, because we cannot call tdb_down
without tdb_up, and that obviously only happens on a master.
Also, plug a problem inside rtdb_fini (needs a better fix but
should do for now).
Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
---
server/metarep.c | 9 ++++++++-
server/server.c | 11 +++--------
2 files changed, 11 insertions(+), 9 deletions(-)
commit dd6ed2529efa71902f7ac1958f01a2541b4f9133
Author: Pete Zaitcev <zaitcev@yahoo.com>
Date: Thu Aug 12 12:27:48 2010 -0600
Crash on tdb_down if slave.
diff --git a/server/metarep.c b/server/metarep.c
index d3eec49..e13b13f 100644
--- a/server/metarep.c
+++ b/server/metarep.c
@@ -1240,6 +1240,13 @@ int rtdb_restart(struct tablerep *rtdb, bool we_are_master)
void rtdb_fini(struct tablerep *rtdb)
{
__rtdb_fini(rtdb);
- tdb_fini(&rtdb->tdb);
+ /*
+ * This check is ewwww, but unfortunately there's potentially a gap
+ * between DB going master and us bringing up the environment.
+ * If we condition the tdb_fini on DB status, we'll end crashing
+ * if the server terminates during the gap.
+ */
+ if (rtdb->tdb.env)
+ tdb_fini(&rtdb->tdb);
}
diff --git a/server/server.c b/server/server.c
index 8859847..1f8164b 100644
--- a/server/server.c
+++ b/server/server.c
@@ -2326,18 +2326,13 @@ int main (int argc, char *argv[])
applog(LOG_INFO, "shutting down");
rc = 0;
-
+ if (tabled_srv.state_tdb == ST_TDB_MASTER)
+ tdb_down(&tdbrep.tdb);
cld_end();
err_cld_session:
/* net_close(); */
err_out_net:
- if (tabled_srv.state_tdb == ST_TDB_MASTER ||
- tabled_srv.state_tdb == ST_TDB_SLAVE) {
- tdb_down(&tdbrep.tdb);
- rtdb_fini(&tdbrep);
- } else if (tabled_srv.state_tdb == ST_TDB_OPEN) {
- rtdb_fini(&tdbrep);
- }
+ rtdb_fini(&tdbrep);
err_rtdb:
event_del(&tabled_srv.pevt);
err_pevt:
next parent reply other threads:[~2010-08-12 19:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20100812125517.4edd31db@lembas.zaitcev.lan>
2010-08-12 19:21 ` Pete Zaitcev [this message]
2010-08-12 19:22 ` [tabled patch 2/5] Clean name vs host Pete Zaitcev
2010-08-12 19:22 ` [tabled patch 3/5] cleanup a call to closelog() Pete Zaitcev
2010-08-12 19:22 ` [tabled patch 4/5] Support "auto" replicaton port Pete Zaitcev
2010-08-13 20:21 ` Jeff Garzik
2010-08-12 19:22 ` [tabled patch 5/5] Metadata replication test Pete Zaitcev
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=20100812132157.66020fef@lembas.zaitcev.lan \
--to=zaitcev@redhat.com \
--cc=hail-devel@vger.kernel.org \
--cc=jeff@garzik.org \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).