Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package sanlock for openSUSE:Factory checked 
in at 2022-10-20 11:09:26
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/sanlock (Old)
 and      /work/SRC/openSUSE:Factory/.sanlock.new.2275 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "sanlock"

Thu Oct 20 11:09:26 2022 rev:29 rq:1029802 version:3.8.5

Changes:
--------
--- /work/SRC/openSUSE:Factory/sanlock/sanlock.changes  2021-12-02 
02:26:27.376357852 +0100
+++ /work/SRC/openSUSE:Factory/.sanlock.new.2275/sanlock.changes        
2022-10-20 11:09:27.747746282 +0200
@@ -1,0 +2,9 @@
+Tue Oct 18 14:27:20 UTC 2022 - James Fehlig <[email protected]>
+
+- Update to sanlock 3.8.5
+  - python: Replace distutils with setuptools
+  - sanlock: fix memory leak of lockspace renewal_history
+  - sanlock: fix pthread_create error check
+  - sanlock: use helper to set max_sectors_kb
+
+-------------------------------------------------------------------

Old:
----
  sanlock-3.8.4.tar.xz

New:
----
  sanlock-3.8.5.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ sanlock.spec ++++++
--- /var/tmp/diff_new_pack.UCirHa/_old  2022-10-20 11:09:28.467747741 +0200
+++ /var/tmp/diff_new_pack.UCirHa/_new  2022-10-20 11:09:28.471747749 +0200
@@ -1,7 +1,7 @@
 #
-# spec file for package sanlock
+# spec file
 #
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -40,7 +40,7 @@
 %endif
 %define pname   sanlock
 Name:           %{pprefix}%{pname}
-Version:        3.8.4
+Version:        3.8.5
 Release:        0
 %if ! %{with python}
 Summary:        A shared disk lock manager
@@ -65,6 +65,7 @@
 Patch104:       harden_fence_sanlockd.service.patch
 Patch105:       harden_sanlk-resetd.service.patch
 BuildRequires:  %{python_module devel}
+BuildRequires:  %{python_module setuptools}
 BuildRequires:  libaio-devel
 BuildRequires:  pkgconfig
 BuildRequires:  python-rpm-macros

++++++ _service ++++++
--- /var/tmp/diff_new_pack.UCirHa/_old  2022-10-20 11:09:28.519747846 +0200
+++ /var/tmp/diff_new_pack.UCirHa/_new  2022-10-20 11:09:28.523747854 +0200
@@ -1,7 +1,7 @@
 <services>
   <service name="tar_scm" mode="disabled">
     <param name="filename">sanlock</param>
-    <param name="revision">a181e951376d49a82eef17920c8ebedec80b4823</param>
+    <param name="revision">b820c63093c4ae85d7da4f719cf3026d7fca5d09</param>
     <param name="scm">git</param>
     <param name="submodules">disable</param>
     <param name="url">https://pagure.io/sanlock</param>

++++++ harden_fence_sanlockd.service.patch ++++++
--- /var/tmp/diff_new_pack.UCirHa/_old  2022-10-20 11:09:28.559747927 +0200
+++ /var/tmp/diff_new_pack.UCirHa/_new  2022-10-20 11:09:28.563747935 +0200
@@ -1,7 +1,7 @@
-Index: sanlock-3.8.4/init.d/fence_sanlockd.service
+Index: sanlock-3.8.5/init.d/fence_sanlockd.service
 ===================================================================
---- sanlock-3.8.4.orig/init.d/fence_sanlockd.service
-+++ sanlock-3.8.4/init.d/fence_sanlockd.service
+--- sanlock-3.8.5.orig/init.d/fence_sanlockd.service
++++ sanlock-3.8.5/init.d/fence_sanlockd.service
 @@ -4,6 +4,17 @@ After=syslog.target wdmd.service sanlock
  Before=corosync.service
  

++++++ harden_sanlk-resetd.service.patch ++++++
--- /var/tmp/diff_new_pack.UCirHa/_old  2022-10-20 11:09:28.575747959 +0200
+++ /var/tmp/diff_new_pack.UCirHa/_new  2022-10-20 11:09:28.579747967 +0200
@@ -1,7 +1,7 @@
-Index: sanlock-3.8.4/init.d/sanlk-resetd.service
+Index: sanlock-3.8.5/init.d/sanlk-resetd.service
 ===================================================================
---- sanlock-3.8.4.orig/init.d/sanlk-resetd.service
-+++ sanlock-3.8.4/init.d/sanlk-resetd.service
+--- sanlock-3.8.5.orig/init.d/sanlk-resetd.service
++++ sanlock-3.8.5/init.d/sanlk-resetd.service
 @@ -4,6 +4,17 @@ After=wdmd.service sanlock.service
  Requires=wdmd.service sanlock.service
  

++++++ sanlock-3.8.4.tar.xz -> sanlock-3.8.5.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sanlock-3.8.4/.gitignore new/sanlock-3.8.5/.gitignore
--- old/sanlock-3.8.4/.gitignore        1970-01-01 01:00:00.000000000 +0100
+++ new/sanlock-3.8.5/.gitignore        2022-10-18 15:45:33.000000000 +0200
@@ -0,0 +1,27 @@
+*.co
+*.swp
+*.tar.gz
+.tox/
+.vimdir
+cscope.*
+python/*.so
+python/build/
+python/usr/
+reset/sanlk-reset
+reset/sanlk-resetd
+sanlock.spec
+src/libsanlock.pc
+src/libsanlock.so*
+src/libsanlock_client.pc
+src/libsanlock_client.so*
+src/sanlock
+tests/*.pyc
+tests/__pycache__/
+tests/devcount
+tests/killpath
+tests/sanlk_client
+tests/sanlk_load
+tests/sanlk_path
+wdmd/libwdmd.so*
+wdmd/wdmd
+wdmd/wdmd_client
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sanlock-3.8.4/VERSION new/sanlock-3.8.5/VERSION
--- old/sanlock-3.8.4/VERSION   2021-06-01 23:04:27.000000000 +0200
+++ new/sanlock-3.8.5/VERSION   2022-10-18 15:45:33.000000000 +0200
@@ -1 +1 @@
-3.8.4
+3.8.5
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sanlock-3.8.4/python/setup.py 
new/sanlock-3.8.5/python/setup.py
--- old/sanlock-3.8.4/python/setup.py   2021-06-01 23:04:27.000000000 +0200
+++ new/sanlock-3.8.5/python/setup.py   2022-10-18 15:45:33.000000000 +0200
@@ -4,7 +4,7 @@
 # modify, copy, or redistribute it subject to the terms and conditions
 # of the GNU General Public License v.2.
 
-from distutils.core import setup, Extension
+from setuptools import setup, Extension
 
 sanlocklib = ['sanlock']
 sanlock = Extension(name='sanlock',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sanlock-3.8.4/src/client.c 
new/sanlock-3.8.5/src/client.c
--- old/sanlock-3.8.4/src/client.c      2021-06-01 23:04:27.000000000 +0200
+++ new/sanlock-3.8.5/src/client.c      2022-10-18 15:45:33.000000000 +0200
@@ -1140,7 +1140,8 @@
        datalen += sizeof(struct sanlk_options);
        if (opt_in) {
                memcpy(&opt, opt_in, sizeof(struct sanlk_options));
-               datalen += opt_in->len;
+               /* data beyond opt is not used */
+               /* datalen += opt_in->len; */
        } else {
                memset(&opt, 0, sizeof(opt));
        }
@@ -1187,6 +1188,7 @@
                goto out;
        }
 
+       /*
        if (opt.len) {
                rv = send_data(fd, opt_in->str, opt.len, 0);
                if (rv < 0) {
@@ -1194,6 +1196,7 @@
                        goto out;
                }
        }
+       */
 
        rv = recv_result(fd);
  out:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sanlock-3.8.4/src/cmd.c new/sanlock-3.8.5/src/cmd.c
--- old/sanlock-3.8.4/src/cmd.c 2021-06-01 23:04:27.000000000 +0200
+++ new/sanlock-3.8.5/src/cmd.c 2022-10-18 15:45:33.000000000 +0200
@@ -199,7 +199,6 @@
        struct space_info spi;
        char killpath[SANLK_HELPER_PATH_LEN];
        char killargs[SANLK_HELPER_ARGS_LEN];
-       char *opt_str;
        int token_len, disks_len;
        int fd, rv, i, j, empty_slots, lvl;
        int alloc_count = 0, acquire_count = 0;
@@ -361,6 +360,8 @@
 
        strncpy(cl->owner_name, opt.owner_name, SANLK_NAME_LEN);
 
+       /* data after opt is not used */
+       /*
        if (opt.len) {
                opt_str = malloc(opt.len);
                if (!opt_str) {
@@ -379,6 +380,7 @@
                        goto done;
                }
        }
+       */
 
        /* TODO: warn if header.length != sizeof(header) + pos ? */
        recv_done = 1;
@@ -2395,6 +2397,7 @@
                 "external_used=%d "
                 "used_by_orphans=%d "
                 "renewal_read_extend_sec=%u "
+                "set_max_sectors_kb=%u "
                 "corrupt_result=%d "
                 "acquire_last_result=%d "
                 "renewal_last_result=%d "
@@ -2415,6 +2418,7 @@
                 (sp->flags & SP_EXTERNAL_USED) ? 1 : 0,
                 (sp->flags & SP_USED_BY_ORPHANS) ? 1 : 0,
                 sp->renewal_read_extend_sec,
+                sp->set_max_sectors_kb,
                 sp->lease_status.corrupt_result,
                 sp->lease_status.acquire_last_result,
                 sp->lease_status.renewal_last_result,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sanlock-3.8.4/src/diskio.c 
new/sanlock-3.8.5/src/diskio.c
--- old/sanlock-3.8.4/src/diskio.c      2021-06-01 23:04:27.000000000 +0200
+++ new/sanlock-3.8.5/src/diskio.c      2022-10-18 15:45:33.000000000 +0200
@@ -32,25 +32,13 @@
 #include "direct.h"
 #include "log.h"
 
-int read_sysfs_size(const char *disk_path, const char *name, unsigned int *val)
+int read_sysfs_uint(char *path, unsigned int *val)
 {
-       char path[PATH_MAX];
-       char buf[32];
-       struct stat st;
-       int major, minor;
-       size_t len;
+       char buf[32] = { 0 };
+       int len;
        int fd;
        int rv = -1;
 
-       rv = stat(disk_path, &st);
-       if (rv < 0)
-               return -1;
-
-       major = (int)major(st.st_rdev);
-       minor = (int)minor(st.st_rdev);
-
-       snprintf(path, sizeof(path), "/sys/dev/block/%d:%d/queue/%s", major, 
minor, name);
-
        fd = open(path, O_RDONLY, 0);
        if (fd < 0)
                return -1;
@@ -73,38 +61,23 @@
        return rv;
 }
 
-static int write_sysfs_size(const char *disk_path, const char *name, unsigned 
int val)
+int write_sysfs_uint(char *path, unsigned int val)
 {
-       char path[PATH_MAX];
-       char buf[32];
-       struct stat st;
-       int major, minor;
+       char buf[32] = { 0 };
        int fd;
        int rv;
 
-       rv = stat(disk_path, &st);
-       if (rv < 0) {
-               log_debug("write_sysfs_size stat error %d %s", errno, 
disk_path);
-               return -1;
-       }
-
-       major = (int)major(st.st_rdev);
-       minor = (int)minor(st.st_rdev);
-
-       snprintf(path, sizeof(path), "/sys/dev/block/%d:%d/queue/%s", major, 
minor, name);
-
-       memset(buf, 0, sizeof(buf));
-       snprintf(buf, sizeof(buf), "%u", val);
-
        fd = open(path, O_RDWR, 0);
        if (fd < 0) {
-               log_debug("write_sysfs_size open error %d %s", errno, path);
+               log_debug("write_sysfs_uint open error %d %s", errno, path);
                return -1;
        }
 
+       snprintf(buf, sizeof(buf), "%u", val);
+
        rv = write(fd, buf, strlen(buf));
        if (rv < 0) {
-               log_debug("write_sysfs_size write %s error %d %s", buf, errno, 
path);
+               log_debug("write_sysfs_uint write %s error %d %s", buf, errno, 
path);
                close(fd);
                return -1;
        }
@@ -113,6 +86,52 @@
        return 0;
 }
 
+int read_sysfs_size(const char *disk_path, const char *name, unsigned int *val)
+{
+       char sysfs_path[PATH_MAX] = { 0 };
+       struct stat st;
+       int ma, mi;
+       int rv;
+
+       rv = stat(disk_path, &st);
+       if (rv < 0)
+               return -1;
+
+       ma = (int)major(st.st_rdev);
+       mi = (int)minor(st.st_rdev);
+
+       snprintf(sysfs_path, sizeof(sysfs_path), 
"/sys/dev/block/%d:%d/queue/%s", ma, mi, name);
+       sysfs_path[PATH_MAX-1] = '\0';
+
+       rv = read_sysfs_uint(sysfs_path, val);
+
+       return rv;
+}
+
+static int write_sysfs_size(const char *disk_path, const char *name, unsigned 
int val)
+{
+       char sysfs_path[PATH_MAX] = { 0 };
+       struct stat st;
+       int major, minor;
+       int rv;
+
+       rv = stat(disk_path, &st);
+       if (rv < 0) {
+               log_debug("write_sysfs_size stat error %d %s", errno, 
disk_path);
+               return -1;
+       }
+
+       major = (int)major(st.st_rdev);
+       minor = (int)minor(st.st_rdev);
+
+       snprintf(sysfs_path, sizeof(sysfs_path), 
"/sys/dev/block/%d:%d/queue/%s", major, minor, name);
+       sysfs_path[PATH_MAX-1] = '\0';
+
+       rv = write_sysfs_uint(sysfs_path, val);
+
+       return rv;
+}
+
 /*
  * The default max_sectors_kb is 512 (KB), so a 1MB read is split into two
  * 512KB reads.  Adjust this to at least do 1MB io's.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sanlock-3.8.4/src/diskio.h 
new/sanlock-3.8.5/src/diskio.h
--- old/sanlock-3.8.4/src/diskio.h      2021-06-01 23:04:27.000000000 +0200
+++ new/sanlock-3.8.5/src/diskio.h      2022-10-18 15:45:33.000000000 +0200
@@ -20,6 +20,8 @@
 int read_sysfs_size(const char *path, const char *name, unsigned int *val);
 int set_max_sectors_kb(struct sync_disk *disk, uint32_t max_sectors_kb);
 int get_max_sectors_kb(struct sync_disk *disk, uint32_t *max_sectors_kb);
+int read_sysfs_uint(char *path, unsigned int *val);
+int write_sysfs_uint(char *path, unsigned int val);
 
 /*
  * iobuf functions require the caller to allocate iobuf using posix_memalign
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sanlock-3.8.4/src/helper.c 
new/sanlock-3.8.5/src/helper.c
--- old/sanlock-3.8.4/src/helper.c      2021-06-01 23:04:27.000000000 +0200
+++ new/sanlock-3.8.5/src/helper.c      2022-10-18 15:45:33.000000000 +0200
@@ -31,6 +31,11 @@
 #include "monotime.h"
 #include "helper.h"
 
+/* only need sysfs functions */
+struct sync_disk;
+struct task;
+#include "diskio.h"
+
 #define MAX_AV_COUNT 8
 
 static void run_path(struct helper_msg *hm)
@@ -139,7 +144,7 @@
 #define log_debug(fmt, args...) \
 do { \
        if (log_stderr) \
-               fprintf(stderr, "%ld " fmt "\n", time(NULL), ##args); \
+               fprintf(stderr, "helper %ld " fmt "\n", time(NULL), ##args); \
 } while (0)
 
 #define STANDARD_TIMEOUT_MS (HELPER_STATUS_INTERVAL*1000)
@@ -147,6 +152,7 @@
 
 int run_helper(int in_fd, int out_fd, int log_stderr)
 {
+       unsigned int sysfs_val;
        char name[16];
        struct pollfd pollfd;
        struct helper_msg hm;
@@ -215,6 +221,11 @@
                                */
                        } else if (hm.type == HELPER_MSG_KILLPID) {
                                kill(hm.pid, hm.sig);
+
+                       } else if (hm.type == HELPER_MSG_WRITE_SYSFS) {
+                               sysfs_val = atoi(hm.args);
+                               rv = write_sysfs_uint(hm.path, sysfs_val);
+                               log_debug("write_sysfs %s %u rv %d", hm.path, 
sysfs_val, rv);
                        }
                }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sanlock-3.8.4/src/helper.h 
new/sanlock-3.8.5/src/helper.h
--- old/sanlock-3.8.4/src/helper.h      2021-06-01 23:04:27.000000000 +0200
+++ new/sanlock-3.8.5/src/helper.h      2022-10-18 15:45:33.000000000 +0200
@@ -19,6 +19,7 @@
 
 #define HELPER_MSG_RUNPATH 1
 #define HELPER_MSG_KILLPID 2
+#define HELPER_MSG_WRITE_SYSFS 3
 
 struct helper_msg {
        uint8_t type;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sanlock-3.8.4/src/lockspace.c 
new/sanlock-3.8.5/src/lockspace.c
--- old/sanlock-3.8.4/src/lockspace.c   2021-06-01 23:04:27.000000000 +0200
+++ new/sanlock-3.8.5/src/lockspace.c   2022-10-18 15:45:33.000000000 +0200
@@ -24,6 +24,7 @@
 #include <sys/time.h>
 #include <sys/un.h>
 #include <sys/stat.h>
+#include <sys/sysmacros.h>
 
 #include "sanlock_internal.h"
 #include "sanlock_admin.h"
@@ -38,9 +39,85 @@
 #include "task.h"
 #include "timeouts.h"
 #include "direct.h"
+#include "helper.h"
 
 static uint32_t space_id_counter = 1;
 
+/*
+ * When the sanlock daemon is not root, set_max_sectors_kb() needs to use the
+ * root helper process to write to sysfs.
+ */
+
+static int helper_set_max_sectors_kb(struct sync_disk *disk, uint32_t set_kb)
+{
+       char sysfs_path[SANLK_HELPER_PATH_LEN] = { 0 };
+       struct helper_msg hm;
+       struct stat st;
+       int ma, mi;
+       unsigned int max_kb = 0;
+       int rv;
+
+       rv = stat(disk->path, &st);
+       if (rv < 0) {
+               log_debug("helper_set_max_sectors_kb stat error %d %s", errno, 
disk->path);
+               return -1;
+       }
+       ma = (int)major(st.st_rdev);
+       mi = (int)minor(st.st_rdev);
+
+       snprintf(sysfs_path, sizeof(sysfs_path), 
"/sys/dev/block/%d:%d/queue/max_sectors_kb", ma, mi);
+       sysfs_path[SANLK_HELPER_PATH_LEN-1] = '\0';
+
+       rv = read_sysfs_uint(sysfs_path, &max_kb);
+       if (rv < 0) {
+               /* max_sectors_kb setting may not exist */
+               return -1;
+       }
+
+       if (max_kb == set_kb)
+               return 0;
+
+       if (helper_kill_fd == -1)
+               return -1;
+
+       memset(&hm, 0, sizeof(hm));
+       hm.type = HELPER_MSG_WRITE_SYSFS;
+       memcpy(hm.path, sysfs_path, SANLK_HELPER_PATH_LEN);
+       snprintf(hm.args, sizeof(hm.args), "%u", set_kb);
+
+ retry:
+       rv = write(helper_kill_fd, &hm, sizeof(hm));
+       if (rv == -1 && errno == EINTR)
+               goto retry;
+
+       /* pipe is full, we'll try again in a second */
+       if (rv == -1 && errno == EAGAIN) {
+               log_error("helper_set_max_sectors_kb send EAGAIN");
+               return -1;
+       }
+
+       /* helper exited or closed fd, quit using helper */
+       if (rv == -1 && errno == EPIPE) {
+               log_error("helper_set_max_sectors_kb send EPIPE");
+               return -1;
+       }
+
+       if (rv == -1) {
+               log_error("helper_set_max_sectors_kb send errno %d", errno);
+               return rv;
+       }
+
+       /* We don't try to wait for the helper process to do the write,
+          although we could probably do something with the status msg.
+          It shouldn't matter when the sysfs field is written wrt
+          reading/writing the device. Add a slight delay here which
+          should usually let the sysfs update happen first. */
+
+       usleep(2000);
+
+       return 0;
+}
+
 static struct space *_search_space(const char *name,
                                   struct sync_disk *disk,
                                   uint64_t host_id,
@@ -634,7 +711,10 @@
 
                log_space(sp, "set_lockspace_max_sectors_kb small hw_kb %u 
using 1024", hw_kb);
 
-               rv = set_max_sectors_kb(&sp->host_id_disk, set_kb);
+               if (!com.uid)
+                       rv = set_max_sectors_kb(&sp->host_id_disk, set_kb);
+               else
+                       rv = helper_set_max_sectors_kb(&sp->host_id_disk, 
set_kb);
                if (rv < 0) {
                        log_space(sp, "set_lockspace_max_sectors_kb small hw_kb 
%u set 1024 error %d", hw_kb, rv);
                        return;
@@ -646,12 +726,16 @@
 
                log_space(sp, "set_lockspace_max_sectors_kb hw_kb %u setting 
%u", hw_kb, set_kb);
 
-               rv = set_max_sectors_kb(&sp->host_id_disk, set_kb);
+               if (!com.uid)
+                       rv = set_max_sectors_kb(&sp->host_id_disk, set_kb);
+               else
+                       rv = helper_set_max_sectors_kb(&sp->host_id_disk, 
set_kb);
                if (rv < 0) {
                        log_space(sp, "set_lockspace_max_sectors_kb hw_kb %u 
set %u error %d", hw_kb, set_kb, rv);
                        return;
                }
        }
+       sp->set_max_sectors_kb = set_kb;
 }
 
 /*
@@ -939,6 +1023,8 @@
 {
        if (sp->lease_status.renewal_read_buf)
                free(sp->lease_status.renewal_read_buf);
+       if (sp->renewal_history)
+               free(sp->renewal_history);
        free(sp);
 }
 
@@ -1068,8 +1154,9 @@
                  (unsigned long long)sp->host_id_disk.offset);
 
        rv = pthread_create(&sp->thread, NULL, lockspace_thread, sp);
-       if (rv < 0) {
-               log_erros(sp, "add_lockspace create thread failed");
+       if (rv) {
+               log_erros(sp, "add_lockspace create thread failed %d", rv);
+               rv = -1;
                goto fail_del;
        }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sanlock-3.8.4/src/log.c new/sanlock-3.8.5/src/log.c
--- old/sanlock-3.8.4/src/log.c 2021-06-01 23:04:27.000000000 +0200
+++ new/sanlock-3.8.5/src/log.c 2022-10-18 15:45:33.000000000 +0200
@@ -128,6 +128,9 @@
        struct tm time_info;
        pid_t tid;
 
+       if (is_helper)
+               return;
+
        memset(name, 0, sizeof(name));
 
        if (level == LOG_CLIENT) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sanlock-3.8.4/src/main.c new/sanlock-3.8.5/src/main.c
--- old/sanlock-3.8.4/src/main.c        2021-06-01 23:04:27.000000000 +0200
+++ new/sanlock-3.8.5/src/main.c        2022-10-18 15:45:33.000000000 +0200
@@ -946,9 +946,6 @@
 
        while (1) {
                while (!pool.quit && list_empty(&pool.work_data)) {
-                       if (pool.free_workers >= DEFAULT_MIN_WORKER_THREADS)
-                               goto out;
-
                        pool.free_workers++;
                        pthread_cond_wait(&pool.cond, &pool.mutex);
                        pool.free_workers--;
@@ -969,7 +966,6 @@
                        break;
        }
 
-out:
        pool.num_workers--;
        if (!pool.num_workers)
                pthread_cond_signal(&pool.quit_wait);
@@ -995,10 +991,11 @@
        if (!pool.free_workers && pool.num_workers < pool.max_workers) {
                rv = pthread_create(&th, NULL, thread_pool_worker,
                                    (void *)(long)pool.num_workers);
-               if (rv < 0) {
+               if (rv) {
                        log_error("thread_pool_add_work ci %d error %d", 
ca->ci_in, rv);
                        list_del(&ca->list);
                        pthread_mutex_unlock(&pool.mutex);
+                       rv = -1;
                        return rv;
                }
                pool.num_workers++;
@@ -1023,7 +1020,7 @@
 static int thread_pool_create(int min_workers, int max_workers)
 {
        pthread_t th;
-       int i, rv;
+       int i, rv = 0;
 
        memset(&pool, 0, sizeof(pool));
        INIT_LIST_HEAD(&pool.work_data);
@@ -1035,8 +1032,11 @@
        for (i = 0; i < min_workers; i++) {
                rv = pthread_create(&th, NULL, thread_pool_worker,
                                    (void *)(long)i);
-               if (rv < 0)
+               if (rv) {
+                       log_error("thread_pool_create failed %d", rv);
+                       rv = -1;
                        break;
+               }
                pool.num_workers++;
        }
 
@@ -1649,6 +1649,7 @@
        } else {
                close(pr_fd);
                close(pw_fd);
+               is_helper = 1;
                run_helper(cr_fd, cw_fd, (log_stderr_priority == LOG_DEBUG));
                exit(0);
        }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sanlock-3.8.4/src/sanlock.h 
new/sanlock-3.8.5/src/sanlock.h
--- old/sanlock-3.8.4/src/sanlock.h     2021-06-01 23:04:27.000000000 +0200
+++ new/sanlock-3.8.5/src/sanlock.h     2022-10-18 15:45:33.000000000 +0200
@@ -137,8 +137,8 @@
 struct sanlk_options {
        char owner_name[SANLK_NAME_LEN]; /* optional user friendly name */
        uint32_t flags;
-       uint32_t len;
-       /* followed by len bytes (migration input will use this) */
+       uint32_t len; /* unused and ignored */
+       /* followed by len bytes (unused and ignored) */
        char str[0];
 };
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sanlock-3.8.4/src/sanlock_internal.h 
new/sanlock-3.8.5/src/sanlock_internal.h
--- old/sanlock-3.8.4/src/sanlock_internal.h    2021-06-01 23:04:27.000000000 
+0200
+++ new/sanlock-3.8.5/src/sanlock_internal.h    2022-10-18 15:45:33.000000000 
+0200
@@ -209,6 +209,7 @@
        uint32_t used_retries;
        uint32_t renewal_read_extend_sec; /* defaults to io_timeout */
        uint32_t rindex_op;
+       unsigned int set_max_sectors_kb;
        int sector_size;
        int align_size;
        int max_hosts;
@@ -455,6 +456,7 @@
 
 EXTERN int kill_count_max;
 EXTERN int kill_grace_seconds;
+EXTERN int is_helper;
 EXTERN int helper_ci;
 EXTERN int helper_pid;
 EXTERN int helper_kill_fd;

++++++ suse-no-date-time.patch ++++++
--- /var/tmp/diff_new_pack.UCirHa/_old  2022-10-20 11:09:28.727748267 +0200
+++ /var/tmp/diff_new_pack.UCirHa/_new  2022-10-20 11:09:28.731748275 +0200
@@ -1,8 +1,8 @@
-Index: sanlock-3.8.4/src/main.c
+Index: sanlock-3.8.5/src/main.c
 ===================================================================
---- sanlock-3.8.4.orig/src/main.c
-+++ sanlock-3.8.4/src/main.c
-@@ -2208,8 +2208,8 @@ static int read_command_line(int argc, c
+--- sanlock-3.8.5.orig/src/main.c
++++ sanlock-3.8.5/src/main.c
+@@ -2209,8 +2209,8 @@ static int read_command_line(int argc, c
        }
  
        if (!strcmp(arg1, "--version") || !strcmp(arg1, "-V")) {
@@ -13,10 +13,10 @@
                exit(EXIT_SUCCESS);
        }
  
-Index: sanlock-3.8.4/fence_sanlock/fence_sanlockd.c
+Index: sanlock-3.8.5/fence_sanlock/fence_sanlockd.c
 ===================================================================
---- sanlock-3.8.4.orig/fence_sanlock/fence_sanlockd.c
-+++ sanlock-3.8.4/fence_sanlock/fence_sanlockd.c
+--- sanlock-3.8.5.orig/fence_sanlock/fence_sanlockd.c
++++ sanlock-3.8.5/fence_sanlock/fence_sanlockd.c
 @@ -565,8 +565,7 @@ int main(int argc, char *argv[])
                        print_usage();
                        exit(0);

++++++ suse-systemd.patch ++++++
--- /var/tmp/diff_new_pack.UCirHa/_old  2022-10-20 11:09:28.743748300 +0200
+++ /var/tmp/diff_new_pack.UCirHa/_new  2022-10-20 11:09:28.747748308 +0200
@@ -1,7 +1,7 @@
-Index: sanlock-3.8.4/init.d/sanlock.service
+Index: sanlock-3.8.5/init.d/sanlock.service
 ===================================================================
---- sanlock-3.8.4.orig/init.d/sanlock.service
-+++ sanlock-3.8.4/init.d/sanlock.service
+--- sanlock-3.8.5.orig/init.d/sanlock.service
++++ sanlock-3.8.5/init.d/sanlock.service
 @@ -5,8 +5,10 @@ Wants=wdmd.service
  
  [Service]
@@ -15,10 +15,10 @@
  
  [Install]
  WantedBy=multi-user.target
-Index: sanlock-3.8.4/init.d/wdmd.service
+Index: sanlock-3.8.5/init.d/wdmd.service
 ===================================================================
---- sanlock-3.8.4.orig/init.d/wdmd.service
-+++ sanlock-3.8.4/init.d/wdmd.service
+--- sanlock-3.8.5.orig/init.d/wdmd.service
++++ sanlock-3.8.5/init.d/wdmd.service
 @@ -4,8 +4,10 @@ After=syslog.target
  
  [Service]
@@ -32,10 +32,10 @@
  
  [Install]
  WantedBy=multi-user.target
-Index: sanlock-3.8.4/init.d/fence_sanlockd.service
+Index: sanlock-3.8.5/init.d/fence_sanlockd.service
 ===================================================================
---- sanlock-3.8.4.orig/init.d/fence_sanlockd.service
-+++ sanlock-3.8.4/init.d/fence_sanlockd.service
+--- sanlock-3.8.5.orig/init.d/fence_sanlockd.service
++++ sanlock-3.8.5/init.d/fence_sanlockd.service
 @@ -5,8 +5,8 @@ Before=corosync.service
  
  [Service]

Reply via email to