Changes to 'io_timeout'
by David Teigland
New branch 'io_timeout' available with the following commits:
commit fb27972a91554cd3da79e7e7f5c06c5e79ce449a
Author: Federico Simoncelli <fsimonce(a)redhat.com>
Date: Fri Aug 3 12:55:17 2012 -0400
python: support sanlock_add_lockspace_timeout
Signed-off-by: Federico Simoncelli <fsimonce(a)redhat.com>
commit ca085e6787c030151607c5dbfe7c2eb1d810cf2a
Author: David Teigland <teigland(a)redhat.com>
Date: Tue Jul 31 13:41:28 2012 -0500
daemon: extend grace time
Increase the default grace time for a killpath instance
from 30 to 40 seconds based on a corrected analysis of
the recovery sequence. The period during which the
watchdog may fire is determined by the wdmd check
interval (10 seconds), not the sanlock renewal interval.
Signed-off-by: David Teigland <teigland(a)redhat.com>
commit f904a84eb6888efab385758792026dcf1e8a227f
Author: David Teigland <teigland(a)redhat.com>
Date: Mon Jul 23 08:58:57 2012 -0500
sanlock: adjustable io timeouts
New sanlock_add_lockspace_timeout() api to allow
the timeout to be specified per lockspace.
Also correctly handle nodes that may be using
different timeouts in the same lockspace.
Signed-off-by: David Teigland <teigland(a)redhat.com>
commit 3fa28081fed8f33313f0d4287b37fd217cf87c8a
Author: David Teigland <teigland(a)redhat.com>
Date: Thu Jul 26 15:35:02 2012 -0500
daemon: log kill pid messages
Put messages in syslog when pids are being killed
for a failed lockspace, and when all pids have been
cleared from a failed lockspace.
Signed-off-by: David Teigland <teigland(a)redhat.com>
11 years, 8 months
2 commits - src/main.c wdmd/main.c
by David Teigland
src/main.c | 1 -
wdmd/main.c | 47 ++++++++++++++++++++++++++++++++++++++++++++---
2 files changed, 44 insertions(+), 4 deletions(-)
New commits:
commit 9b13cb12973fac422423eec1c6a91f21b5257c92
Author: David Teigland <teigland(a)redhat.com>
Date: Fri Aug 3 14:24:07 2012 -0500
sanlock: remove umask 0
Remove umask(0) which causes sanlock.log to have mode 666.
It's 644 without the umask.
Signed-off-by: David Teigland <teigland(a)redhat.com>
diff --git a/src/main.c b/src/main.c
index 8e39855..247b3f4 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1528,7 +1528,6 @@ static int do_daemon(void)
log_tool("cannot fork daemon\n");
exit(EXIT_FAILURE);
}
- umask(0);
}
setup_helper();
commit 089b8cd2264a31091fcc465840ba860355abaaf2
Author: David Teigland <teigland(a)redhat.com>
Date: Fri Aug 3 14:05:22 2012 -0500
wdmd: use shm_open to prevent restart
We need to prevent restart after an unclean shutdown
and no machine reset. Otherwise re-opening /dev/watchdog
will give new life to the machine when it's supposed to
be resetting.
Signed-off-by: David Teigland <teigland(a)redhat.com>
diff --git a/wdmd/main.c b/wdmd/main.c
index f053de4..17687be 100644
--- a/wdmd/main.c
+++ b/wdmd/main.c
@@ -59,6 +59,7 @@ static int socket_gid;
static time_t last_keepalive;
static char lockfile_path[PATH_MAX];
static int dev_fd;
+static int shm_fd;
struct script_status {
int pid;
@@ -738,6 +739,41 @@ static int setup_signals(void)
return 0;
}
+/*
+ * We're trying to detect whether the last wdmd exited uncleanly and the
+ * system has not been reset since. In that case we don't want to start
+ * and open /dev/watchdog, because that will ping the wd which will extend
+ * the pending reset, which needs to happen on schedule.
+ *
+ * To detect this, we want to do/set something on the system that will
+ * not go away (be cleared) if we exit, but will go away if the system
+ * is reset. If we were certain there was a tmpfs file system we could
+ * use, then we could create a file there and just refuse to start if
+ * the file exists.
+ *
+ * Until we are certain of tmpfs somewhere, create a shared mem object
+ * on the system.
+ */
+
+static int setup_shm(void)
+{
+ int rv;
+
+ rv = shm_open("/wdmd", O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
+ if (rv < 0) {
+ log_error("other wdmd not cleanly stopped, shm_open error %d", errno);
+ return rv;
+ }
+ shm_fd = rv;
+ return 0;
+}
+
+static void close_shm(void)
+{
+ shm_unlink("/wdmd");
+ close(shm_fd);
+}
+
static int test_loop(void)
{
void (*workfn) (int ci);
@@ -980,7 +1016,6 @@ int main(int argc, char *argv[])
fprintf(stderr, "cannot fork daemon\n");
exit(EXIT_FAILURE);
}
- umask(0);
}
openlog("wdmd", LOG_CONS | LOG_PID, LOG_DAEMON);
@@ -989,16 +1024,20 @@ int main(int argc, char *argv[])
scripts_built ? scripts_built : "",
client_built ? client_built : "",
files_built ? files_built : "");
-
+
setup_priority();
rv = lockfile();
if (rv < 0)
goto out;
- rv = setup_signals();
+ rv = setup_shm();
if (rv < 0)
goto out_lockfile;
+
+ rv = setup_signals();
+ if (rv < 0)
+ goto out_shm;
rv = setup_scripts();
if (rv < 0)
@@ -1025,6 +1064,8 @@ int main(int argc, char *argv[])
close_files();
out_scripts:
close_scripts();
+ out_shm:
+ close_shm();
out_lockfile:
unlink(lockfile_path);
out:
11 years, 8 months
[PATCH] python: support sanlock_add_lockspace_timeout
by Federico Simoncelli
Signed-off-by: Federico Simoncelli <fsimonce(a)redhat.com>
---
python/sanlock.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/python/sanlock.c b/python/sanlock.c
index bef236e..cefe3d4 100644
--- a/python/sanlock.c
+++ b/python/sanlock.c
@@ -267,26 +267,30 @@ exit_fail:
/* add_lockspace */
PyDoc_STRVAR(pydoc_add_lockspace, "\
-add_lockspace(lockspace, host_id, path, offset=0, async=False)\n\
+add_lockspace(lockspace, host_id, path, offset=0, iotimeout=0, async=False)\n\
Add a lockspace, acquiring a host_id in it. If async is True the function\n\
-will return immediatly and the status can be checked using inq_lockspace.");
+will return immediatly and the status can be checked using inq_lockspace.\n\
+The iotimeout option configures the io timeout for the specific lockspace,\n\
+overriding the default value (see the sanlock daemon parameter -o).");
static PyObject *
py_add_lockspace(PyObject *self __unused, PyObject *args, PyObject *keywds)
{
int rv, async = 0, flags = 0;
+ uint32_t iotimeout = 0;
const char *lockspace, *path;
struct sanlk_lockspace ls;
static char *kwlist[] = {"lockspace", "host_id", "path", "offset",
- "async", NULL};
+ "iotimeout", "async", NULL};
/* initialize lockspace structure */
memset(&ls, 0, sizeof(struct sanlk_lockspace));
/* parse python tuple */
if (!PyArg_ParseTupleAndKeywords(args, keywds, "sks|ki", kwlist,
- &lockspace, &ls.host_id, &path, &ls.host_id_disk.offset, &async)) {
+ &lockspace, &ls.host_id, &path, &ls.host_id_disk.offset, &iotimeout,
+ &async)) {
return NULL;
}
@@ -301,7 +305,7 @@ py_add_lockspace(PyObject *self __unused, PyObject *args, PyObject *keywds)
/* add sanlock lockspace (gil disabled) */
Py_BEGIN_ALLOW_THREADS
- rv = sanlock_add_lockspace(&ls, flags);
+ rv = sanlock_add_lockspace_timeout(&ls, flags, iotimeout);
Py_END_ALLOW_THREADS
if (rv != 0) {
--
1.7.1
11 years, 8 months
[selinux-policy][PATCH] Allow sanlock to use sys_resource and setrlimit
by Federico Simoncelli
In a recent change (git:789aca6) sanlock added two setrlimit calls.
Signed-off-by: Federico Simoncelli <fsimonce(a)redhat.com>
---
policy/modules/services/sanlock.te | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/policy/modules/services/sanlock.te b/policy/modules/services/sanlock.te
index e9c2efe..fdb1b82 100644
--- a/policy/modules/services/sanlock.te
+++ b/policy/modules/services/sanlock.te
@@ -44,8 +44,8 @@ ifdef(`enable_mls',`
#
# sanlock local policy
#
-allow sanlock_t self:capability { chown setgid dac_override ipc_lock sys_nice };
-allow sanlock_t self:process { setsched signull signal sigkill };
+allow sanlock_t self:capability { chown setgid dac_override ipc_lock sys_nice sys_resource };
+allow sanlock_t self:process { setsched signull signal sigkill setrlimit };
allow sanlock_t self:fifo_file rw_fifo_file_perms;
allow sanlock_t self:unix_stream_socket create_stream_socket_perms;
--
1.7.11.2
11 years, 8 months
Changes to 'io_timeout'
by David Teigland
New branch 'io_timeout' available with the following commits:
commit 87b7fb37b19847462b1f63678bdaf999c9265cb1
Author: David Teigland <teigland(a)redhat.com>
Date: Tue Jul 31 13:41:28 2012 -0500
daemon: extend grace time
Increase the default grace time for a killpath instance
from 30 to 40 seconds based on a corrected analysis of
the recovery sequence. The period during which the
watchdog may fire is determined by the wdmd check
interval (10 seconds), not the sanlock renewal interval.
Signed-off-by: David Teigland <teigland(a)redhat.com>
commit 903f206797bb33506cce1992f3d2ef480c8d9326
Author: David Teigland <teigland(a)redhat.com>
Date: Mon Jul 23 08:58:57 2012 -0500
sanlock: adjustable io timeouts
New sanlock_add_lockspace_timeout() api to allow
the timeout to be specified per lockspace.
Also correctly handle nodes that may be using
different timeouts in the same lockspace.
Signed-off-by: David Teigland <teigland(a)redhat.com>
commit 4340314ff4150ebd0fef6b0ea80160e994f65a1c
Author: David Teigland <teigland(a)redhat.com>
Date: Thu Jul 26 15:35:02 2012 -0500
daemon: log kill pid messages
Put messages in syslog when pids are being killed
for a failed lockspace, and when all pids have been
cleared from a failed lockspace.
Signed-off-by: David Teigland <teigland(a)redhat.com>
11 years, 8 months
src/lockfile.c
by David Teigland
src/lockfile.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 1339694c3bad23055f896e90353c81fd65bd4a7e
Author: David Teigland <teigland(a)redhat.com>
Date: Thu Aug 2 11:27:54 2012 -0500
sanlock: use lockfile mode 644
Signed-off-by: David Teigland <teigland(a)redhat.com>
diff --git a/src/lockfile.c b/src/lockfile.c
index 129d956..e3b720c 100644
--- a/src/lockfile.c
+++ b/src/lockfile.c
@@ -54,7 +54,7 @@ int lockfile(const char *dir, const char *name, int uid, int gid)
snprintf(path, PATH_MAX, "%s/%s", dir, name);
- fd = open(path, O_CREAT|O_WRONLY|O_CLOEXEC, 0666);
+ fd = open(path, O_CREAT|O_WRONLY|O_CLOEXEC, 0644);
if (fd < 0) {
log_error("lockfile open error %s: %s",
path, strerror(errno));
11 years, 8 months