The Samba-Bugzilla – Attachment 12332 Details for
Bug 12113
ctdb_mutex_fcntl_helper can wait forever when reparented to init
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for 4.5rc
BZ12113.patch (text/plain), 2.09 KB, created by
Martin Schwenke
on 2016-08-09 03:20:54 UTC
(
hide
)
Description:
Patch for 4.5rc
Filename:
MIME Type:
Creator:
Martin Schwenke
Created:
2016-08-09 03:20:54 UTC
Size:
2.09 KB
patch
obsolete
>From dee80360fd287a2a4dbe484023600eca47710898 Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Fri, 5 Aug 2016 14:17:01 +1000 >Subject: [PATCH] ctdb-mutex: Avoid corner case where helper is already > reparented to init > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=12113 > >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@gmail.com> >(cherry picked from commit 1f942ec36c98127e25d7aa9b8370a4f621b9d362) >--- > ctdb/doc/cluster_mutex_helper.txt | 3 ++- > ctdb/server/ctdb_mutex_fcntl_helper.c | 13 +++++++++++++ > 2 files changed, 15 insertions(+), 1 deletion(-) > >diff --git a/ctdb/doc/cluster_mutex_helper.txt b/ctdb/doc/cluster_mutex_helper.txt >index 0fc3a50..20c8eb2 100644 >--- a/ctdb/doc/cluster_mutex_helper.txt >+++ b/ctdb/doc/cluster_mutex_helper.txt >@@ -64,7 +64,8 @@ Valid status codes are: > If a 0 status code is sent then it the helper should periodically > check if the (original) parent processes still exists while awaiting > termination. If the parent process disappears then the helper should >-release the mutex and exit. This avoids stale mutexes. >+release the mutex and exit. This avoids stale mutexes. Note that a >+helper should never wait for parent process ID 1! > > If a non-0 status code is sent then the helper can exit immediately. > However, if the helper does not exit then it must terminate if it >diff --git a/ctdb/server/ctdb_mutex_fcntl_helper.c b/ctdb/server/ctdb_mutex_fcntl_helper.c >index 06c2205..87358be 100644 >--- a/ctdb/server/ctdb_mutex_fcntl_helper.c >+++ b/ctdb/server/ctdb_mutex_fcntl_helper.c >@@ -82,6 +82,19 @@ int main(int argc, char *argv[]) > } > > ppid = getppid(); >+ >+ if (ppid == 1) { >+ /* The original parent is gone and the process has >+ * been reparented to init. This can happen if the >+ * helper is started just as the parent is killed >+ * during shutdown. The error message doesn't need to >+ * be stellar, since there won't be anything around to >+ * capture and log it... >+ */ >+ fprintf(stderr, "%s: PPID == 1\n", progname); >+ exit(1); >+ } >+ > file = argv[1]; > > result = fcntl_lock(file, &fd); >-- >2.8.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
amitay
:
review+
Actions:
View
Attachments on
bug 12113
: 12332