Hello community,

here is the log from the commit of package drbd for openSUSE:Factory checked in 
at 2020-06-11 10:04:57
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/drbd (Old)
 and      /work/SRC/openSUSE:Factory/.drbd.new.3606 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "drbd"

Thu Jun 11 10:04:57 2020 rev:86 rq:813082 version:9.0.23~1+git.d16bfab7

Changes:
--------
--- /work/SRC/openSUSE:Factory/drbd/drbd.changes        2020-03-17 
13:11:30.537861791 +0100
+++ /work/SRC/openSUSE:Factory/.drbd.new.3606/drbd.changes      2020-06-11 
10:05:50.103380280 +0200
@@ -1,0 +2,37 @@
+Wed Jun 10 03:33:22 UTC 2020 - nick wang <[email protected]>
+
+- bsc#1172761, Update to drbd-9.0.23-1
+ * fix a deadlock (regression introduced in 9.0.22) that can happen when
+   new current UUID is generated while a connection gets established
+ * Do not create a new data generation if the node has
+   'allow-remote-read = no' set, is primary, and the local disk fails
+   (because it has no access to good data anyome)
+ * fix a deadlock (regression introduced in 9.0.22) that can be
+   triggered if a minor is added into a resource with an established
+   connection
+ * generate new UUID immediately if a primary loses a disk due to an IO
+   error
+ * fix read requests on diskless nodes that hit a read error on a
+   diskful node; the retry on another diskful node works, but a bug
+   could lead to a log-storm on the diskless node
+ * fix removal of diskless nodes from clusters with quorum enabled
+   (initiated from the diskless itself)
+ * fix wrongly declined state changes if connections are established
+   concurrently
+ * fix continuation of initial resync; before that the initial resync
+   always started from the beginning if it was interrupted
+ * use rwsem _non_owner() operations to avoid false positives of
+   lock-dep when running on a debug kernel
+ * fix a sometimes missed resync if only a diskless node was primary
+   since the day0 UUID
+ * fix a corner case where a SyncSource node does not recognise
+   that a SyncTarget node declared the resync as finished
+ * update compat up to Linux 5.6
+- Remove patch without_pr_warning.patch since change in 7e6a20f7
+
+-------------------------------------------------------------------
+Wed Jun 10 02:55:39 UTC 2020 - nick wang <[email protected]>
+
+- jsc#11801, enable buildrt for Leap15.2 but Tumbleweed.
+
+-------------------------------------------------------------------

Old:
----
  drbd-9.0.22~1+git.fe2b5983.tar.bz2
  without_pr_warning.patch

New:
----
  drbd-9.0.23~1+git.d16bfab7.tar.bz2

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

Other differences:
------------------
++++++ drbd.spec ++++++
--- /var/tmp/diff_new_pack.Baplhp/_old  2020-06-11 10:05:54.447394271 +0200
+++ /var/tmp/diff_new_pack.Baplhp/_new  2020-06-11 10:05:54.451394284 +0200
@@ -17,13 +17,14 @@
 # needssslcertforbuild
 
 
-%if ! 0%{?is_opensuse}
+# RT enabled in Leap15.2(but not in Tumbleweed)
+%if ! 0%{?is_opensuse} || 0%{?sle_version} >= 150200
 %ifarch x86_64
 %define buildrt 1
 %endif
 %endif
 Name:           drbd
-Version:        9.0.22~1+git.fe2b5983
+Version:        9.0.23~1+git.d16bfab7
 Release:        0
 Summary:        Linux driver for the "Distributed Replicated Block Device"
 License:        GPL-2.0-or-later
@@ -37,7 +38,6 @@
 Patch2:         rely-on-sb-handlers.patch
 Patch3:         drbd-fix-zero-metadata-limit-by-page-size-misaligned.patch
 #In 61ff72f401680(v5.5-rc2), pr_warning is removed
-Patch4:         without_pr_warning.patch
 Patch99:        suse-coccinelle.patch
 #https://github.com/openSUSE/rpmlint-checks/blob/master/KMPPolicyCheck.py
 BuildRequires:  coccinelle >= 1.0.8
@@ -74,7 +74,6 @@
 %patch1 -p1
 %patch2 -p1
 %patch3 -p1
-%patch4 -p1
 %patch99 -p1
 
 mkdir source

++++++ _service ++++++
--- /var/tmp/diff_new_pack.Baplhp/_old  2020-06-11 10:05:54.515394490 +0200
+++ /var/tmp/diff_new_pack.Baplhp/_new  2020-06-11 10:05:54.515394490 +0200
@@ -9,9 +9,9 @@
 
     This will download branch first instead of tag.
     <param name="revision">drbd-9.0</param>
-    <param name="version">9.0.22~1</param>
+    <param name="version">9.0.23~1</param>
 -->
-    <param name="versionformat">9.0.22~1+git.%h</param>
+    <param name="versionformat">9.0.23~1+git.%h</param>
     <param name="revision">drbd-9.0</param>
   </service>
 

++++++ drbd-9.0.22~1+git.fe2b5983.tar.bz2 -> drbd-9.0.23~1+git.d16bfab7.tar.bz2 
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/drbd-9.0.22~1+git.fe2b5983/.gitmodules 
new/drbd-9.0.23~1+git.d16bfab7/.gitmodules
--- old/drbd-9.0.22~1+git.fe2b5983/.gitmodules  2020-03-10 15:37:08.000000000 
+0100
+++ new/drbd-9.0.23~1+git.d16bfab7/.gitmodules  2020-06-08 15:56:55.000000000 
+0200
@@ -1,5 +1,5 @@
 [submodule "drbd/drbd-headers"]
        path = drbd/drbd-headers
-       url = git://github.com/LINBIT/drbd-headers.git
+       url = https://github.com/LINBIT/drbd-headers.git
        update = rebase
        fetchRecurseSubmodules = true
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/drbd-9.0.22~1+git.fe2b5983/ChangeLog 
new/drbd-9.0.23~1+git.d16bfab7/ChangeLog
--- old/drbd-9.0.22~1+git.fe2b5983/ChangeLog    2020-03-10 15:37:08.000000000 
+0100
+++ new/drbd-9.0.23~1+git.d16bfab7/ChangeLog    2020-06-08 15:56:55.000000000 
+0200
@@ -3,6 +3,35 @@
  For even more detail, use "git log" or visit
  https://github.com/LINBIT/drbd-9.0/commits/drbd-9.0
 
+9.0.23-1 (api:genl2/proto:86-116/transport:14)
+--------
+ * fix a deadlock (regression introduced in 9.0.22) that can happen when
+   new current UUID is generated while a connection gets established
+ * Do not create a new data generation if the node has
+   'allow-remote-read = no' set, is primary, and the local disk fails
+   (because it has no access to good data anyome)
+ * fix a deadlock (regression introduced in 9.0.22) that can be
+   triggered if a minor is added into a resource with an established
+   connection
+ * generate new UUID immediately if a primary loses a disk due to an IO
+   error
+ * fix read requests on diskless nodes that hit a read error on a
+   diskful node; the retry on another diskful node works, but a bug
+   could lead to a log-storm on the diskless node
+ * fix removal of diskless nodes from clusters with quorum enabled
+   (initiated from the diskless itself)
+ * fix wrongly declined state changes if connections are established
+   concurrently
+ * fix continuation of initial resync; before that the initial resync
+   always started from the beginning if it was interrupted
+ * use rwsem _non_owner() operations to avoid false positives of
+   lock-dep when running on a debug kernel
+ * fix a sometimes missed resync if only a diskless node was primary
+   since the day0 UUID
+ * fix a corner case where a SyncSource node does not recognise
+   that a SyncTarget node declared the resync as finished
+ * update compat up to Linux 5.6
+
 9.0.22-1 (api:genl2/proto:86-116/transport:14)
 --------
  * introduce locking to avoid connection retries when UUIDs or
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/drbd-9.0.22~1+git.fe2b5983/Makefile 
new/drbd-9.0.23~1+git.d16bfab7/Makefile
--- old/drbd-9.0.22~1+git.fe2b5983/Makefile     2020-03-10 15:37:08.000000000 
+0100
+++ new/drbd-9.0.23~1+git.d16bfab7/Makefile     2020-06-08 15:56:55.000000000 
+0200
@@ -30,6 +30,7 @@
 DOCKERREGPATH_RHEL7 = $(DOCKERREGISTRY)/drbd9-rhel7
 DOCKERREGPATH_RHEL8 = $(DOCKERREGISTRY)/drbd9-rhel8
 DOCKERREGPATH_BIONIC = $(DOCKERREGISTRY)/drbd9-bionic
+DOCKERREGPATH_FOCAL = $(DOCKERREGISTRY)/drbd9-focal
 
 # Use the SPAAS (spatch as a service) online service
 # Have this as make variable for distributions.
@@ -299,7 +300,7 @@
        ( cd "$$D" && $(DEBBUILD) -i -us -uc -b ) && rm -rf "$$D"
 endif
 
-.PHONY: dockerimage.rhel7 dockerimage.rhel8 dockerimage.bionic dockerimage
+.PHONY: dockerimage.rhel7 dockerimage.rhel8 dockerimage.bionic 
dockerimage.focal dockerimage
 dockerimage.rhel7:
        cd docker && docker build -f Dockerfile.centos7 -t 
$(DOCKERREGPATH_RHEL7):$(TAG) .
        docker tag $(DOCKERREGPATH_RHEL7):$(TAG) $(DOCKERREGPATH_RHEL7):latest
@@ -312,11 +313,16 @@
        cd docker && docker build -f Dockerfile.bionic -t 
$(DOCKERREGPATH_BIONIC):$(TAG) .
        docker tag $(DOCKERREGPATH_BIONIC):$(TAG) $(DOCKERREGPATH_BIONIC):latest
 
-dockerimage: dockerimage.rhel7 dockerimage.rhel8 dockerimage.bionic
+dockerimage.focal:
+       cd docker && docker build -f Dockerfile.focal -t 
$(DOCKERREGPATH_FOCAL):$(TAG) .
+       docker tag $(DOCKERREGPATH_FOCAL):$(TAG) $(DOCKERREGPATH_FOCAL):latest
+
+dockerimage: dockerimage.rhel7 dockerimage.rhel8 dockerimage.bionic 
dockerimage.focal
 
 # used for --sync in lbbuild to decide which containers to push to which 
registry
 dockerpath:
        @echo $(DOCKERREGPATH_BIONIC):$(TAG) $(DOCKERREGPATH_BIONIC):latest \
+               $(DOCKERREGPATH_FOCAL):$(TAG) $(DOCKERREGPATH_FOCAL):latest \
                $(DOCKERREGPATH_RHEL7):$(TAG) $(DOCKERREGPATH_RHEL7):latest \
                $(DOCKERREGPATH_RHEL8):$(TAG) $(DOCKERREGPATH_RHEL8):latest
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/drbd-9.0.22~1+git.fe2b5983/debian/changelog 
new/drbd-9.0.23~1+git.d16bfab7/debian/changelog
--- old/drbd-9.0.22~1+git.fe2b5983/debian/changelog     2020-03-10 
15:37:08.000000000 +0100
+++ new/drbd-9.0.23~1+git.d16bfab7/debian/changelog     2020-06-08 
15:56:55.000000000 +0200
@@ -1,3 +1,16 @@
+drbd (9.0.23-1) unstable; urgency=low
+
+  * New upstream release
+
+ -- Philipp Reisner <[email protected]>  Mon, 08 Jun 2020 15:53:56 +0100
+
+drbd (9.0.22-2) unstable; urgency=low
+
+  * Fix reads on diskless in the presence of IO errors
+  * Fix diskless nodes leaving a quorum enabled cluster
+
+ -- Philipp Reisner <[email protected]>  Mon, 30 Mar 2020 12:03:10 +0100
+
 drbd (9.0.22-1) unstable; urgency=low
 
   * New upstream release
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/drbd-9.0.22~1+git.fe2b5983/docker/Dockerfile.centos7 
new/drbd-9.0.23~1+git.d16bfab7/docker/Dockerfile.centos7
--- old/drbd-9.0.22~1+git.fe2b5983/docker/Dockerfile.centos7    2020-03-10 
15:37:08.000000000 +0100
+++ new/drbd-9.0.23~1+git.d16bfab7/docker/Dockerfile.centos7    2020-06-08 
15:56:55.000000000 +0200
@@ -1,7 +1,7 @@
 FROM registry.access.redhat.com/ubi7/ubi
 MAINTAINER Roland Kammerer <[email protected]>
 
-ENV DRBD_VERSION 9.0.22-1
+ENV DRBD_VERSION 9.0.23-1
 
 ARG release=1
 LABEL name="DRBD Kernel module load container" \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/drbd-9.0.22~1+git.fe2b5983/docker/Dockerfile.centos8 
new/drbd-9.0.23~1+git.d16bfab7/docker/Dockerfile.centos8
--- old/drbd-9.0.22~1+git.fe2b5983/docker/Dockerfile.centos8    2020-03-10 
15:37:08.000000000 +0100
+++ new/drbd-9.0.23~1+git.d16bfab7/docker/Dockerfile.centos8    2020-06-08 
15:56:55.000000000 +0200
@@ -3,7 +3,7 @@
 FROM registry.access.redhat.com/ubi8/ubi
 MAINTAINER Roland Kammerer <[email protected]>
 
-ENV DRBD_VERSION 9.0.22-1
+ENV DRBD_VERSION 9.0.23-1
 
 ARG release=1
 LABEL name="DRBD Kernel module load container" \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/drbd-9.0.22~1+git.fe2b5983/docker/Dockerfile.focal 
new/drbd-9.0.23~1+git.d16bfab7/docker/Dockerfile.focal
--- old/drbd-9.0.22~1+git.fe2b5983/docker/Dockerfile.focal      1970-01-01 
01:00:00.000000000 +0100
+++ new/drbd-9.0.23~1+git.d16bfab7/docker/Dockerfile.focal      2020-06-08 
15:56:55.000000000 +0200
@@ -0,0 +1,16 @@
+FROM ubuntu:focal
+
+# note: py2 setuptools are a bit smaller than the py3 ones
+RUN apt-get update && apt-get install -y kmod gnupg wget make gcc patch curl 
&& \
+       apt-get install -y python-setuptools && apt-get clean && \
+       cd /tmp && wget 
https://github.com/LINBIT/python-lbdist/archive/master.tar.gz && \
+       tar xvf master.tar.gz && cd python-lbdist-master && python2 setup.py 
install && \
+       rm -rf python-lbdist-master master.tar.gz
+
+COPY /drbd.tar.gz /
+
+COPY /pkgs /pkgs
+
+COPY /entry.sh /
+RUN chmod +x /entry.sh
+ENTRYPOINT /entry.sh
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/drbd-9.0.22~1+git.fe2b5983/docker/entry.sh 
new/drbd-9.0.23~1+git.d16bfab7/docker/entry.sh
--- old/drbd-9.0.22~1+git.fe2b5983/docker/entry.sh      2020-03-10 
15:37:08.000000000 +0100
+++ new/drbd-9.0.23~1+git.d16bfab7/docker/entry.sh      2020-06-08 
15:56:55.000000000 +0200
@@ -36,6 +36,8 @@
        exit 0
 }
 
+HOW_DEPSONLY=deps_only
+
 HOW_REPOFILE=repo_file; HOW_HASH=node_hash; HOW_FROMSRC=compile; 
HOW_FROMSHIPPED=shipped_modules
 how_to_get() {
        local repo="$1"
@@ -188,7 +190,30 @@
        insmod ./drbd_transport_tcp.ko
 }
 
+modprobe_deps() {
+       # we are not too strict about these, not all are required everywhere
+       #
+       # libcrc32c: dependency for DRBD
+       # nvmet_rdma, nvme_rdma: LINSTOR NVME layer
+       # loop: LINSTOR when using loop devices as backing disks
+       # dm_writecache: LINSTOR writecache layer
+       # dm_cache: LINSTOR cache layer
+       # dm_thin_pool: LINSTOR thinly provisioned storage
+       # dm_snapshot: LINSTOR snapshotting
+
+       local s;
+       for m in libcrc32c nvmet_rdma nvme_rdma loop dm_writecache dm_cache 
dm_thin_pool dm_snapshot; do
+               modprobe "$m" 2>/dev/null && s=success || s=failed
+               debug "Loading ${m}: ${s}"
+       done
+
+       return 0
+}
+
 ### main
+modprobe_deps
+[[ $LB_HOW == "$HOW_DEPSONLY" ]] && { debug "dependencies loading only, 
exiting now"; exit 0; }
+
 grep -q '^drbd' /proc/modules && echo "DRBD module is already loaded" && 
print_version_and_exit
 
 pkgdir=/tmp/pkg
@@ -226,15 +251,13 @@
        *) die "$how_get" ;;
 esac
 
-modprobe libcrc32c
-
 how_load=$(how_to_load) || exit 1
 debug "Detected load method: \"$how_load\""
 if [[ $how_get == "$HOW_FROMSRC" ]] && [[ $how_load == "$HOW_INSTALL" ]]; then
        cd "$pkgdir" || die "Could not cd to $pkgdir"
        cd drbd-* || die "Could not cd to drbd src dir"
        make install
-       modprobe drbd
+       modprobe drbd usermode_helper=disabled
        modprobe drbd_transport_tcp
 else
        load_from_ram "$pkgdir" "$kodir"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/drbd-9.0.22~1+git.fe2b5983/drbd/Makefile 
new/drbd-9.0.23~1+git.d16bfab7/drbd/Makefile
--- old/drbd-9.0.22~1+git.fe2b5983/drbd/Makefile        2020-03-10 
15:37:08.000000000 +0100
+++ new/drbd-9.0.23~1+git.d16bfab7/drbd/Makefile        2020-06-08 
15:56:55.000000000 +0200
@@ -119,7 +119,8 @@
   .PHONY: compat.h
   compat.h:
        @touch dummy-for-compat-h.c
-       $(MAKE) -C $(KDIR)  $(if $(O),O=$(O),) M=$(DRBDSRC) $(ARCH_UM) 
dummy-for-compat-h.o
+       @mkdir .tmp_versions
+       $(MAKE) -C $(KDIR)  $(if $(O),O=$(O),) M=$(DRBDSRC) $(ARCH_UM) 
obj-m=dummy-for-compat-h.o dummy-for-compat-h.o
 
   kbuild: fix-tar-timestamps
        @rm -f .drbd_kernelrelease*
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd-kernel-compat/cocci/blk_queue_make_request__yes_present.cocci
 
new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd-kernel-compat/cocci/blk_queue_make_request__yes_present.cocci
--- 
old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd-kernel-compat/cocci/blk_queue_make_request__yes_present.cocci
      1970-01-01 01:00:00.000000000 +0100
+++ 
new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd-kernel-compat/cocci/blk_queue_make_request__yes_present.cocci
      2020-06-08 15:56:55.000000000 +0200
@@ -0,0 +1,16 @@
+@ rm_blk_alloc_queue @
+identifier make_request_fn;
+@@
+- blk_alloc_queue(make_request_fn, NUMA_NO_NODE)
++ blk_alloc_queue(GFP_KERNEL)
+
+@@
+identifier rm_blk_alloc_queue.make_request_fn;
+@@
+drbd_create_device(...)
+{
+       ...
++      blk_queue_make_request(q, make_request_fn);
+       blk_queue_write_cache(...);
+       ...
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd-kernel-compat/cocci/generic_start_io_acct__no_has_four_params.cocci
 
new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd-kernel-compat/cocci/generic_start_io_acct__no_has_four_params.cocci
--- 
old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd-kernel-compat/cocci/generic_start_io_acct__no_has_four_params.cocci
        1970-01-01 01:00:00.000000000 +0100
+++ 
new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd-kernel-compat/cocci/generic_start_io_acct__no_has_four_params.cocci
        2020-06-08 15:56:55.000000000 +0200
@@ -0,0 +1,11 @@
+@@
+expression q, rw, sect, part;
+@@
+(
+generic_start_io_acct
+|
+generic_end_io_acct
+)
+ (
+- q,
+rw, sect, part);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd-kernel-compat/cocci/generic_start_io_acct__no_present.cocci
 
new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd-kernel-compat/cocci/generic_start_io_acct__no_present.cocci
--- 
old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd-kernel-compat/cocci/generic_start_io_acct__no_present.cocci
        1970-01-01 01:00:00.000000000 +0100
+++ 
new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd-kernel-compat/cocci/generic_start_io_acct__no_present.cocci
        2020-06-08 15:56:55.000000000 +0200
@@ -0,0 +1,39 @@
+@@
+typedef atomic_t;
+@@
++/* ATTENTION: this is a compat implementation of generic_*_io_acct,
++ * added by a coccinelle patch.
++ * it is more likely to be broken than the upstream version is.
++ */
++static inline void generic_start_io_acct(struct request_queue *q,
++              int rw, unsigned long sects, struct hd_struct *part)
++{
++      int cpu;
++
++      cpu = part_stat_lock();
++      part_round_stats(cpu, part);
++      part_stat_inc(cpu, part, ios[rw]);
++      part_stat_add(cpu, part, sectors[rw], sects);
++      (void) cpu; /* The macro invocations above want the cpu argument, I do 
not like
++                     the compiler warning about cpu only assigned but never 
used... */
++      /* part_inc_in_flight(part, rw); */
++      { BUILD_BUG_ON(sizeof(atomic_t) != sizeof(part->in_flight[0])); }
++      atomic_inc((atomic_t*)&part->in_flight[rw]);
++      part_stat_unlock();
++}
++
++static inline void generic_end_io_acct(struct request_queue *q,
++              int rw, struct hd_struct *part, unsigned long start_time)
++{
++      unsigned long duration = jiffies - start_time;
++      int cpu;
++
++      cpu = part_stat_lock();
++      part_stat_add(cpu, part, ticks[rw], duration);
++      part_round_stats(cpu, part);
++      /* part_dec_in_flight(part, rw); */
++      atomic_dec((atomic_t*)&part->in_flight[rw]);
++      part_stat_unlock();
++}
+
+static void _drbd_start_io_acct(...) { ... }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd-kernel-compat/cocci/part_stat_h__no_present.cocci
 
new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd-kernel-compat/cocci/part_stat_h__no_present.cocci
--- 
old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd-kernel-compat/cocci/part_stat_h__no_present.cocci
  1970-01-01 01:00:00.000000000 +0100
+++ 
new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd-kernel-compat/cocci/part_stat_h__no_present.cocci
  2020-06-08 15:56:55.000000000 +0200
@@ -0,0 +1,3 @@
+@@
+@@
+- #include <linux/part_stat.h>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd-kernel-compat/cocci/struct_size__no_present.cocci
 
new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd-kernel-compat/cocci/struct_size__no_present.cocci
--- 
old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd-kernel-compat/cocci/struct_size__no_present.cocci
  1970-01-01 01:00:00.000000000 +0100
+++ 
new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd-kernel-compat/cocci/struct_size__no_present.cocci
  2020-06-08 15:56:55.000000000 +0200
@@ -0,0 +1,11 @@
+@ replace_struct_size @
+identifier p; // pointer to the structure
+identifier m; // name of the array member
+expression n; // number of elements in the array
+@@
+- struct_size(p, m, n)
++ sizeof(*p) + sizeof(*p->m) * n
+
+@ depends on replace_struct_size @
+@@
+- #include <linux/overflow.h>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd-kernel-compat/collect_compat_h.sh 
new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd-kernel-compat/collect_compat_h.sh
--- old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd-kernel-compat/collect_compat_h.sh  
2020-03-10 15:37:08.000000000 +0100
+++ new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd-kernel-compat/collect_compat_h.sh  
2020-06-08 15:56:55.000000000 +0200
@@ -18,8 +18,8 @@
 if [ "$(uname -n)" = "thank" ]; then
        FILES=$((cd $COMPAT_HEADERS_PATH; find . -name "compat.h*" \
                | tar -T - -czf -) | tar xzvf -)
-elif ping -c1 thank > /dev/null 2>&1; then
-       FILES=$(ssh lbbuild@thank \
+elif ping -c1 thank.linbit > /dev/null 2>&1; then
+       FILES=$(ssh [email protected] \
                "cd $COMPAT_HEADERS_PATH; find . -name "compat.h*" | tar -T - 
-czf -" \
                | tar xzvf -)
 else
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd-kernel-compat/drbd_wrappers.h 
new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd-kernel-compat/drbd_wrappers.h
--- old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd-kernel-compat/drbd_wrappers.h      
2020-03-10 15:37:08.000000000 +0100
+++ new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd-kernel-compat/drbd_wrappers.h      
2020-06-08 15:56:55.000000000 +0200
@@ -394,52 +394,6 @@
 #define list_next_rcu(list)    (*((struct list_head **)(&(list)->next)))
 #endif
 
-#if defined(COMPAT_HAVE_GENERIC_START_IO_ACCT_Q_RW_SECT_PART)
-/* void generic_start_io_acct(struct request_queue *q,
- *             int rw, unsigned long sectors, struct hd_struct *part); */
-#elif defined(COMPAT_HAVE_GENERIC_START_IO_ACCT_RW_SECT_PART)
-/* void generic_start_io_acct(
- *             int rw, unsigned long sectors, struct hd_struct *part); */
-#define generic_start_io_acct(q, rw, sect, part) generic_start_io_acct(rw, 
sect, part)
-#define generic_end_io_acct(q, rw, part, start) generic_end_io_acct(rw, part, 
start)
-
-#elif defined(__disk_stat_inc)
-/* too old, we don't care */
-#warning "io accounting disabled"
-#else
-
-static inline void generic_start_io_acct(struct request_queue *q,
-               int rw, unsigned long sectors, struct hd_struct *part)
-{
-       int cpu;
-
-       cpu = part_stat_lock();
-       part_round_stats(cpu, part);
-       part_stat_inc(cpu, part, ios[rw]);
-       part_stat_add(cpu, part, sectors[rw], sectors);
-       (void) cpu; /* The macro invocations above want the cpu argument, I do 
not like
-                      the compiler warning about cpu only assigned but never 
used... */
-       /* part_inc_in_flight(part, rw); */
-       { BUILD_BUG_ON(sizeof(atomic_t) != sizeof(part->in_flight[0])); }
-       atomic_inc((atomic_t*)&part->in_flight[rw]);
-       part_stat_unlock();
-}
-
-static inline void generic_end_io_acct(struct request_queue *q,
-               int rw, struct hd_struct *part, unsigned long start_time)
-{
-       unsigned long duration = jiffies - start_time;
-       int cpu;
-
-       cpu = part_stat_lock();
-       part_stat_add(cpu, part, ticks[rw], duration);
-       part_round_stats(cpu, part);
-       /* part_dec_in_flight(part, rw); */
-       atomic_dec((atomic_t*)&part->in_flight[rw]);
-       part_stat_unlock();
-}
-#endif /* __disk_stat_inc, COMPAT_HAVE_GENERIC_START_IO_ACCT ... */
-
 #ifndef COMPAT_HAVE_SIMPLE_POSITIVE
 #include <linux/dcache.h>
 static inline int simple_positive(struct dentry *dentry)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd-kernel-compat/gen_compat_patch.sh 
new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd-kernel-compat/gen_compat_patch.sh
--- old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd-kernel-compat/gen_compat_patch.sh  
2020-03-10 15:37:08.000000000 +0100
+++ new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd-kernel-compat/gen_compat_patch.sh  
2020-06-08 15:56:55.000000000 +0200
@@ -111,6 +111,15 @@
     echo "  be patient, may take up to 10 minutes"
     echo "  if it is in the server side cache it might only take a second"
     echo "  SPAAS    $chksum"
+
+    # check if SPAAS is even reachable
+    if ! curl -fsS https://drbd.io:2020/api/v1/hello; then
+        echo "  ERROR: SPAAS is not reachable! Please check if your network"
+        echo "  configuration or some firewall prohibits access to "
+        echo "  https://drbd.io:2020.";
+        exit 1
+    fi
+
     REL_VERSION=$(sed -ne '/^\#define REL_VERSION/{s/^[^"]*"\([^ 
"]*\).*/\1/;p;q;}' linux/drbd_config.h)
     rm -f $compat_patch.tmp.header $compat_patch.tmp
     if ! base64 $incdir/compat.h |
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd-kernel-compat/gen_patch_names.c 
new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd-kernel-compat/gen_patch_names.c
--- old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd-kernel-compat/gen_patch_names.c    
2020-03-10 15:37:08.000000000 +0100
+++ new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd-kernel-compat/gen_patch_names.c    
2020-06-08 15:56:55.000000000 +0200
@@ -127,6 +127,9 @@
        patch(1, "req_hardbarrier", false, true,
              COMPAT_HAVE_REQ_HARDBARRIER, "present");
 
+       patch(1, "blk_queue_make_request", false, true,
+             COMPAT_HAVE_BLK_QUEUE_MAKE_REQUEST, "present");
+
 #ifndef COMPAT_HAVE_BLK_QC_T_MAKE_REQUEST
        patch(2, "make_request", false, false,
              COMPAT_HAVE_BLK_QC_T_MAKE_REQUEST, "is_blk_qc_t",
@@ -296,6 +299,24 @@
        patch(1, "allow_kernel_signal", true, false,
              COMPAT_HAVE_ALLOW_KERNEL_SIGNAL, "present");
 
+       patch(1, "struct_size", true, false,
+             COMPAT_HAVE_STRUCT_SIZE, "present");
+
+#if defined(COMPAT_HAVE_GENERIC_START_IO_ACCT_Q_RW_SECT_PART)
+       /* good, newest version */
+#elif defined(COMPAT_HAVE_GENERIC_START_IO_ACCT_RW_SECT_PART)
+       /* older version */
+       patch(1, "generic_start_io_acct", true, false,
+             NO, "has_four_params");
+#else
+       /* not present at all */
+       patch(1, "generic_start_io_acct", true, false,
+             NO, "present");
+#endif
+
+       patch(1, "part_stat_h", true, false,
+             COMPAT_HAVE_PART_STAT_H, "present");
+
 /* #define BLKDEV_ISSUE_ZEROOUT_EXPORTED */
 /* #define BLKDEV_ZERO_NOUNMAP */
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd-kernel-compat/tests/have_blk_qc_t_make_request.c
 
new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd-kernel-compat/tests/have_blk_qc_t_make_request.c
--- 
old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd-kernel-compat/tests/have_blk_qc_t_make_request.c
   2020-03-10 15:37:08.000000000 +0100
+++ 
new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd-kernel-compat/tests/have_blk_qc_t_make_request.c
   2020-06-08 15:56:55.000000000 +0200
@@ -19,7 +19,5 @@
 
 void foo(void)
 {
-       struct request_queue *q = NULL;
-       blk_queue_make_request(q, drbd_make_request);
        BUILD_BUG_ON(!(__same_type(drbd_make_request, make_request_fn)));
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd-kernel-compat/tests/have_blk_queue_make_request.c
 
new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd-kernel-compat/tests/have_blk_queue_make_request.c
--- 
old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd-kernel-compat/tests/have_blk_queue_make_request.c
  1970-01-01 01:00:00.000000000 +0100
+++ 
new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd-kernel-compat/tests/have_blk_queue_make_request.c
  2020-06-08 15:56:55.000000000 +0200
@@ -0,0 +1,8 @@
+/* { "version": "v5.6-rc7", "commit": 
"3d745ea5b095a3985129e162900b7e6c22518a9d", "comment": "blk_queue_make_request 
was removed, users should now pass the make_request function to 
blk_alloc_queue", "author": "Christoph Hellwig <[email protected]>", "date": "Fri Mar 
27 09:30:11 2020 +0100" } */
+
+#include <linux/blkdev.h>
+
+void foo(void)
+{
+       blk_queue_make_request(NULL, NULL);
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd-kernel-compat/tests/have_part_stat_h.c 
new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd-kernel-compat/tests/have_part_stat_h.c
--- 
old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd-kernel-compat/tests/have_part_stat_h.c 
    1970-01-01 01:00:00.000000000 +0100
+++ 
new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd-kernel-compat/tests/have_part_stat_h.c 
    2020-06-08 15:56:55.000000000 +0200
@@ -0,0 +1,3 @@
+/* { "version": "v5.6-rc6", "commit": 
"c6a564ffadc9105880329710164ee493f0de103c", "comment": "The part_stat* helpers 
were moved to a new header", "author": "Christoph Hellwig <[email protected]>", 
"date": "Wed Mar 25 16:48:42 2020 +0100" } */
+
+#include <linux/part_stat.h>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd-kernel-compat/tests/have_struct_size.c 
new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd-kernel-compat/tests/have_struct_size.c
--- 
old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd-kernel-compat/tests/have_struct_size.c 
    1970-01-01 01:00:00.000000000 +0100
+++ 
new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd-kernel-compat/tests/have_struct_size.c 
    2020-06-08 15:56:55.000000000 +0200
@@ -0,0 +1,14 @@
+/* {"version":"4.17", "commit": "610b15c50e86eb1e4b77274fabcaea29ac72d6a8", 
"comment": "Since Linux 4.17, struct_size should be used to get the size of a 
struct with a trailing array", "author": "Kees Cook <[email protected]>", 
"date": "Mon May 7 16:47:02 2018 -0700" } */
+#include <linux/module.h>
+#include <linux/overflow.h>
+
+struct x {
+       int some;
+       int values[];
+};
+
+void foo(void)
+{
+       struct x *p;
+       struct_size(p, values, 1);
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd-kernel-compat/tests/have_void_make_request.c
 
new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd-kernel-compat/tests/have_void_make_request.c
--- 
old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd-kernel-compat/tests/have_void_make_request.c
       2020-03-10 15:37:08.000000000 +0100
+++ 
new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd-kernel-compat/tests/have_void_make_request.c
       2020-06-08 15:56:55.000000000 +0200
@@ -19,7 +19,5 @@
 
 void foo(void)
 {
-       struct request_queue *q = NULL;
-       blk_queue_make_request(q, drbd_make_request);
        BUILD_BUG_ON(!(__same_type(drbd_make_request, make_request_fn)));
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd_int.h 
new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd_int.h
--- old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd_int.h      2020-03-10 
15:37:08.000000000 +0100
+++ new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd_int.h      2020-06-08 
15:56:55.000000000 +0200
@@ -536,6 +536,7 @@
        STABLE_RESYNC,          /* One peer_device finished the resync stable! 
*/
        READ_BALANCE_RR,
        PRIMARY_LOST_QUORUM,
+       TIEBREAKER_QUORUM,      /* Tiebreaker keeps quorum; used to avoid too 
verbose logging */
        DESTROYING_DEV,
 };
 
@@ -724,7 +725,7 @@
        int total; /* sum of all values */
        int values[0];
 };
-extern struct fifo_buffer *fifo_alloc(int fifo_size);
+extern struct fifo_buffer *fifo_alloc(unsigned int fifo_size);
 
 /* flag bits per connection */
 enum connection_flag {
@@ -1264,12 +1265,6 @@
        unsigned long last_reattach_jif;
        struct timer_list md_sync_timer;
        struct timer_list request_timer;
-#ifdef DRBD_DEBUG_MD_SYNC
-       struct {
-               unsigned int line;
-               const char* func;
-       } last_md_mark_dirty;
-#endif
 
        enum drbd_disk_state disk_state[2];
        wait_queue_head_t misc_wait;
@@ -1549,13 +1544,7 @@
 extern void drbd_md_set_peer_flag(struct drbd_peer_device *, enum 
mdf_peer_flag);
 extern void drbd_md_clear_peer_flag(struct drbd_peer_device *, enum 
mdf_peer_flag);
 extern bool drbd_md_test_peer_flag(struct drbd_peer_device *, enum 
mdf_peer_flag);
-#ifndef DRBD_DEBUG_MD_SYNC
 extern void drbd_md_mark_dirty(struct drbd_device *device);
-#else
-#define drbd_md_mark_dirty(m)  drbd_md_mark_dirty_(m, __LINE__ , __func__ )
-extern void drbd_md_mark_dirty_(struct drbd_device *device,
-               unsigned int line, const char *func);
-#endif
 extern void drbd_queue_bitmap_io(struct drbd_device *,
                                 int (*io_fn)(struct drbd_device *, struct 
drbd_peer_device *),
                                 void (*done)(struct drbd_device *, struct 
drbd_peer_device *, int),
@@ -1572,6 +1561,7 @@
 extern int drbd_bmio_set_n_write(struct drbd_device *device, struct 
drbd_peer_device *) __must_hold(local);
 extern int drbd_bmio_clear_all_n_write(struct drbd_device *device, struct 
drbd_peer_device *) __must_hold(local);
 extern int drbd_bmio_set_all_n_write(struct drbd_device *device, struct 
drbd_peer_device *) __must_hold(local);
+extern int drbd_bmio_set_allocated_n_write(struct drbd_device *,struct 
drbd_peer_device *) __must_hold(local);
 extern bool drbd_device_stable(struct drbd_device *device, u64 *authoritative);
 extern void drbd_flush_peer_acks(struct drbd_resource *resource);
 extern void drbd_cork(struct drbd_connection *connection, enum drbd_stream 
stream);
@@ -2260,13 +2250,6 @@
        }
 }
 
-static inline int drbd_backing_bdev_events(struct drbd_device *device)
-{
-       struct hd_struct *part = 
&device->ldev->backing_bdev->bd_contains->bd_disk->part0;
-       return (int)part_stat_read(part, sectors[0])
-            + (int)part_stat_read(part, sectors[1]);
-}
-
 /**
  * drbd_md_first_sector() - Returns the first sector number of the meta data 
area
  * @bdev:      Meta data block device.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd_main.c 
new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd_main.c
--- old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd_main.c     2020-03-10 
15:37:08.000000000 +0100
+++ new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd_main.c     2020-06-08 
15:56:55.000000000 +0200
@@ -1411,6 +1411,7 @@
 static int _drbd_send_uuids110(struct drbd_peer_device *peer_device, u64 
uuid_flags, u64 node_mask)
 {
        struct drbd_device *device = peer_device->device;
+       const int my_node_id = device->resource->res_opts.node_id;
        struct drbd_peer_md *peer_md;
        struct p_uuids110 *p;
        bool sent_one_unallocated;
@@ -1440,7 +1441,8 @@
        for (i = 0; i < DRBD_NODE_ID_MAX; i++) {
                bool send_this =
                        peer_md[i].flags & MDF_HAVE_BITMAP || peer_md[i].flags 
& MDF_NODE_EXISTS;
-               if (!send_this && !sent_one_unallocated) {
+               if (!send_this && !sent_one_unallocated &&
+                   i != my_node_id && i != peer_device->node_id) {
                        send_this = true;
                        sent_one_unallocated = true;
                }
@@ -2879,7 +2881,7 @@
 static void free_peer_device(struct drbd_peer_device *peer_device)
 {
        if (test_and_clear_bit(HOLDING_UUID_READ_LOCK, &peer_device->flags))
-               up_read(&peer_device->device->uuid_sem);
+               up_read_non_owner(&peer_device->device->uuid_sem);
 
        lc_destroy(peer_device->resync_lru);
        kfree(peer_device->rs_plan_s);
@@ -3696,7 +3698,7 @@
 
        init_rwsem(&device->uuid_sem);
 
-       q = blk_alloc_queue(GFP_KERNEL);
+       q = blk_alloc_queue(drbd_make_request, NUMA_NO_NODE);
        if (!q)
                goto out_no_q;
        device->rq_queue = q;
@@ -3720,7 +3722,6 @@
 
        init_bdev_info(q->backing_dev_info, drbd_congested, device);
 
-       blk_queue_make_request(q, drbd_make_request);
        blk_queue_write_cache(q, true, true);
 
        device->md_io.page = alloc_page(GFP_KERNEL);
@@ -4489,22 +4490,11 @@
  * the meta-data super block. This function sets MD_DIRTY, and starts a
  * timer that ensures that within five seconds you have to call drbd_md_sync().
  */
-#ifdef DRBD_DEBUG_MD_SYNC
-void drbd_md_mark_dirty_(struct drbd_device *device, unsigned int line, const 
char *func)
-{
-       if (!test_and_set_bit(MD_DIRTY, &device->flags)) {
-               mod_timer(&device->md_sync_timer, jiffies + HZ);
-               device->last_md_mark_dirty.line = line;
-               device->last_md_mark_dirty.func = func;
-       }
-}
-#else
 void drbd_md_mark_dirty(struct drbd_device *device)
 {
        if (!test_and_set_bit(MD_DIRTY, &device->flags))
                mod_timer(&device->md_sync_timer, jiffies + 5*HZ);
 }
-#endif
 
 void _drbd_uuid_push_history(struct drbd_device *device, u64 val) 
__must_hold(local)
 {
@@ -4724,6 +4714,7 @@
        struct drbd_peer_device *peer_device;
        u64 got_new_bitmap_uuid, weak_nodes, val, old_current_uuid;
        int err;
+       u64 im;
 
        down_write(&device->uuid_sem);
        spin_lock_irq(&device->ldev->md.uuid_lock);
@@ -4759,7 +4750,7 @@
        if (!send)
                goto out;
 
-       for_each_peer_device(peer_device, device) {
+       for_each_peer_device_ref(peer_device, im, device) {
                if (peer_device->repl_state[NOW] >= L_ESTABLISHED)
                        drbd_send_uuids(peer_device, forced ? 0 : 
UUID_FLAG_NEW_DATAGEN, weak_nodes);
        }
@@ -4842,7 +4833,6 @@
  *
  * Creates a new current UUID, and rotates the old current UUID into
  * the bitmap slot. Causes an incremental resync upon next connect.
- * The caller must hold adm_mutex or conf_update
  */
 void drbd_uuid_new_current(struct drbd_device *device, bool forced)
 {
@@ -5298,7 +5288,7 @@
  * drbd_bmio_set_n_write() - io_fn for drbd_queue_bitmap_io() or 
drbd_bitmap_io()
  * @device:    DRBD device.
  *
- * Sets all bits in the bitmap and writes the whole bitmap to stable storage.
+ * Sets all bits in the bitmap towards one peer and writes the whole bitmap to 
stable storage.
  */
 int drbd_bmio_set_n_write(struct drbd_device *device,
                          struct drbd_peer_device *peer_device) 
__must_hold(local)
@@ -5318,6 +5308,33 @@
 
        return rv;
 }
+
+/**
+ * drbd_bmio_set_allocated_n_write() - io_fn for drbd_queue_bitmap_io() or 
drbd_bitmap_io()
+ * @device:    DRBD device.
+ *
+ * Sets all bits in all allocated bitmap slots and writes it to stable storage.
+ */
+int drbd_bmio_set_allocated_n_write(struct drbd_device *device,
+                                   struct drbd_peer_device *peer_device) 
__must_hold(local)
+{
+       const int my_node_id = device->resource->res_opts.node_id;
+       struct drbd_md *md = &device->ldev->md;
+       int rv = -EIO;
+       int node_id, bitmap_index;
+
+       for (node_id = 0; node_id < DRBD_NODE_ID_MAX; node_id++) {
+               if (node_id == my_node_id)
+                       continue;
+               bitmap_index = md->peers[node_id].bitmap_index;
+               if (bitmap_index == -1)
+                       continue;
+               _drbd_bm_set_many_bits(device, bitmap_index, 0, -1UL);
+       }
+       rv = drbd_bm_write(device, NULL);
+
+       return rv;
+}
 
 /**
  * drbd_bmio_clear_all_n_write() - io_fn for drbd_queue_bitmap_io() or 
drbd_bitmap_io()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd_nl.c 
new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd_nl.c
--- old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd_nl.c       2020-03-10 
15:37:08.000000000 +0100
+++ new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd_nl.c       2020-06-08 
15:56:55.000000000 +0200
@@ -351,7 +351,7 @@
        /* some more paranoia, if the request was over-determined */
        if (adm_ctx->device && adm_ctx->resource &&
            adm_ctx->device->resource != adm_ctx->resource) {
-               pr_warning("request: minor=%u, resource=%s; but that minor 
belongs to resource %s\n",
+               pr_warn("request: minor=%u, resource=%s; but that minor belongs 
to resource %s\n",
                                adm_ctx->minor, adm_ctx->resource->name,
                                adm_ctx->device->resource->name);
                drbd_msg_put_info(adm_ctx->reply_skb, "minor exists in 
different resource");
@@ -361,7 +361,7 @@
        if (adm_ctx->device &&
            adm_ctx->volume != VOLUME_UNSPECIFIED &&
            adm_ctx->volume != adm_ctx->device->vnr) {
-               pr_warning("request: minor=%u, volume=%u; but that minor is 
volume %u in %s\n",
+               pr_warn("request: minor=%u, volume=%u; but that minor is volume 
%u in %s\n",
                                adm_ctx->minor, adm_ctx->volume,
                                adm_ctx->device->vnr,
                                adm_ctx->device->resource->name);
@@ -373,7 +373,7 @@
            adm_ctx->resource && adm_ctx->resource->name &&
            adm_ctx->peer_device->device != adm_ctx->device) {
                drbd_msg_put_info(adm_ctx->reply_skb, "peer_device->device != 
device");
-               pr_warning("request: minor=%u, resource=%s, volume=%u, 
peer_node=%u; device != peer_device->device\n",
+               pr_warn("request: minor=%u, resource=%s, volume=%u, 
peer_node=%u; device != peer_device->device\n",
                                adm_ctx->minor, adm_ctx->resource->name,
                                adm_ctx->device->vnr, adm_ctx->peer_node_id);
                err = ERR_INVALID_REQUEST;
@@ -3492,7 +3492,7 @@
                              struct fifo_buffer **pp_old_plan)
 {
        struct fifo_buffer *old_plan, *new_plan = NULL;
-       int fifo_size;
+       unsigned int fifo_size;
 
        fifo_size = (conf->c_plan_ahead * 10 * RS_MAKE_REQS_INTV) / HZ;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd_receiver.c 
new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd_receiver.c
--- old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd_receiver.c 2020-03-10 
15:37:08.000000000 +0100
+++ new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd_receiver.c 2020-06-08 
15:56:55.000000000 +0200
@@ -31,11 +31,13 @@
 #include <linux/vmalloc.h>
 #include <linux/random.h>
 #include <net/ipv6.h>
+#include <linux/scatterlist.h>
+#include <linux/part_stat.h>
+
 #include "drbd_int.h"
 #include "drbd_protocol.h"
 #include "drbd_req.h"
 #include "drbd_vli.h"
-#include <linux/scatterlist.h>
 
 #define PRO_FEATURES 
(DRBD_FF_TRIM|DRBD_FF_THIN_RESYNC|DRBD_FF_WSAME|DRBD_FF_WZEROES)
 
@@ -675,12 +677,8 @@
        err = drbd_send_sync_param(peer_device);
        if (!err)
                err = drbd_send_sizes(peer_device, 0, 0);
-       if (!err) {
-               down_read(&device->uuid_sem);
-               set_bit(HOLDING_UUID_READ_LOCK, &peer_device->flags);
-
+       if (!err)
                err = drbd_send_uuids(peer_device, 0, weak_nodes);
-       }
        if (!err) {
                set_bit(INITIAL_STATE_SENT, &peer_device->flags);
                err = drbd_send_current_state(peer_device);
@@ -717,7 +715,13 @@
                kref_get(&device->kref);
                /* connection cannot go away: caller holds a reference. */
                rcu_read_unlock();
+
+               down_read_non_owner(&device->uuid_sem);
+               set_bit(HOLDING_UUID_READ_LOCK, &peer_device->flags);
+               /* since drbd_connected() is also called from 
drbd_create_device()
+                  aquire lock here before calling drbd_connected(). */
                drbd_connected(peer_device);
+
                rcu_read_lock();
                kref_put(&device->kref, drbd_destroy_device);
        }
@@ -863,8 +867,6 @@
                }
        }
 
-       transport->ops->set_rcvtimeo(transport, DATA_STREAM, 
MAX_SCHEDULE_TIMEOUT);
-
        discard_my_data = test_bit(CONN_DISCARD_MY_DATA, &connection->flags);
 
        if (__drbd_send_protocol(connection, P_PROTOCOL) == -EOPNOTSUPP)
@@ -3113,6 +3115,7 @@
 bool drbd_rs_c_min_rate_throttle(struct drbd_peer_device *peer_device)
 {
        struct drbd_device *device = peer_device->device;
+       struct hd_struct *part = 
&device->ldev->backing_bdev->bd_contains->bd_disk->part0;
        unsigned long db, dt, dbdt;
        unsigned int c_min_rate;
        int curr_events;
@@ -3125,8 +3128,9 @@
        if (c_min_rate == 0)
                return false;
 
-       curr_events = drbd_backing_bdev_events(device)
-                   - atomic_read(&device->rs_sect_ev);
+       curr_events = (int)part_stat_read(part, sectors[0])
+               + (int)part_stat_read(part, sectors[1])
+               - atomic_read(&device->rs_sect_ev);
 
        if (atomic_read(&device->ap_actlog_cnt) || curr_events - 
peer_device->rs_last_events > 64) {
                unsigned long rs_left;
@@ -3809,6 +3813,7 @@
        int i, j;
        bool initial_handshake;
        bool uuid_matches_initial;
+       bool flags_matches_initial;
 
        self = drbd_current_uuid(device) & ~UUID_PRIMARY;
        peer = peer_device->current_uuid & ~UUID_PRIMARY;
@@ -3820,13 +3825,18 @@
        initial_handshake =
                test_bit(INITIAL_STATE_SENT, &peer_device->flags) &&
                !test_bit(INITIAL_STATE_RECEIVED, &peer_device->flags);
-       uuid_matches_initial =
-               self == (peer_device->comm_current_uuid & ~UUID_PRIMARY) &&
-               local_uuid_flags == peer_device->comm_uuid_flags;
-       if (initial_handshake && !uuid_matches_initial) {
+       uuid_matches_initial = self == (peer_device->comm_current_uuid & 
~UUID_PRIMARY);
+       flags_matches_initial = local_uuid_flags == 
peer_device->comm_uuid_flags;
+       if (initial_handshake && (!uuid_matches_initial || 
!flags_matches_initial)) {
                *rule_nr = 9;
-               drbd_warn(peer_device, "My current UUID/flags changed during "
-                         "handshake. Retry connecting.\n");
+               if (!uuid_matches_initial)
+                       drbd_warn(peer_device, "My current UUID changed during "
+                                 "handshake. Retry connecting.\n");
+               if (!flags_matches_initial)
+                       drbd_warn(peer_device, "My uuid_flags changed from 
0x%llX to 0x%llX during "
+                                 "handshake. Retry connecting.\n",
+                                 (unsigned long 
long)peer_device->comm_uuid_flags,
+                                 (unsigned long long)local_uuid_flags);
                return RETRY_CONNECT;
        }
 
@@ -4050,6 +4060,13 @@
 {
        struct drbd_device *device = peer_device->device;
 
+       /* reduce contention by giving up uuid_sem before taking bitmap locks */
+       if (test_and_clear_bit(HOLDING_UUID_READ_LOCK, &peer_device->flags)) {
+               struct drbd_transport *transport = 
&peer_device->connection->transport;
+               up_read_non_owner(&device->uuid_sem);
+               transport->ops->set_rcvtimeo(transport, DATA_STREAM, 
MAX_SCHEDULE_TIMEOUT);
+       }
+
        if (strategy == SYNC_SOURCE_COPY_BITMAP) {
                int from = device->ldev->md.peers[peer_node_id].bitmap_index;
 
@@ -4086,15 +4103,24 @@
                drbd_bm_slot_unlock(peer_device);
                drbd_resume_io(device);
        } else if (strategy == SYNC_SOURCE_SET_BITMAP || strategy == 
SYNC_TARGET_SET_BITMAP) {
+               int (*io_func)(struct drbd_device *, struct drbd_peer_device *);
+               int err;
+
                if (strategy == SYNC_TARGET_SET_BITMAP &&
                    drbd_current_uuid(device) == UUID_JUST_CREATED &&
                    is_resync_running(device))
                        return 0;
 
-               drbd_info(peer_device,
-                         "Writing the whole bitmap, full sync required after 
drbd_sync_handshake.\n");
-               if (drbd_bitmap_io(device, &drbd_bmio_set_n_write, "set_n_write 
from sync_handshake",
-                                       BM_LOCK_CLEAR | BM_LOCK_BULK, 
peer_device))
+               if (drbd_current_uuid(device) == UUID_JUST_CREATED) {
+                       drbd_info(peer_device, "Setting and writing the whole 
bitmap, fresh node\n");
+                       io_func = &drbd_bmio_set_allocated_n_write;
+               } else {
+                       drbd_info(peer_device, "Setting and writing one bitmap 
slot, after drbd_sync_handshake\n");
+                       io_func = &drbd_bmio_set_n_write;
+               }
+               err = drbd_bitmap_io(device, io_func, "set_n_write 
sync_handshake",
+                                    BM_LOCK_CLEAR | BM_LOCK_BULK, peer_device);
+               if (err)
                        return -1;
        }
        return 0;
@@ -4562,7 +4588,7 @@
        const int apv = connection->agreed_pro_version;
        struct fifo_buffer *old_plan = NULL, *new_plan = NULL;
        struct drbd_resource *resource = connection->resource;
-       int fifo_size = 0;
+       unsigned int fifo_size = 0;
        int err;
 
        peer_device = conn_peer_device(connection, pi->vnr);
@@ -5211,6 +5237,7 @@
 {
        enum drbd_repl_state repl_state = peer_device->repl_state[NOW];
        struct drbd_device *device = peer_device->device;
+       struct drbd_resource *resource = device->resource;
        int updated_uuids = 0, err = 0;
        bool bad_server;
 
@@ -5282,8 +5309,9 @@
        } else if (device->disk_state[NOW] < D_INCONSISTENT &&
                   repl_state >= L_ESTABLISHED &&
                   peer_device->disk_state[NOW] == D_UP_TO_DATE &&
-                  peer_device->current_uuid != device->exposed_data_uuid) {
-               struct drbd_resource *resource = device->resource;
+                  peer_device->current_uuid != device->exposed_data_uuid &&
+                  (resource->role[NOW] == R_SECONDARY ||
+                   test_and_clear_bit(NEW_CUR_UUID, &device->flags))) {
 
                spin_lock_irq(&resource->req_lock);
                if (resource->remote_state_change) {
@@ -5603,6 +5631,22 @@
        return SS_SUCCESS;
 }
 
+static union drbd_state
+sanitize_outdate(struct drbd_peer_device *peer_device,
+                union drbd_state mask,
+                union drbd_state val)
+{
+       struct drbd_device *device = peer_device->device;
+       union drbd_state result_mask = mask;
+
+       if (val.pdsk == D_OUTDATED && peer_device->disk_state[NEW] < D_OUTDATED)
+               result_mask.pdsk = 0;
+       if (val.disk == D_OUTDATED && device->disk_state[NEW] < D_OUTDATED)
+               result_mask.disk = 0;
+
+       return result_mask;
+}
+
 /**
  * change_connection_state()  -  change state of a connection and all its peer 
devices
  *
@@ -5622,13 +5666,17 @@
        enum drbd_state_rv rv;
        int vnr;
        long t = resource->res_opts.auto_promote_timeout * HZ / 10;
+       bool is_disconnect;
 
+       is_disconnect = mask.conn && val.conn == C_DISCONNECTING;
        mask = convert_state(mask);
        val = convert_state(val);
 retry:
        begin_state_change(resource, &irq_flags, flags & ~CS_VERBOSE);
        idr_for_each_entry(&connection->peer_devices, peer_device, vnr) {
-               rv = __change_peer_device_state(peer_device, mask, val);
+               union drbd_state l_mask;
+               l_mask = is_disconnect ? sanitize_outdate(peer_device, mask, 
val) : mask;
+               rv = __change_peer_device_state(peer_device, l_mask, val);
                if (rv < SS_SUCCESS)
                        goto fail;
        }
@@ -6769,7 +6817,7 @@
         */
        if (peer_was_resync_target &&
            (old_peer_state.pdsk == D_INCONSISTENT || old_peer_state.pdsk == 
D_CONSISTENT) &&
-           old_peer_state.conn > L_ESTABLISHED && old_peer_state.disk >= 
D_OUTDATED) {
+           old_peer_state.conn > L_ESTABLISHED && old_peer_state.disk >= 
D_INCONSISTENT) {
                /* If we are (becoming) SyncSource, but peer is still in sync
                 * preparation, ignore its uptodate-ness to avoid flapping, it
                 * will change to inconsistent once the peer reaches active
@@ -6930,8 +6978,12 @@
 
        /* This is after the point where we did UUID comparison and joined with 
the
           diskless case again. Releasing uuid_sem here */
-       if (test_and_clear_bit(HOLDING_UUID_READ_LOCK, &peer_device->flags))
-               up_read(&device->uuid_sem);
+       if (test_and_clear_bit(HOLDING_UUID_READ_LOCK, &peer_device->flags)) {
+               struct drbd_transport *transport = &connection->transport;
+               up_read_non_owner(&device->uuid_sem);
+               /* Last packet of handshake received, disarm receive timeout */
+               transport->ops->set_rcvtimeo(transport, DATA_STREAM, 
MAX_SCHEDULE_TIMEOUT);
+       }
 
        spin_lock_irq(&resource->req_lock);
        begin_state_change_locked(resource, begin_state_chg_flags);
@@ -6966,9 +7018,7 @@
 
                drbd_err(device, "Aborting Connect, can not thaw IO with an 
only Consistent peer\n");
                tl_walk(connection, CONNECTION_LOST_WHILE_PENDING);
-               mutex_lock(&resource->conf_update);
                drbd_uuid_new_current(device, false);
-               mutex_unlock(&resource->conf_update);
                begin_state_change(resource, &irq_flags, CS_HARD);
                __change_cstate(connection, C_PROTOCOL_ERROR);
                __change_io_susp_user(resource, false);
@@ -7248,6 +7298,7 @@
 static int receive_bitmap(struct drbd_connection *connection, struct 
packet_info *pi)
 {
        struct drbd_peer_device *peer_device;
+       enum drbd_repl_state repl_state;
        struct drbd_device *device;
        struct bm_xfer_ctx c;
        int err;
@@ -7317,33 +7368,38 @@
 
        INFO_bm_xfer_stats(peer_device, "receive", &c);
 
-       if (peer_device->repl_state[NOW] == L_WF_BITMAP_T) {
-               enum drbd_state_rv rv;
-
+       repl_state = peer_device->repl_state[NOW];
+       if (repl_state == L_WF_BITMAP_T) {
                err = drbd_send_bitmap(device, peer_device);
                if (err)
                        goto out;
-               /* Omit CS_WAIT_COMPLETE and CS_SERIALIZE with this state
-                * transition to avoid deadlocks. */
+       }
+
+       drbd_bm_slot_unlock(peer_device);
 
+       if (repl_state == L_WF_BITMAP_S) {
+               drbd_start_resync(peer_device, L_SYNC_SOURCE);
+       } else if (repl_state == L_WF_BITMAP_T) {
                if (connection->agreed_pro_version < 110) {
+                       enum drbd_state_rv rv;
+
+                       /* Omit CS_WAIT_COMPLETE and CS_SERIALIZE with this 
state
+                        * transition to avoid deadlocks. */
                        rv = stable_change_repl_state(peer_device, 
L_WF_SYNC_UUID, CS_VERBOSE);
                        D_ASSERT(device, rv == SS_SUCCESS);
                } else {
                        drbd_start_resync(peer_device, L_SYNC_TARGET);
                }
-       } else if (peer_device->repl_state[NOW] != L_WF_BITMAP_S) {
+       } else {
                /* admin may have requested C_DISCONNECTING,
                 * other threads may have noticed network errors */
                drbd_info(peer_device, "unexpected repl_state (%s) in 
receive_bitmap\n",
-                   drbd_repl_str(peer_device->repl_state[NOW]));
+                         drbd_repl_str(repl_state));
        }
-       err = 0;
 
+       return 0;
  out:
        drbd_bm_slot_unlock(peer_device);
-       if (!err && peer_device->repl_state[NOW] == L_WF_BITMAP_S)
-               drbd_start_resync(peer_device, L_SYNC_SOURCE);
        return err;
 }
 
@@ -7823,7 +7879,7 @@
        struct drbd_device *device = peer_device->device;
 
        if (test_and_clear_bit(HOLDING_UUID_READ_LOCK, &peer_device->flags))
-               up_read(&device->uuid_sem);
+               up_read_non_owner(&device->uuid_sem);
 
        /* need to do it again, drbd_finish_peer_reqs() may have populated it
         * again via drbd_try_clear_on_disk_bm(). */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd_req.c 
new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd_req.c
--- old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd_req.c      2020-03-10 
15:37:08.000000000 +0100
+++ new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd_req.c      2020-06-08 
15:56:55.000000000 +0200
@@ -1036,7 +1036,8 @@
                break;
 
        case NEG_ACKED:
-               mod_rq_state(req, m, peer_device, RQ_NET_OK|RQ_NET_PENDING, 0);
+               mod_rq_state(req, m, peer_device, RQ_NET_OK|RQ_NET_PENDING,
+                            (req->local_rq_state & RQ_WRITE) ? 0 : 
RQ_NET_DONE);
                break;
 
        case COMPLETION_RESUMED:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd_sender.c 
new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd_sender.c
--- old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd_sender.c   2020-03-10 
15:37:08.000000000 +0100
+++ new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd_sender.c   2020-06-08 
15:56:55.000000000 +0200
@@ -22,6 +22,8 @@
 #include <linux/slab.h>
 #include <linux/random.h>
 #include <linux/scatterlist.h>
+#include <linux/overflow.h>
+#include <linux/part_stat.h>
 
 #include "drbd_int.h"
 #include "drbd_protocol.h"
@@ -526,11 +528,11 @@
                fb->values[i] += value;
 }
 
-struct fifo_buffer *fifo_alloc(int fifo_size)
+struct fifo_buffer *fifo_alloc(unsigned int fifo_size)
 {
        struct fifo_buffer *fb;
 
-       fb = kzalloc(sizeof(struct fifo_buffer) + sizeof(int) * fifo_size, 
GFP_NOIO);
+       fb = kzalloc(struct_size(fb, values, fifo_size), GFP_NOIO);
        if (!fb)
                return NULL;
 
@@ -1867,13 +1869,14 @@
 void drbd_rs_controller_reset(struct drbd_peer_device *peer_device)
 {
        struct fifo_buffer *plan;
+       struct hd_struct *part = 
&peer_device->device->ldev->backing_bdev->bd_contains->bd_disk->part0;
 
        atomic_set(&peer_device->rs_sect_in, 0);
        atomic_set(&peer_device->device->rs_sect_ev, 0);  /* FIXME: ??? */
        peer_device->rs_last_mk_req_kt = ktime_get();
        peer_device->rs_in_flight = 0;
-       peer_device->rs_last_events =
-               drbd_backing_bdev_events(peer_device->device);
+       peer_device->rs_last_events = (int)part_stat_read(part, sectors[0])
+               + (int)part_stat_read(part, sectors[1]);
 
        /* Updating the RCU protected object in place is necessary since
           this function gets called from atomic context.
@@ -2032,6 +2035,22 @@
 
 skip_helper:
 
+       if (side == L_SYNC_TARGET && drbd_current_uuid(device) == 
UUID_JUST_CREATED) {
+               /* prepare to continue an interrupted initial resync later */
+               if (get_ldev(device)) {
+                       const int my_node_id = 
device->resource->res_opts.node_id;
+                       u64 peer_bitmap_uuid = 
peer_device->bitmap_uuids[my_node_id];
+
+                       if (peer_bitmap_uuid) {
+                               down_write(&device->uuid_sem);
+                               _drbd_uuid_set_current(device, 
peer_bitmap_uuid);
+                               up_write(&device->uuid_sem);
+                               drbd_print_uuids(peer_device, "setting UUIDs 
to");
+                       }
+                       put_ldev(device);
+               }
+       }
+
        if (down_trylock(&device->resource->state_sem)) {
                /* Retry later and let the worker make progress in the
                 * meantime; two-phase commits depend on that.  */
@@ -2041,6 +2060,7 @@
                add_timer(&peer_device->start_resync_timer);
                return;
        }
+
        lock_all_resources();
        clear_bit(B_RS_H_DONE, &peer_device->flags);
        if (connection->cstate[NOW] < C_CONNECTED ||
@@ -2239,10 +2259,6 @@
 static int do_md_sync(struct drbd_device *device)
 {
        drbd_warn(device, "md_sync_timer expired! Worker calls 
drbd_md_sync().\n");
-#ifdef DRBD_DEBUG_MD_SYNC
-       drbd_warn(device, "last md_mark_dirty: %s:%u\n",
-               device->last_md_mark_dirty.func, 
device->last_md_mark_dirty.line);
-#endif
        drbd_md_sync(device);
        return 0;
 }
@@ -2359,11 +2375,8 @@
 
        drbd_check_peers(resource);
 
-       if (device->have_quorum[NOW] && drbd_data_accessible(device, NOW)) {
-               mutex_lock(&resource->conf_update);
+       if (device->have_quorum[NOW] && drbd_data_accessible(device, NOW))
                drbd_uuid_new_current(device, false);
-               mutex_unlock(&resource->conf_update);
-       }
 }
 
 static void make_new_current_uuid(struct drbd_device *device)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd_state.c 
new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd_state.c
--- old/drbd-9.0.22~1+git.fe2b5983/drbd/drbd_state.c    2020-03-10 
15:37:08.000000000 +0100
+++ new/drbd-9.0.23~1+git.d16bfab7/drbd/drbd_state.c    2020-06-08 
15:56:55.000000000 +0200
@@ -1471,8 +1471,13 @@
                   Check if we have majority of the diskless nodes connected.
                   Using the diskless nodes a tie-breaker! */
            qd.diskless >= diskless_majority_at && device->have_quorum[NOW]) {
-               drbd_info(device, "Would lose quorum, but using tiebreaker 
logic to keep\n");
                have_quorum = true;
+               if (!test_bit(TIEBREAKER_QUORUM, &device->flags)) {
+                       set_bit(TIEBREAKER_QUORUM, &device->flags);
+                       drbd_info(device, "Would lose quorum, but using 
tiebreaker logic to keep\n");
+               }
+       } else {
+               clear_bit(TIEBREAKER_QUORUM, &device->flags);
        }
 
        return have_quorum;
@@ -1516,6 +1521,7 @@
        enum drbd_role *role = resource->role;
        struct drbd_connection *connection;
        struct drbd_device *device;
+       bool in_handshake = false;
        int vnr;
 
        /* See drbd_state_sw_errors in drbd_strings.c */
@@ -1533,6 +1539,22 @@
        }
 
        for_each_connection_rcu(connection, resource) {
+               struct drbd_peer_device *peer_device;
+
+               idr_for_each_entry(&connection->peer_devices, peer_device, vnr) 
{
+                       if (test_bit(INITIAL_STATE_SENT, &peer_device->flags) &&
+                           !test_bit(INITIAL_STATE_RECEIVED, 
&peer_device->flags)) {
+                               in_handshake = true;
+                               goto handshake_found;
+                       }
+               }
+       }
+handshake_found:
+
+       if (in_handshake && role[OLD] != role[NEW])
+               return SS_IN_TRANSIENT_STATE;
+
+       for_each_connection_rcu(connection, resource) {
                enum drbd_conn_state *cstate = connection->cstate;
                enum drbd_role *peer_role = connection->peer_role;
                struct net_conf *nc;
@@ -1547,19 +1569,6 @@
                if (cstate[NEW] == C_DISCONNECTING && cstate[OLD] == 
C_UNCONNECTED)
                        return SS_IN_TRANSIENT_STATE;
 
-               /* While establishing a connection only allow cstate to change.
-                  Delay/refuse role changes, detach attach etc... */
-               if (!(cstate[OLD] == C_CONNECTED ||
-                    (cstate[NEW] == C_CONNECTED && cstate[OLD] == 
C_CONNECTING))) {
-                       struct drbd_peer_device *peer_device;
-
-                       idr_for_each_entry(&connection->peer_devices, 
peer_device, vnr) {
-                               if (test_bit(INITIAL_STATE_SENT, 
&peer_device->flags) &&
-                                   !test_bit(INITIAL_STATE_RECEIVED, 
&peer_device->flags))
-                                       return SS_IN_TRANSIENT_STATE;
-                       }
-               }
-
                nc = rcu_dereference(connection->transport.net_conf);
                two_primaries = nc ? nc->two_primaries : false;
                if (peer_role[NEW] == R_PRIMARY && peer_role[OLD] != R_PRIMARY 
&& !two_primaries) {
@@ -1579,6 +1588,11 @@
                enum which_state which;
                int nr_negotiating = 0;
 
+               if (in_handshake &&
+                   ((disk_state[OLD] < D_ATTACHING && disk_state[NEW] == 
D_ATTACHING) ||
+                    (disk_state[OLD] > D_DETACHING && disk_state[NEW] == 
D_DETACHING)))
+                       return SS_IN_TRANSIENT_STATE;
+
                if (role[OLD] != R_SECONDARY && role[NEW] == R_SECONDARY && 
device->open_rw_cnt)
                        return SS_DEVICE_IN_USE;
 
@@ -2303,7 +2317,6 @@
        idr_for_each_entry(&resource->devices, device, vnr) {
                enum drbd_disk_state *disk_state = device->disk_state;
                struct drbd_peer_device *peer_device;
-               bool one_peer_disk_up_to_date[2] = { };
                bool create_new_uuid = false;
 
                if (disk_state[OLD] != D_NEGOTIATING && disk_state[NEW] == 
D_NEGOTIATING) {
@@ -2336,18 +2349,11 @@
                for_each_peer_device(peer_device, device) {
                        enum drbd_repl_state *repl_state = 
peer_device->repl_state;
                        struct drbd_connection *connection = 
peer_device->connection;
-                       enum drbd_disk_state *peer_disk_state = 
peer_device->disk_state;
-                       enum which_state which;
 
                        /* Wake up role changes, that were delayed because of 
connection establishing */
                        if (repl_state[OLD] == L_OFF && repl_state[NEW] != 
L_OFF &&
                            all_peer_devices_connected(connection))
                                clear_bit(INITIAL_STATE_SENT, 
&peer_device->flags);
-
-                       for (which = OLD; which <= NEW; which++) {
-                               if (peer_disk_state[which] == D_UP_TO_DATE)
-                                       one_peer_disk_up_to_date[which] = true;
-                       }
                }
 
                for_each_peer_device(peer_device, device) {
@@ -2470,7 +2476,7 @@
 
                        if (lost_contact_to_peer_data(peer_disk_state)) {
                                if (role[NEW] == R_PRIMARY && 
!test_bit(UNREGISTERED, &device->flags) &&
-                                   (disk_state[NEW] == D_UP_TO_DATE || 
one_peer_disk_up_to_date[NEW]))
+                                   drbd_data_accessible(device, NEW))
                                        create_new_uuid = true;
 
                                if (connection->agreed_pro_version < 110 &&
@@ -2484,6 +2490,10 @@
                                        create_new_uuid = true;
                        }
 
+                       if (disk_state[OLD] > D_FAILED && disk_state[NEW] == 
D_FAILED &&
+                           role[NEW] == R_PRIMARY && 
drbd_data_accessible(device, NEW))
+                               create_new_uuid = true;
+
                        if (peer_disk_state[NEW] < D_UP_TO_DATE && 
test_bit(GOT_NEG_ACK, &peer_device->flags))
                                clear_bit(GOT_NEG_ACK, &peer_device->flags);
                }
@@ -2514,7 +2524,7 @@
                }
 
                if (disk_state[OLD] >= D_INCONSISTENT && disk_state[NEW] < 
D_INCONSISTENT &&
-                   role[NEW] == R_PRIMARY && one_peer_disk_up_to_date[NEW])
+                   role[NEW] == R_PRIMARY && drbd_data_accessible(device, NEW))
                        create_new_uuid = true;
 
                if (role[OLD] == R_SECONDARY && role[NEW] == R_PRIMARY)
@@ -3141,13 +3151,18 @@
 
        /* case1: The outdate peer handler is successful: */
        if (all_peer_disks_outdated) {
-               mutex_lock(&resource->conf_update);
+               rcu_read_lock();
                idr_for_each_entry(&connection->peer_devices, peer_device, vnr) 
{
                        struct drbd_device *device = peer_device->device;
-                       if (test_and_clear_bit(NEW_CUR_UUID, &device->flags))
+                       if (test_and_clear_bit(NEW_CUR_UUID, &device->flags)) {
+                               kref_get(&device->kref);
+                               rcu_read_unlock();
                                drbd_uuid_new_current(device, false);
+                               kref_put(&device->kref, drbd_destroy_device);
+                               rcu_read_lock();
+                       }
                }
-               mutex_unlock(&resource->conf_update);
+               rcu_read_unlock();
                begin_state_change(resource, &irq_flags, CS_VERBOSE);
                _tl_walk(connection, CONNECTION_LOST_WHILE_PENDING);
                __change_io_susp_fencing(connection, false);
@@ -3508,6 +3523,11 @@
                                drbd_uuid_new_current(device, false);
                        }
 
+                       if (disk_state[OLD] > D_FAILED && disk_state[NEW] == 
D_FAILED &&
+                           role[NEW] == R_PRIMARY && 
test_and_clear_bit(NEW_CUR_UUID, &device->flags)) {
+                               drbd_uuid_new_current(device, false);
+                       }
+
                        if (repl_state[NEW] == L_VERIFY_S && get_ldev(device)) {
                                drbd_info(peer_device, "Starting Online Verify 
from sector %llu\n",
                                                (unsigned long 
long)peer_device->ov_position);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/drbd-9.0.22~1+git.fe2b5983/drbd/linux/drbd_config.h 
new/drbd-9.0.23~1+git.d16bfab7/drbd/linux/drbd_config.h
--- old/drbd-9.0.22~1+git.fe2b5983/drbd/linux/drbd_config.h     2020-03-10 
15:37:08.000000000 +0100
+++ new/drbd-9.0.23~1+git.d16bfab7/drbd/linux/drbd_config.h     2020-06-08 
15:56:55.000000000 +0200
@@ -20,7 +20,7 @@
 
 /* End of external module for 2.6.33 stuff */
 
-#define REL_VERSION "9.0.22-1"
+#define REL_VERSION "9.0.23-1"
 #define PRO_VERSION_MIN 86
 #define PRO_VERSION_MAX 116
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/drbd-9.0.22~1+git.fe2b5983/drbd-kernel.spec 
new/drbd-9.0.23~1+git.d16bfab7/drbd-kernel.spec
--- old/drbd-9.0.22~1+git.fe2b5983/drbd-kernel.spec     2020-03-10 
15:37:08.000000000 +0100
+++ new/drbd-9.0.23~1+git.d16bfab7/drbd-kernel.spec     2020-06-08 
15:56:55.000000000 +0200
@@ -1,6 +1,6 @@
 Name: drbd-kernel
 Summary: Kernel driver for DRBD
-Version: 9.0.22
+Version: 9.0.23
 Release: 1
 
 # always require a suitable userland
@@ -114,6 +114,13 @@
 rm -rf %{buildroot}
 
 %changelog
+* Mon Jun 08 2020 Philipp Reisner <[email protected]> - 9.0.23-1
+- New upstream release.
+
+* Mon Mar 30 2020 Philipp Reisner <[email protected]> - 9.0.22-2
+- Fix reads on diskless in the presence of IO errors
+- Fix diskless nodes leaving a quorum enabled cluster
+
 * Tue Mar 10 2020 Philipp Reisner <[email protected]> - 9.0.22-1
 - New upstream release.
 

++++++ drbd_git_revision ++++++
--- /var/tmp/diff_new_pack.Baplhp/_old  2020-06-11 10:05:54.843395546 +0200
+++ /var/tmp/diff_new_pack.Baplhp/_new  2020-06-11 10:05:54.847395559 +0200
@@ -1 +1 @@
-GIT-hash: fe2b59836bdf1c7c81ccbaad8ef8016d9c3ba582
+GIT-hash: d16bfab7a4033024fed2d99d3b179aa6bb6eb300


Reply via email to