Accepting request 479852 from network:ha-clustering:Factory

OBS-URL: https://build.opensuse.org/request/show/479852
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/ocfs2-tools?expand=0&rev=65
This commit is contained in:
Dominique Leuenberger 2017-03-17 14:06:53 +00:00 committed by Git OBS Bridge
commit 900cead773
6 changed files with 31 additions and 332 deletions

View File

@ -1,13 +0,0 @@
Index: ocfs2-tools/ocfs2_controld/main.c
===================================================================
--- ocfs2-tools.orig/ocfs2_controld/main.c
+++ ocfs2-tools/ocfs2_controld/main.c
@@ -1233,7 +1233,7 @@ static void set_scheduler(void)
struct sched_param sched_param;
int rv;
- rv = sched_get_priority_max(SCHED_RR);
+ rv = sched_get_priority_min(SCHED_RR);
if (rv != -1) {
sched_param.sched_priority = rv;
rv = sched_setscheduler(0, SCHED_RR, &sched_param);

View File

@ -1,84 +0,0 @@
Index: ocfs2-tools/ocfs2_controld/main.c
===================================================================
--- ocfs2-tools.orig/ocfs2_controld/main.c
+++ ocfs2-tools/ocfs2_controld/main.c
@@ -948,6 +948,68 @@ static void cpg_joined(int first)
}
}
+static int find_minors(void)
+{
+ FILE *fl;
+ char name[256];
+ uint32_t number;
+ int c;
+ int control_minor = 0;
+
+ if (!(fl = fopen("/proc/misc", "r"))) {
+ log_error("failed to open /proc/misc: %s", strerror(errno));
+ goto out;
+ }
+
+ while (!feof(fl)) {
+ if (fscanf(fl, "%d %255s\n", &number, &name[0]) == 2) {
+ if (!strcmp(name, "ocfs2_control"))
+ control_minor = number;
+ } else do {
+ c = fgetc(fl);
+ } while (c != EOF && c != '\n');
+
+ if (control_minor)
+ break;
+ }
+ fclose(fl);
+
+ if (!control_minor)
+ log_error("Is ocfs2 missing from kernel? No misc devices found");
+out:
+ return control_minor;
+}
+
+static int find_udev_device(const char *path, uint32_t minor)
+{
+ struct stat st;
+ int i;
+
+ for (i = 0; i < 10; i++) {
+ if (stat(path, &st) == 0 && minor(st.st_rdev) == minor)
+ return 0;
+ sleep(1);
+ }
+
+ log_error("cannot find device %s with minor %d", path, minor);
+ return -1;
+}
+
+static int setup_misc_device(void)
+{
+ int rv = -1;
+ int control_minor = find_minors();
+
+ if (control_minor) {
+ rv = find_udev_device("/dev/misc/ocfs2_control", control_minor);
+ if (rv < 0)
+ return rv;
+ log_debug("found /dev/misc/ocfs2_control %u", control_minor);
+ }
+
+ return rv;
+}
+
static int loop(void)
{
int rv, i, poll_timeout = -1;
@@ -968,6 +1030,10 @@ static int loop(void)
if (rv < 0)
goto out;
+ rv = setup_misc_device();
+ if (rv < 0)
+ goto out;
+
rv = setup_cpg(cpg_joined);
if (rv < 0)
goto out;

View File

@ -1,187 +0,0 @@
---
ocfs2_controld/ckpt.c | 2 -
ocfs2_controld/main.c | 53 ++++++++++++++++++++++++++++++++++------
ocfs2_controld/mount.c | 2 +
ocfs2_controld/ocfs2_controld.h | 1
ocfs2_controld/pacemaker.c | 2 -
5 files changed, 51 insertions(+), 9 deletions(-)
Index: ocfs2-tools/ocfs2_controld/ckpt.c
===================================================================
--- ocfs2-tools.orig/ocfs2_controld/ckpt.c 2012-08-24 10:02:19.000000000 -0500
+++ ocfs2-tools/ocfs2_controld/ckpt.c 2012-08-24 10:14:42.000000000 -0500
@@ -413,7 +413,7 @@ static int call_section_read(struct ckpt
/* -ENOENT is a clean error for the caller to handle */
if (rc == -ENOENT) {
- log_debug("Checkpoint \"%.*s\" does not have a "
+ log_error("Checkpoint \"%.*s\" does not have a "
"section named \"%s\"",
handle->ch_name.length,
handle->ch_name.value, name);
Index: ocfs2-tools/ocfs2_controld/main.c
===================================================================
--- ocfs2-tools.orig/ocfs2_controld/main.c 2012-08-24 10:02:19.000000000 -0500
+++ ocfs2-tools/ocfs2_controld/main.c 2012-08-24 10:14:42.000000000 -0500
@@ -74,7 +74,7 @@ static int time_to_die = 0;
static int sigpipe_write_fd;
char *prog_name;
-int daemon_debug_opt;
+int daemon_debug_opt = 0;
char daemon_debug_buf[1024];
char dump_buf[DUMP_SIZE];
int dump_point;
@@ -1030,8 +1030,7 @@ static void lockfile(void)
fd = open(LOCKFILE_NAME, O_CREAT|O_WRONLY,
S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
if (fd < 0) {
- fprintf(stderr, "cannot open/create lock file %s\n",
- LOCKFILE_NAME);
+ log_error("cannot open/create lock file %s", LOCKFILE_NAME);
exit(EXIT_FAILURE);
}
@@ -1042,13 +1041,13 @@ static void lockfile(void)
error = fcntl(fd, F_SETLK, &lock);
if (error) {
- fprintf(stderr, "ocfs2_controld is already running\n");
+ log_error("ocfs2_controld is already running");
exit(EXIT_FAILURE);
}
error = ftruncate(fd, 0);
if (error) {
- fprintf(stderr, "cannot clear lock file %s\n", LOCKFILE_NAME);
+ log_error("cannot clear lock file %s", LOCKFILE_NAME);
exit(EXIT_FAILURE);
}
@@ -1056,7 +1055,7 @@ static void lockfile(void)
error = write(fd, buf, strlen(buf));
if (error <= 0) {
- fprintf(stderr, "cannot write lock file %s\n", LOCKFILE_NAME);
+ log_error("cannot write lock file %s", LOCKFILE_NAME);
exit(EXIT_FAILURE);
}
}
@@ -1066,13 +1065,13 @@ static void daemonize(void)
int fd;
pid_t pid = fork();
if (pid < 0) {
+ log_error("main: cannot fork");
perror("main: cannot fork");
exit(EXIT_FAILURE);
}
if (pid)
exit(EXIT_SUCCESS);
setsid();
- chdir("/");
umask(0);
close(0);
close(1);
@@ -1143,6 +1142,7 @@ static void decode_arguments(int argc, c
break;
default:
+ log_error("unknown option: %c\n", optchar);
fprintf(stderr, "unknown option: %c\n", optchar);
exit(EXIT_FAILURE);
break;
@@ -1180,12 +1180,53 @@ static void set_scheduler(void)
}
}
+#include <sys/time.h>
+#include <sys/resource.h>
+
+static int
+hack_enable_coredumps(void)
+{
+ int rc;
+ struct rlimit rlim;
+ int doenable = 1;
+
+ if ((rc = getrlimit(RLIMIT_CORE, &rlim)) < 0) {
+ int errsave = errno;
+ log_error("Cannot get current core limit value. %d", errsave);
+ errno = errsave;
+ return rc;
+ }
+ if (rlim.rlim_max == 0 && geteuid() == 0) {
+ rlim.rlim_max = RLIM_INFINITY;
+ }
+
+ rlim.rlim_cur = (doenable ? rlim.rlim_max : 0);
+
+ if (doenable && rlim.rlim_max == 0) {
+ log_error("Not possible to enable core dumps (rlim_max is 0)");
+ }
+
+ if ((rc = setrlimit(RLIMIT_CORE, &rlim)) < 0) {
+ int errsave = errno;
+ log_error("Unable to enable core dumps: %d", errsave);
+ errno = errsave;
+ return rc;
+ }
+ chdir("/var/lib/openais");
+ log_debug("Core dumps enabled: /var/lib/openais");
+ return 0;
+}
+
int main(int argc, char **argv)
{
errcode_t err;
prog_name = argv[0];
const char *stack = NULL;
+ decode_arguments(argc, argv);
+
+ hack_enable_coredumps();
+
init_mounts();
initialize_o2cb_error_table();
@@ -1201,13 +1242,11 @@ int main(int argc, char **argv)
return 1;
}
if (strcmp(stack, stackname)) {
- fprintf(stderr, "%s: This daemon supports the \"%s\" stack, but the \"%s\" stack is in use\n",
- prog_name, stackname, stack);
+ log_error("%s: This daemon supports the \"%s\" stack, but the \"%s\" stack is in use",
+ prog_name, stackname, stack);
return 1;
}
- decode_arguments(argc, argv);
-
if (!daemon_debug_opt)
daemonize();
Index: ocfs2-tools/ocfs2_controld/mount.c
===================================================================
--- ocfs2-tools.orig/ocfs2_controld/mount.c 2012-08-24 10:02:19.000000000 -0500
+++ ocfs2-tools/ocfs2_controld/mount.c 2012-08-24 10:14:42.000000000 -0500
@@ -176,6 +176,8 @@ static void notify_mount_client(struct m
else
mg->mg_mount_notified = 1;
+ log_debug("Notified client: %d", mg->mg_mount_notified);
+
/*
* XXX If we failed to notify the client, what can we do? I'm
* guessing that our main loop will get POLLHUP and we'll clean
Index: ocfs2-tools/ocfs2_controld/ocfs2_controld.h
===================================================================
--- ocfs2-tools.orig/ocfs2_controld/ocfs2_controld.h 2012-08-24 10:14:40.000000000 -0500
+++ ocfs2-tools/ocfs2_controld/ocfs2_controld.h 2012-08-24 10:14:42.000000000 -0500
@@ -60,6 +60,7 @@ do { \
#define log_error(fmt, args...) \
do { \
log_debug(fmt, ##args); \
+ fprintf(stderr, fmt "\n", ##args); \
syslog(LOG_ERR, fmt, ##args); \
} while (0)

View File

@ -1,28 +0,0 @@
---
ocfs2_controld/ocfs2_controld.h | 7 +++++++
1 file changed, 7 insertions(+)
Index: ocfs2_controld/ocfs2_controld.h
===================================================================
--- a/ocfs2_controld/ocfs2_controld.h.orig 2008-10-26 18:10:50.000000000 +0100
+++ b/ocfs2_controld/ocfs2_controld.h 2009-03-10 22:22:52.719197000 +0100
@@ -44,12 +44,19 @@ extern void daemon_dump_save(void);
#define log_debug(fmt, args...) \
do { \
+ syslog(LOG_DEBUG, fmt, ##args); \
snprintf(daemon_debug_buf, 1023, "%ld %s@%d: " fmt "\n", \
time(NULL), __FUNCTION__, __LINE__, ##args); \
if (daemon_debug_opt) fprintf(stderr, "%s", daemon_debug_buf); \
daemon_dump_save(); \
} while (0)
+#define log_info(fmt, args...) \
+do { \
+ log_debug(fmt, ##args); \
+ syslog(LOG_INFO, fmt, ##args); \
+} while (0)
+
#define log_error(fmt, args...) \
do { \
log_debug(fmt, ##args); \

View File

@ -2,6 +2,9 @@
Thu Mar 9 12:36:30 UTC 2017 - ghe@suse.com
- Update ocfs2-tools.tar.gz to upstream v1.8.5 (fate#322956)
- Unify the source files between openSUSE:Factory and SLE12SP3
+ 0004-mkfs.ocfs2-Abort-if-cluster-information-is-not-detec.patch
- bnc883550-Fix-mkfs.ocfs2-man-page-for-default-slots.patch
- Drop patches (merged upstream):
- 0001-libo2dlm-Close-file-description-after-use.patch
- 0002-debugfs.ocfs2-Fix-a-bug-in-process_open_args.patch
@ -10,13 +13,6 @@ Thu Mar 9 12:36:30 UTC 2017 - ghe@suse.com
- 0005-do-not-write-sysconfig-if-status-not-changed.patch
- 0006-o2cb-mount-debugfs-when-load-config.patch
- 0009-o2cb-fix-systemd-o2cb.service-failure.patch
- Add patches (from SLE12SP2):
+ force-debug.patch
+ extra-debug.patch
+ bug-805764-ocfs2-controld.patch
+ bnc804707-reduce-RR-priority.patch
+ 0004-mkfs.ocfs2-Abort-if-cluster-information-is-not-detec.patch
+ 0007-Improve-error-message-if-DLM-service-is-unavailable.patch
-------------------------------------------------------------------
Thu Apr 21 09:57:15 UTC 2016 - zren@suse.com
@ -86,6 +82,29 @@ Mon Feb 9 03:26:29 UTC 2015 - ghe@suse.com
- bnc804707-reduce-RR-priority.patch
- use-symlink-in-udev-rules.patch
-------------------------------------------------------------------
Fri Jun 20 17:54:28 UTC 2014 - rgoldwyn@suse.com
- Fix mkfs.ocfs2 man page to meniton number of slots are
dynamically determined based on filesystem size.
-------------------------------------------------------------------
Fri May 23 17:32:50 UTC 2014 - rgoldwyn@suse.com
- Corrected udev directory from /etc/udev/rules.d
-------------------------------------------------------------------
Fri May 23 16:44:54 UTC 2014 - rgoldwyn@suse.com
- Improve error message if DLM is not available (bnc#867329)
+ 0007-Improve-error-message-if-DLM-service-is-unavailable.patch
-------------------------------------------------------------------
Wed Mar 12 04:31:43 UTC 2014 - rgoldwyn@suse.com
- (bnc#867330) Fix group leave in patch:
0002-Remove-controld-dependency-in-group_join-leave.patch
-------------------------------------------------------------------
Tue Feb 11 16:57:54 UTC 2014 - rgoldwyn@suse.com

View File

@ -27,8 +27,6 @@ Source: ocfs2-tools-%{version}.tar.gz
Source1: o2cb.ocf
Source2: reflink.tar.bz2
Patch001: auto-setup-pcmk-stack-as-default-if-no-stack-is-setup.patch
Patch101: force-debug.patch
Patch102: extra-debug.patch
Patch103: debug-ocfs2_hb_ctl.patch
Patch105: bug-470741-debug_start_failures.patch
Patch106: ocfs2-devel.diff
@ -38,8 +36,6 @@ Patch202: fix-configure-check-libs.patch
Patch204: dont-use-var-lock-subsys.patch
Patch205: ocfs2-tools-kernel33.patch
Patch206: ocfs2-tools-resource.patch
Patch212: bug-805764-ocfs2-controld.patch
Patch213: bnc804707-reduce-RR-priority.patch
Patch225: 0004-mkfs.ocfs2-Abort-if-cluster-information-is-not-detec.patch
Patch228: 0007-Improve-error-message-if-DLM-service-is-unavailable.patch
Patch405: 0007-vendor-Add-vendor-files-for-sles12.patch
@ -140,8 +136,6 @@ OCFS2 filesystem.
%prep
%setup -q -a 2
%patch001 -p1
%patch101 -p1
%patch102 -p1
%patch103 -p1
%patch105 -p1
%patch106 -p1
@ -151,8 +145,6 @@ OCFS2 filesystem.
%patch204 -p1
%patch205 -p1
%patch206 -p1
%patch212 -p1
%patch213 -p1
%patch225 -p1
%patch228 -p1
%patch405 -p1
@ -175,9 +167,9 @@ cd ..
mkdir -p %{buildroot}/sbin
mkdir -p %{buildroot}%{_prefix}/bin
mkdir -p %{buildroot}%{_localstatedir}/adm/fillup-templates
mkdir -p %{buildroot}%{_sysconfdir}/udev/rules.d/
mkdir -p %{buildroot}%{_udevrulesdir}
mkdir -p %{buildroot}%{_prefix}/lib/ocf/resource.d/ocfs2
cp -f vendor/common/51-ocfs2.rules %{buildroot}%{_sysconfdir}/udev/rules.d
cp -f vendor/common/51-ocfs2.rules %{buildroot}%{_udevrulesdir}
cp -f $RPM_SOURCE_DIR/o2cb.ocf %{buildroot}%{_prefix}/lib/ocf/resource.d/ocfs2/o2cb
chmod a+x %{buildroot}%{_prefix}/lib/ocf/resource.d/ocfs2/o2cb
cp -f vendor/common/o2cb.sysconfig %{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.o2cb
@ -222,8 +214,8 @@ python -c "import compileall; compileall.compile_dir('%{buildroot}/%{py_sitedir}
%defattr(-,root,root)
%doc COPYING CREDITS MAINTAINERS
%doc documentation/users_guide.txt
%dir %{_sysconfdir}/udev
%dir %{_sysconfdir}/udev/rules.d
%dir /usr/lib/udev
%dir %{_udevrulesdir}
/sbin/fsck.ocfs2
/sbin/mkfs.ocfs2
/sbin/mounted.ocfs2
@ -236,7 +228,7 @@ python -c "import compileall; compileall.compile_dir('%{buildroot}/%{py_sitedir}
%{_sbindir}/o2hbmonitor
%{_bindir}/reflink
%{_bindir}/o2info
%config %{_sysconfdir}/udev/rules.d/51-ocfs2.rules
%{_udevrulesdir}/51-ocfs2.rules
%{_mandir}/man8/debugfs.ocfs2.8*
%{_mandir}/man8/fsck.ocfs2.8*
%{_mandir}/man8/fsck.ocfs2.checks.8*