Hello community,

here is the log from the commit of package autofs for openSUSE:Factory checked 
in at 2018-02-12 10:09:14
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/autofs (Old)
 and      /work/SRC/openSUSE:Factory/.autofs.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "autofs"

Mon Feb 12 10:09:14 2018 rev:115 rq:574120 version:5.1.3

Changes:
--------
--- /work/SRC/openSUSE:Factory/autofs/autofs.changes    2017-11-30 
12:40:47.671946261 +0100
+++ /work/SRC/openSUSE:Factory/.autofs.new/autofs.changes       2018-02-12 
10:09:18.814265610 +0100
@@ -1,0 +2,14 @@
+Sun Feb  4 23:22:33 UTC 2018 - nfbr...@suse.com
+
+- 0001-use_hostname_for_mounts-shouldn-t-prevent-selection-.patch
+  Fix handling of replicated NFS server so that
+  selection between servers still works sensibly when
+  use_hostname_for_mounts is in effect.
+  (bsc#1066720)
+- 0002-Fix-monotonic_elapsed.patch
+  Fix bug introduced with monotonic-time patches which
+  causes nanoseconds to be ignored and effectively
+  disables sorting based on response time and/or weight.
+  (bsc#1066720)
+
+-------------------------------------------------------------------

New:
----
  0001-use_hostname_for_mounts-shouldn-t-prevent-selection-.patch
  0002-Fix-monotonic_elapsed.patch

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

Other differences:
------------------
++++++ autofs.spec ++++++
--- /var/tmp/diff_new_pack.GOC8i7/_old  2018-02-12 10:09:19.806229861 +0100
+++ /var/tmp/diff_new_pack.GOC8i7/_new  2018-02-12 10:09:19.810229716 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package autofs
 #
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -103,6 +103,8 @@
 Patch107:       autofs-5-1-3-fix-possible-map-instance-memory-leak.patch
 # PATCH-FIX-OPENSUSE 
autofs-5-1-3-check-map-instances-for-staleness-on-map-update.patch
 Patch108:       
autofs-5-1-3-check-map-instances-for-staleness-on-map-update.patch
+Patch109:       0001-use_hostname_for_mounts-shouldn-t-prevent-selection-.patch
+Patch110:       0002-Fix-monotonic_elapsed.patch
 Requires(pre):  %fillup_prereq
 Requires(pre):  aaa_base
 %if %{with_systemd}
@@ -132,6 +134,8 @@
 %patch106 -p1
 %patch107 -p1
 %patch108 -p1
+%patch109 -p1
+%patch110 -p1
 
 %build
 autoreconf -fiv

++++++ 0001-use_hostname_for_mounts-shouldn-t-prevent-selection-.patch ++++++
>From b25cc873cda78c466ae75702be515b540e1bb7f3 Mon Sep 17 00:00:00 2001
From: NeilBrown <ne...@suse.com>
Date: Mon, 29 Jan 2018 18:02:49 +1100
Subject: [PATCH] use_hostname_for_mounts shouldn't prevent selection among
 replicas

If several replicas have been specified for a mount point,
and use_hostname_for_mount is set to "yes", the selection
between these replicas is currently disabled and the last in
the list is always chosen.

There is little point selecting between different addresses
for the one host in this case, but it is still worth
selecting between different hosts, particularly if different
weights have been specified.

This patch restores the "prune_host_list()" functionality
when use_hostname_for_mount is set, and modifies it slightly
so that only on IP address for any host:/path entry in the
config file is willl be successfully probed.  After a
success, further addresses from the same entry are skipped.
This is achieved by tracking an entry number ("ent_num") for
each 'struct host'.

Signed-off-by: NeilBrown <ne...@suse.com>
---
 include/replicated.h |    3 ++-
 modules/mount_nfs.c  |    2 +-
 modules/replicated.c |   35 ++++++++++++++++++++---------------
 3 files changed, 23 insertions(+), 17 deletions(-)

--- a/include/replicated.h
+++ b/include/replicated.h
@@ -55,6 +55,7 @@
 
 struct host {
        char *name;
+       int ent_num;
        struct sockaddr *addr;
        size_t addr_len;
        unsigned int rr;
@@ -68,7 +69,7 @@ struct host {
 };
 
 void seed_random(void);
-struct host *new_host(const char *, struct sockaddr *, size_t,
+struct host *new_host(const char *, int, struct sockaddr *, size_t,
                      unsigned int, unsigned int, unsigned int);
 void free_host_list(struct host **);
 int parse_location(unsigned, struct host **, const char *, unsigned int);
--- a/modules/mount_nfs.c
+++ b/modules/mount_nfs.c
@@ -220,7 +220,7 @@ int mount_mount(struct autofs_point *ap,
            (vers & NFS_VERS_MASK) != 0 &&
            (vers & NFS4_VERS_MASK) != 0) {
                unsigned int v4_probe_ok = 0;
-               struct host *tmp = new_host(hosts->name,
+               struct host *tmp = new_host(hosts->name, 0,
                                            hosts->addr, hosts->addr_len,
                                            hosts->proximity,
                                            hosts->weight, hosts->options);
--- a/modules/replicated.c
+++ b/modules/replicated.c
@@ -83,7 +83,7 @@ void seed_random(void)
        return;
 }
 
-struct host *new_host(const char *name,
+struct host *new_host(const char *name, int ent_num,
                      struct sockaddr *addr, size_t addr_len,
                      unsigned int proximity, unsigned int weight,
                      unsigned int options)
@@ -116,6 +116,7 @@ struct host *new_host(const char *name,
        memset(new, 0, sizeof(struct host));
 
        new->name = tmp1;
+       new->ent_num = ent_num;
        new->addr_len = addr_len;
        new->addr = tmp2;
        new->proximity = proximity;
@@ -653,7 +654,7 @@ done:
 int prune_host_list(unsigned logopt, struct host **list,
                    unsigned int vers, int port)
 {
-       struct host *this, *last, *first;
+       struct host *this, *last, *first, *prev;
        struct host *new = NULL;
        unsigned int proximity, selected_version = 0;
        unsigned int v2_tcp_count, v3_tcp_count, v4_tcp_count;
@@ -665,12 +666,6 @@ int prune_host_list(unsigned logopt, str
        if (!*list)
                return 0;
 
-       /* If we're using the host name then there's no point probing
-        * avialability and respose time.
-        */
-       if (defaults_use_hostname_for_mounts())
-               return 1;
-
        /* Use closest hosts to choose NFS version */
 
        first = *list;
@@ -816,11 +811,18 @@ int prune_host_list(unsigned logopt, str
 
        first = last;
        this = first;
+       prev = NULL;
        while (this) {
                struct host *next = this->next;
                if (!this->name) {
                        remove_host(list, this);
                        add_host(&new, this);
+               } else if (defaults_use_hostname_for_mounts() && prev &&
+                          prev->ent_num == this->ent_num) {
+                       /* When we use the hostname to mount, there is no
+                        * point in probing every address it has, just one is
+                        * enough.  Skip the rest.
+                        */
                } else {
                        status = get_supported_ver_and_cost(logopt, this,
                                                selected_version, port);
@@ -828,6 +830,7 @@ int prune_host_list(unsigned logopt, str
                                this->version = selected_version;
                                remove_host(list, this);
                                add_host(&new, this);
+                               prev = this;
                        }
                }
                this = next;
@@ -840,7 +843,7 @@ int prune_host_list(unsigned logopt, str
 }
 
 static int add_new_host(struct host **list,
-                       const char *host, unsigned int weight,
+                       const char *host, int ent_num, unsigned int weight,
                        struct addrinfo *host_addr,
                        unsigned int rr, unsigned int options)
 {
@@ -879,7 +882,7 @@ static int add_new_host(struct host **li
        else
                return 0;
 
-       new = new_host(host, host_addr->ai_addr, addr_len, prx, weight, 
options);
+       new = new_host(host, ent_num, host_addr->ai_addr, addr_len, prx, 
weight, options);
        if (!new)
                return 0;
 
@@ -892,7 +895,7 @@ static int add_new_host(struct host **li
        return 1;
 }
 
-static int add_host_addrs(struct host **list, const char *host,
+static int add_host_addrs(struct host **list, const char *host, int ent_num,
                          unsigned int weight, unsigned int options)
 {
        struct addrinfo hints, *ni, *this;
@@ -927,7 +930,7 @@ static int add_host_addrs(struct host **
 
        this = ni;
        while (this) {
-               ret = add_new_host(list, host, weight, this, 0, options);
+               ret = add_new_host(list, host, ent_num, weight, this, 0, 
options);
                if (!ret)
                        break;
                this = this->ai_next;
@@ -966,7 +969,7 @@ try_name:
                rr++;
        this = ni;
        while (this) {
-               ret = add_new_host(list, host, weight, this, rr, options);
+               ret = add_new_host(list, host, ent_num, weight, this, rr, 
options);
                if (!ret)
                        break;
                this = this->ai_next;
@@ -1059,6 +1062,7 @@ int parse_location(unsigned logopt, stru
 {
        char *str, *p, *delim;
        unsigned int empty = 1;
+       int ent_num = 1;
 
        if (!list)
                return 0;
@@ -1116,7 +1120,7 @@ int parse_location(unsigned logopt, stru
                                }
 
                                if (p != delim) {
-                                       if (!add_host_addrs(hosts, p, weight, 
options)) {
+                                       if (!add_host_addrs(hosts, p, ent_num, 
weight, options)) {
                                                if (empty) {
                                                        p = next;
                                                        continue;
@@ -1138,7 +1142,7 @@ int parse_location(unsigned logopt, stru
                                *delim = '\0';
                                next = delim + 1;
 
-                               if (!add_host_addrs(hosts, p, weight, options)) 
{
+                               if (!add_host_addrs(hosts, p, ent_num, weight, 
options)) {
                                        p = next;
                                        continue;
                                }
@@ -1152,6 +1156,7 @@ int parse_location(unsigned logopt, stru
                        return 0;
                }
 
+               ent_num ++;
                p = next;
        }
 
++++++ 0002-Fix-monotonic_elapsed.patch ++++++
>From 4af750d2b48190c6d52fda1ce96c2cc86cd14d51 Mon Sep 17 00:00:00 2001
From: NeilBrown <ne...@suse.com>
Date: Mon, 29 Jan 2018 18:06:21 +1100
Subject: [PATCH] Fix monotonic_elapsed.

When automount probes multiple hosts to find the one which
responds most quickly, it currently ignores the nanoseconds.
This often makes the cost "0", which makes weights ineffective.

The cause is that monotonic_elapsed() casts tv_nsec to a
double *after* dividing by 1 billion, rather than before.

With this change, weights become effective for choosing
between hosts which respond in under one second.

Signed-off-by: NeilBrown <ne...@suse.com>
---
 lib/rpc_subs.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/lib/rpc_subs.c
+++ b/lib/rpc_subs.c
@@ -1078,9 +1078,9 @@ double monotonic_elapsed(struct timespec
        double t1, t2;
 
        t1 =  (double) start.tv_sec +
-               (double) (start.tv_nsec/(1000*1000*1000));
+               ((double) start.tv_nsec/(1000*1000*1000));
        t2 =  (double) end.tv_sec +
-               (double) (end.tv_nsec/(1000*1000*1000));
+               ((double) end.tv_nsec/(1000*1000*1000));
        return t2 - t1;
 }
 



Reply via email to