Hello community, here is the log from the commit of package drbd for openSUSE:Factory checked in at 2017-11-17 10:57:34 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/drbd (Old) and /work/SRC/openSUSE:Factory/.drbd.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "drbd" Fri Nov 17 10:57:34 2017 rev:63 rq:542525 version:9.0.9+git.a4cc249e Changes: -------- --- /work/SRC/openSUSE:Factory/drbd/drbd.changes 2017-10-13 14:18:27.589970452 +0200 +++ /work/SRC/openSUSE:Factory/.drbd.new/drbd.changes 2017-11-17 11:00:58.398593772 +0100 @@ -1,0 +2,5 @@ +Fri Nov 17 03:03:20 UTC 2017 - [email protected] + +- bsc#1068587, add build request libelf-devel to build. + +------------------------------------------------------------------- Old: ---- drbd-9.0.9+git.bffac0d9.tar.bz2 New: ---- drbd-9.0.9+git.a4cc249e.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ drbd.spec ++++++ --- /var/tmp/diff_new_pack.ApUwRI/_old 2017-11-17 11:00:59.530552344 +0100 +++ /var/tmp/diff_new_pack.ApUwRI/_new 2017-11-17 11:00:59.534552197 +0100 @@ -24,7 +24,7 @@ %endif Name: drbd -Version: 9.0.9+git.bffac0d9 +Version: 9.0.9+git.a4cc249e Release: 0 Summary: DRBD driver for Linux License: GPL-2.0+ @@ -41,6 +41,7 @@ BuildRequires: kernel-source BuildRequires: kernel-syms BuildRequires: module-init-tools +BuildRequires: libelf-devel Requires: drbd-utils >= 9.0.0 Supplements: drbd-utils >= 9.0.0 Obsoletes: drbd-kmp < %{version} ++++++ _service ++++++ --- /var/tmp/diff_new_pack.ApUwRI/_old 2017-11-17 11:00:59.574550733 +0100 +++ /var/tmp/diff_new_pack.ApUwRI/_new 2017-11-17 11:00:59.574550733 +0100 @@ -10,7 +10,7 @@ <param name="version">9.0.9</param> --> <param name="versionformat">9.0.9+git.%h</param> - <param name="revision">bffac0d96700a2ada5f6daf60465fb7f8add3bda</param> + <param name="revision">a4cc249ec2d55ec2953aeb482d819e47adbbee33</param> </service> <service name="recompress" mode="disabled"> ++++++ drbd-9.0.9+git.bffac0d9.tar.bz2 -> drbd-9.0.9+git.a4cc249e.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/drbd-9.0.9+git.bffac0d9/.gitmodules new/drbd-9.0.9+git.a4cc249e/.gitmodules --- old/drbd-9.0.9+git.bffac0d9/.gitmodules 2017-09-26 13:05:45.000000000 +0200 +++ new/drbd-9.0.9+git.a4cc249e/.gitmodules 1970-01-01 01:00:00.000000000 +0100 @@ -1,10 +0,0 @@ -[submodule "drbd/drbd-kernel-compat"] - path = drbd/drbd-kernel-compat - url = git://github.com/LINBIT/drbd-kernel-compat.git - update = rebase - fetchRecurseSubmodules = true -[submodule "drbd-headers"] - path = drbd-headers - url = git://github.com/LINBIT/drbd-headers.git - update = rebase - fetchRecurseSubmodules = true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/drbd-9.0.9+git.bffac0d9/drbd/compat/tests/have_inode_lock.c new/drbd-9.0.9+git.a4cc249e/drbd/compat/tests/have_inode_lock.c --- old/drbd-9.0.9+git.bffac0d9/drbd/compat/tests/have_inode_lock.c 2017-09-26 13:05:45.000000000 +0200 +++ new/drbd-9.0.9+git.a4cc249e/drbd/compat/tests/have_inode_lock.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,7 +0,0 @@ -#include <linux/fs.h> - -void foo(void) { - struct inode *inode = NULL; - - inode_lock(inode); -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/drbd-9.0.9+git.bffac0d9/drbd/drbd-kernel-compat/drbd_wrappers.h new/drbd-9.0.9+git.a4cc249e/drbd/drbd-kernel-compat/drbd_wrappers.h --- old/drbd-9.0.9+git.bffac0d9/drbd/drbd-kernel-compat/drbd_wrappers.h 2017-09-26 13:05:45.000000000 +0200 +++ new/drbd-9.0.9+git.a4cc249e/drbd/drbd-kernel-compat/drbd_wrappers.h 2017-11-06 14:35:43.000000000 +0100 @@ -1092,7 +1092,7 @@ # endif #else /* see comments in compat/tests/have_bioset_create_front_pad.c */ -# define bioset_create(pool_size, front_pad, C) bioset_create(pool_size, 1) +# define bioset_create(pool_size, front_pad, C) bioset_create(pool_size, front_pad) #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/drbd-9.0.9+git.bffac0d9/drbd/drbd_int.h new/drbd-9.0.9+git.a4cc249e/drbd/drbd_int.h --- old/drbd-9.0.9+git.bffac0d9/drbd/drbd_int.h 2017-09-26 13:05:45.000000000 +0200 +++ new/drbd-9.0.9+git.a4cc249e/drbd/drbd_int.h 2017-11-06 14:35:43.000000000 +0100 @@ -1529,6 +1529,7 @@ extern void drbd_drop_unsent(struct drbd_connection* connection); extern void drbd_cork(struct drbd_connection *connection, enum drbd_stream stream); extern void drbd_uncork(struct drbd_connection *connection, enum drbd_stream stream); +extern void drbd_open_counts(struct drbd_resource *resource, int *rw_count_ptr, int *ro_count_ptr); extern struct drbd_connection * __drbd_next_connection_ref(u64 *, struct drbd_connection *, struct drbd_resource *); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/drbd-9.0.9+git.bffac0d9/drbd/drbd_main.c new/drbd-9.0.9+git.a4cc249e/drbd/drbd_main.c --- old/drbd-9.0.9+git.bffac0d9/drbd/drbd_main.c 2017-09-26 13:05:45.000000000 +0200 +++ new/drbd-9.0.9+git.a4cc249e/drbd/drbd_main.c 2017-11-06 14:35:43.000000000 +0100 @@ -2439,13 +2439,14 @@ return ret; } -static int try_to_promote(struct drbd_device *device) +static int try_to_promote(struct drbd_device *device, long timeout, bool ndelay) { struct drbd_resource *resource = device->resource; - long timeout = resource->res_opts.auto_promote_timeout * HZ / 10; int rv, retry = timeout / (HZ / 5); /* One try every 200ms */ do { rv = drbd_set_role(resource, R_PRIMARY, false, NULL); + if (ndelay) + break; if (rv >= SS_SUCCESS || timeout == 0) { return rv; } else if (rv == SS_CW_FAILED_BY_PEER) { @@ -2487,10 +2488,36 @@ return -EAGAIN; } +enum ioc_rv { + IOC_SLEEP = 0, + IOC_OK = 1, + IOC_ABORT = 2, +}; + +static bool inc_open_count(struct drbd_device *device, fmode_t mode) +{ + struct drbd_resource *resource = device->resource; + enum ioc_rv r = mode & FMODE_NDELAY ? IOC_ABORT : IOC_SLEEP; + + spin_lock_irq(&resource->req_lock); + if (!resource->remote_state_change) { + r = IOC_OK; + if (mode & FMODE_WRITE) + device->open_rw_cnt++; + else + device->open_ro_cnt++; + } + spin_unlock_irq(&resource->req_lock); + + return r; +} + static int drbd_open(struct block_device *bdev, fmode_t mode) { struct drbd_device *device = bdev->bd_disk->private_data; struct drbd_resource *resource = device->resource; + long timeout = resource->res_opts.auto_promote_timeout * HZ / 10; + enum ioc_rv r; int rv = 0; kref_get(&device->kref); @@ -2498,10 +2525,13 @@ mutex_lock(&resource->open_release); - if (mode & FMODE_WRITE) - device->open_rw_cnt++; - else - device->open_ro_cnt++; + timeout = wait_event_interruptible_timeout(resource->twopc_wait, + r = inc_open_count(device, mode), + timeout); + if (r == IOC_ABORT || timeout <= 0) { + mutex_unlock(&resource->open_release); + return -EAGAIN; + } if (resource->res_opts.auto_promote) { enum drbd_state_rv rv; @@ -2511,12 +2541,12 @@ if (mode & FMODE_WRITE) { if (resource->role[NOW] == R_SECONDARY) { - rv = try_to_promote(device); + rv = try_to_promote(device, timeout, (mode & FMODE_NDELAY)); if (rv < SS_SUCCESS) drbd_info(resource, "Auto-promote failed: %s\n", drbd_set_st_err_str(rv)); } - } else /* READ access only */ { + } else if ((mode & FMODE_NDELAY) == 0) { wait_event_interruptible_timeout(resource->state_wait, ro_open_cond(device) != -EAGAIN, resource->res_opts.auto_promote_timeout * HZ / 10); @@ -2533,20 +2563,19 @@ if (resource->role[NOW] != R_PRIMARY) rv = -EROFS; } else /* READ access only */ { - if (!any_disk_is_uptodate(device) || - (resource->role[NOW] != R_PRIMARY && - primary_peer_present(resource) && - !allow_oos)) - rv = -EMEDIUMTYPE; + rv = ro_open_cond(device); } out: mutex_unlock(&resource->open_release); - if (rv) + if (rv) { drbd_release(bdev->bd_disk, mode); + if (rv == -EAGAIN && !(mode & FMODE_NDELAY)) + rv = -EMEDIUMTYPE; + } return rv; } -static void open_counts(struct drbd_resource *resource, int *rw_count_ptr, int *ro_count_ptr) +void drbd_open_counts(struct drbd_resource *resource, int *rw_count_ptr, int *ro_count_ptr) { struct drbd_device *device; int vnr, rw_count = 0, ro_count = 0; @@ -2571,7 +2600,7 @@ else device->open_ro_cnt--; - open_counts(resource, &open_rw_cnt, &open_ro_cnt); + drbd_open_counts(resource, &open_rw_cnt, &open_ro_cnt); if (open_ro_cnt == 0) wake_up_all(&resource->state_wait); @@ -3403,6 +3432,9 @@ mutex_lock(&connection->mutex[DATA_STREAM]); mutex_lock(&connection->mutex[CONTROL_STREAM]); + flush_send_buffer(connection, DATA_STREAM); + flush_send_buffer(connection, CONTROL_STREAM); + connection->transport.ops->free(&connection->transport, op); if (op == DESTROY_TRANSPORT) drbd_put_transport_class(connection->transport.class); @@ -3740,6 +3772,7 @@ blk_cleanup_queue(q); out_no_q: kref_put(&resource->kref, drbd_destroy_resource); + kref_debug_destroy(&device->kref_debug); kfree(device); return err; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/drbd-9.0.9+git.bffac0d9/drbd/drbd_receiver.c new/drbd-9.0.9+git.a4cc249e/drbd/drbd_receiver.c --- old/drbd-9.0.9+git.bffac0d9/drbd/drbd_receiver.c 2017-09-26 13:05:45.000000000 +0200 +++ new/drbd-9.0.9+git.a4cc249e/drbd/drbd_receiver.c 2017-11-06 14:35:43.000000000 +0100 @@ -69,6 +69,7 @@ int drbd_do_features(struct drbd_connection *connection); int drbd_do_auth(struct drbd_connection *connection); +void conn_disconnect(struct drbd_connection *connection); static enum finish_epoch drbd_may_finish_epoch(struct drbd_connection *, struct drbd_epoch *, enum epoch_event); static int e_end_block(struct drbd_work *, int); @@ -627,18 +628,31 @@ rcu_read_unlock(); } -void conn_disconnect(struct drbd_connection *connection); - static int connect_work(struct drbd_work *work, int cancel) { struct drbd_connection *connection = container_of(work, struct drbd_connection, connect_timer_work); + struct drbd_resource *resource = connection->resource; enum drbd_state_rv rv; + long t = resource->res_opts.auto_promote_timeout * HZ / 10; if (connection->cstate[NOW] != C_CONNECTING) goto out_put; - rv = change_cstate(connection, C_CONNECTED, CS_SERIALIZE | CS_VERBOSE | CS_DONT_RETRY); + do { + rv = change_cstate(connection, C_CONNECTED, CS_SERIALIZE | CS_VERBOSE | CS_DONT_RETRY); + if (rv != SS_PRIMARY_READER) + break; + + /* We have a connection established, peer is primary. On my side is a + read-only opener, probably udev or some other scanning after device creating. + This short lived read-only open prevents now that we can continue. + Better retry after the read-only opener goes away. */ + + t = wait_event_interruptible_timeout(resource->state_wait, + !drbd_open_ro_count(resource), + t); + } while (t > 0); if (rv >= SS_SUCCESS) { conn_connect2(connection); @@ -5089,11 +5103,12 @@ unsigned long irq_flags; enum drbd_state_rv rv; int vnr; + long t = resource->res_opts.auto_promote_timeout * HZ / 10; mask = convert_state(mask); val = convert_state(val); retry: - begin_state_change(resource, &irq_flags, flags); + 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); if (rv < SS_SUCCESS) @@ -5114,17 +5129,20 @@ rv = end_state_change(resource, &irq_flags); out: - if (rv == SS_NO_UP_TO_DATE_DISK && resource->role[NOW] != R_PRIMARY) { - long t; + if ((rv == SS_NO_UP_TO_DATE_DISK && resource->role[NOW] != R_PRIMARY) || + rv == SS_PRIMARY_READER) { /* Most probably udev opened it read-only. That might happen if it was demoted very recently. Wait up to one second. */ t = wait_event_interruptible_timeout(resource->state_wait, drbd_open_ro_count(resource) == 0, - HZ); + t); if (t > 0) goto retry; } + if (rv < SS_SUCCESS) + drbd_err(resource, "State change failed: %s\n", drbd_set_st_err_str(rv)); + return rv; fail: abort_state_change(resource, &irq_flags); @@ -6084,8 +6102,13 @@ drbd_send_twopc_reply(connection, cmd, reply); } } else { - if (flags & CS_PREPARED) + if (flags & CS_PREPARED) { + if (rv < SS_SUCCESS) + drbd_err(resource, "FATAL: Local commit of prepared %u failed! \n", + reply->tid); + del_timer(&resource->twopc_timer); + } nested_twopc_request(resource, pi->vnr, pi->cmd, p); @@ -6826,17 +6849,17 @@ device = peer_device->device; sector = be64_to_cpu(p->sector); + + mutex_lock(&device->bm_resync_fo_mutex); switch (peer_device->repl_state[NOW]) { case L_WF_SYNC_UUID: case L_WF_BITMAP_T: case L_BEHIND: break; case L_SYNC_TARGET: - mutex_lock(&device->bm_resync_fo_mutex); bit = BM_SECT_TO_BIT(sector); if (bit < device->bm_resync_fo) device->bm_resync_fo = bit; - mutex_unlock(&device->bm_resync_fo_mutex); break; default: drbd_err(device, "ASSERT FAILED cstate = %s, expected: WFSyncUUID|WFBitMapT|Behind\n", @@ -6845,6 +6868,8 @@ drbd_set_out_of_sync(peer_device, sector, be32_to_cpu(p->blksize)); + mutex_unlock(&device->bm_resync_fo_mutex); + return 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/drbd-9.0.9+git.bffac0d9/drbd/drbd_sender.c new/drbd-9.0.9+git.a4cc249e/drbd/drbd_sender.c --- old/drbd-9.0.9+git.bffac0d9/drbd/drbd_sender.c 2017-09-26 13:05:45.000000000 +0200 +++ new/drbd-9.0.9+git.a4cc249e/drbd/drbd_sender.c 2017-11-06 14:35:43.000000000 +0100 @@ -64,7 +64,7 @@ /* used for synchronous meta data and bitmap IO * submitted by drbd_md_sync_page_io() */ -void drbd_md_endio BIO_ENDIO_ARGS(struct bio *bio, int error) +void drbd_md_endio BIO_ENDIO_ARGS(struct bio *bio, blk_status_t status) { struct drbd_device *device; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/drbd-9.0.9+git.bffac0d9/drbd/drbd_state.c new/drbd-9.0.9+git.a4cc249e/drbd/drbd_state.c --- old/drbd-9.0.9+git.bffac0d9/drbd/drbd_state.c 2017-09-26 13:05:45.000000000 +0200 +++ new/drbd-9.0.9+git.a4cc249e/drbd/drbd_state.c 2017-11-06 14:35:43.000000000 +0100 @@ -3605,6 +3605,35 @@ } return SS_WEAKLY_CONNECTED; } + +static enum drbd_state_rv +check_ro_cnt_and_primary(struct drbd_resource *resource) +{ + struct twopc_reply *reply = &resource->twopc_reply; + struct drbd_connection *connection; + enum drbd_state_rv rv = SS_SUCCESS; + int rw_count, ro_count; + struct net_conf *nc; + + drbd_open_counts(resource, &rw_count, &ro_count); + + if (!rw_count && !ro_count) + return rv; + + rcu_read_lock(); + for_each_connection_rcu(connection, resource) { + nc = rcu_dereference(connection->transport.net_conf); + if (!nc->two_primaries && + NODE_MASK(connection->peer_node_id) & reply->primary_nodes) { + rv = SS_PRIMARY_READER; + break; + } + } + rcu_read_unlock(); + + return rv; +} + long twopc_retry_timeout(struct drbd_resource *resource, int retries) { struct drbd_connection *connection; @@ -3861,10 +3890,15 @@ (unsigned long)reply->weak_nodes); if (context->mask.role == role_MASK && context->val.role == R_PRIMARY) rv = primary_nodes_allowed(resource); - if ((context->mask.role == role_MASK && context->val.role == R_PRIMARY) || - (context->mask.conn == conn_MASK && context->val.conn == C_CONNECTED)) + if (rv >= SS_SUCCESS && + ((context->mask.role == role_MASK && context->val.role == R_PRIMARY) || + (context->mask.conn == conn_MASK && context->val.conn == C_CONNECTED))) rv = check_primaries_distances(resource); + if (rv >= SS_SUCCESS && + context->mask.conn == conn_MASK && context->val.conn == C_CONNECTED) + rv = check_ro_cnt_and_primary(resource); + if (!(context->mask.conn == conn_MASK && context->val.conn == C_DISCONNECTING) || (reply->reachable_nodes & reply->target_reachable_nodes)) { /* The cluster is still connected after this @@ -3941,6 +3975,9 @@ __change_peer_role(target_connection, target_role); } rv = end_state_change(resource, &irq_flags); + if (rv < SS_SUCCESS) + drbd_err(resource, "FATAL: Local commit of allready commited %u failed! \n", + be32_to_cpu(request.tid)); } else { abort_state_change(resource, &irq_flags); } ++++++ drbd_git_revision ++++++ --- /var/tmp/diff_new_pack.ApUwRI/_old 2017-11-17 11:00:59.930537704 +0100 +++ /var/tmp/diff_new_pack.ApUwRI/_new 2017-11-17 11:00:59.934537557 +0100 @@ -1 +1 @@ -GIT-hash: bffac0d96700a2ada5f6daf60465fb7f8add3bda +GIT-hash: a4cc249ec2d55ec2953aeb482d819e47adbbee33
