platform/kernel/linux-rpi.git
11 years agodrbd: fix "stalled" empty resync
Philipp Reisner [Thu, 29 Sep 2011 11:00:14 +0000 (13:00 +0200)]
drbd: fix "stalled" empty resync

With sync-after dependencies, given "lucky" timing of pause/unpause
events, and the end of an empty (0 bits set) resync was sometimes not
detected on the SyncTarget, leading to a "stalled" SyncSource state.

Fixed this by expecting not only "Inconsistent -> UpToDate" but also
"Consistent -> UpToDate" transitions for the peer disk state
to end a resync.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: fix bitmap writeout after aborted resync
Lars Ellenberg [Mon, 26 Sep 2011 07:58:04 +0000 (09:58 +0200)]
drbd: fix bitmap writeout after aborted resync

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Consider the discard-my-data flag for all volumes [bugz 359]
Philipp Reisner [Mon, 5 Sep 2011 14:22:33 +0000 (16:22 +0200)]
drbd: Consider the discard-my-data flag for all volumes [bugz 359]

...not only for the first volume

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Improve error reporting in drbd_md_sync_page_io()
Andreas Gruenbacher [Fri, 19 Aug 2011 11:47:31 +0000 (13:47 +0200)]
drbd: Improve error reporting in drbd_md_sync_page_io()

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: fix connect failure with all default net-options
Lars Ellenberg [Fri, 19 Aug 2011 08:39:00 +0000 (10:39 +0200)]
drbd: fix connect failure with all default net-options

If no net-options are configured (all on their default),
no DRBD_NLA_NET_CONF will be passed to the kernel.
The kernel must not require its presence,
there is no required option in there.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Update some outdated comments to match the code
Andreas Gruenbacher [Wed, 17 Aug 2011 10:43:25 +0000 (12:43 +0200)]
drbd: Update some outdated comments to match the code

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Remove unused code
Philipp Reisner [Tue, 16 Aug 2011 09:59:43 +0000 (11:59 +0200)]
drbd: Remove unused code

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Remove dead code
Philipp Reisner [Thu, 16 Jun 2011 15:58:02 +0000 (17:58 +0200)]
drbd: Remove dead code

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Cleanup all epoch objects upon connection loss
Philipp Reisner [Mon, 18 Jul 2011 13:45:15 +0000 (15:45 +0200)]
drbd: Cleanup all epoch objects upon connection loss

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: The minor_count module parameter is only a hint nowadays
Philipp Reisner [Mon, 18 Jul 2011 09:09:17 +0000 (11:09 +0200)]
drbd: The minor_count module parameter is only a hint nowadays

* The max of minor_count is 255
* In drbdadm count the number of minors, instead of finding
  the highest minor number
* No longer us the magic in the init script

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Do not display bogus log lines for pdsk in case pdsk < D_UNKNOWN
Philipp Reisner [Mon, 18 Jul 2011 08:44:24 +0000 (10:44 +0200)]
drbd: Do not display bogus log lines for pdsk in case pdsk < D_UNKNOWN

This was a regression recently introduced with commit
7848ddb752c09b6dfd1ddfabb06b69b08aa8f6b9
"drbd: Correctly handle resources without volumes"

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: detach must not try to abort non-local requests
Lars Ellenberg [Fri, 15 Jul 2011 21:52:44 +0000 (23:52 +0200)]
drbd: detach must not try to abort non-local requests

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Get rid of MR_{READ,WRITE}_SHIFT
Andreas Gruenbacher [Sun, 17 Jul 2011 21:06:12 +0000 (23:06 +0200)]
drbd: Get rid of MR_{READ,WRITE}_SHIFT

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Bugfix for the connection behavior
Philipp Reisner [Thu, 8 Nov 2012 14:04:36 +0000 (15:04 +0100)]
drbd: Bugfix for the connection behavior

If we get into the C_BROKEN_PIPE cstate once, the state engine set the
thi->t_state of the receiver thread to restarting.  But with the while loop
in drbdd_init() a new connection gets established. After the call into
drbdd() returns immediately since the thi->t_state is not RUNNING.  The
restart of drbd_init() then resets thi->t_state to RUNNING.

I.e. after entering C_BROKEN_PIPE once, the next successful established
connection gets wasted.

The two parts of the fix:
  * Do not cause the thread to restart if we detect the issue
    with the sockets while we are in C_WF_CONNECTION.

  * Make sure that all actions that would have set us to C_BROKEN_PIPE
    happen before the state change to C_WF_REPORT_PARAMS.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Fix the data-integrity-alg setting
Andreas Gruenbacher [Sun, 17 Jul 2011 21:06:12 +0000 (23:06 +0200)]
drbd: Fix the data-integrity-alg setting

The last data-integrity-alg fix made data integrity checking work when the
algorithm was changed for an established connection, but the common case of
configuring the algorithm before connecting was still broken.  Fix that.

Signed-off-by: Andreas Gruenbacher <agruen@linbit.com>
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Turn tl_apply() into tl_abort_disk_io()
Andreas Gruenbacher [Sun, 17 Jul 2011 21:06:12 +0000 (23:06 +0200)]
drbd: Turn tl_apply() into tl_abort_disk_io()

There is no need to overly generalize this function; it only makes the code
harder to understand.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Fixed w_restart_disk_io() to handle non active AL-extents
Philipp Reisner [Fri, 15 Jul 2011 15:19:02 +0000 (17:19 +0200)]
drbd: Fixed w_restart_disk_io() to handle non active AL-extents

Since we now apply the AL in user space onto the bitmap, the AL
is not active for the requests we want to reply.

For that a al_write_transaction() that might be called from
worker context became necessary.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Missing assignment of mdev before drbd_queue_work()
Philipp Reisner [Fri, 15 Jul 2011 16:15:45 +0000 (18:15 +0200)]
drbd: Missing assignment of mdev before drbd_queue_work()

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Do not mod_timer() with a past time
Philipp Reisner [Fri, 15 Jul 2011 11:53:06 +0000 (13:53 +0200)]
drbd: Do not mod_timer() with a past time

In case we can not find out why the request takes too long
(happens e.g. when IO got suspended on DRBD level). rearm
the timer with a reasonable value.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Consider that the no-data-condition could be in connected state
Philipp Reisner [Fri, 15 Jul 2011 16:44:26 +0000 (18:44 +0200)]
drbd: Consider that the no-data-condition could be in connected state

...when the peer has inconsistent data. In that case we failed to
clear the susp_nod flag. When the local disk was attached again

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Dropped wrong clause to generate new current UUIDs
Philipp Reisner [Fri, 15 Jul 2011 10:14:27 +0000 (12:14 +0200)]
drbd: Dropped wrong clause to generate new current UUIDs

Looks like a remainder from long ago.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: receive_protocol(): We cannot change our own data-integrity-alg setting here
Andreas Gruenbacher [Fri, 15 Jul 2011 15:41:09 +0000 (17:41 +0200)]
drbd: receive_protocol(): We cannot change our own data-integrity-alg setting here

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Be consistent in reporting incompatibilities in P_PROTOCOL settings
Andreas Gruenbacher [Fri, 15 Jul 2011 15:19:18 +0000 (17:19 +0200)]
drbd: Be consistent in reporting incompatibilities in P_PROTOCOL settings

Refer to the settings by the names which drbdsetup and drbd.conf are using.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: receive_protocol(): Make the program flow less confusing
Andreas Gruenbacher [Fri, 15 Jul 2011 15:04:26 +0000 (17:04 +0200)]
drbd: receive_protocol(): Make the program flow less confusing

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: receive_protocol(): Give variables more easily searchable names
Andreas Gruenbacher [Fri, 15 Jul 2011 14:48:49 +0000 (16:48 +0200)]
drbd: receive_protocol(): Give variables more easily searchable names

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Print memory address in hex instead of decimal in error message
Andreas Gruenbacher [Fri, 15 Jul 2011 07:43:23 +0000 (09:43 +0200)]
drbd: Print memory address in hex instead of decimal in error message

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Allow to create devices with a minor number > minor_count
Andreas Gruenbacher [Thu, 14 Jul 2011 14:00:40 +0000 (16:00 +0200)]
drbd: Allow to create devices with a minor number > minor_count

The minor_count module/kernel parameter serves to scale the size of drbd's
internal memory pool, but it is no longer a limit for the number of minors or
the minor number.  (Minor numbers can be arbitrarily high within the allowed
limit of 2^20.)

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Fix the maximum accepted minor device number
Andreas Gruenbacher [Wed, 13 Jul 2011 11:40:30 +0000 (13:40 +0200)]
drbd: Fix the maximum accepted minor device number

The maximum minor device number allowed by the kernel is (1<<20 - 1).  Reject
device numbers higher than that to earlier catch possible errors.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Define scale factors in a single place
Andreas Gruenbacher [Mon, 9 May 2011 16:26:20 +0000 (18:26 +0200)]
drbd: Define scale factors in a single place

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Changed some defaults
Philipp Reisner [Wed, 13 Jul 2011 08:24:51 +0000 (10:24 +0200)]
drbd: Changed some defaults

* Enabled the resync controller, with a fill target of 50Kib. That gives
  reasonable resync speeds without tuning. A much better default than
  the 250KiB/s fixed.

* Enable bitmap compression. It is save to use, and most people have
  more CPU power than network bandwidth.

* ko-count of 7: Abort a connection if the peer fails to process a
  write request within 42 seconds.

* al-extents of 1237: ~5 GiB seems to be a much more sane default
  these days.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: report net config even for resources without a single volume
Lars Ellenberg [Mon, 11 Jul 2011 21:49:55 +0000 (23:49 +0200)]
drbd: report net config even for resources without a single volume

Currently it is legal (though unusual) to create and connect a resource,
before adding in all necessary volumes. We should include the network
configuration details, even if we don't have a single volume (yet).

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Correctly handle resources without volumes
Philipp Reisner [Mon, 11 Jul 2011 15:04:23 +0000 (17:04 +0200)]
drbd: Correctly handle resources without volumes

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Eliminated the "notified peer" messages
Philipp Reisner [Fri, 8 Jul 2011 12:47:45 +0000 (14:47 +0200)]
drbd: Eliminated the "notified peer" messages

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Fixed removal of volumes/devices from connected resources
Philipp Reisner [Wed, 6 Jul 2011 21:04:44 +0000 (23:04 +0200)]
drbd: Fixed removal of volumes/devices from connected resources

When removing a volume/device we need to switch the connection
status of the peer back into WFReportParams.

  Before this fix it was left in Connected state. That means that
  the peer device continued to inform us about state changes, etc...
  But we deleted that minor -> protocol error.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: on attach, enforce clean meta data
Lars Ellenberg [Tue, 5 Jul 2011 18:59:26 +0000 (20:59 +0200)]
drbd: on attach, enforce clean meta data

Detection of unclean shutdown has moved into user space.

The kernel code will, whenever it updates the meta data, mark it as
"unclean", and will refuse to attach to such unclean meta data.

"drbdadm up" now schedules "drbdmeta apply-al", which will apply
the activity log to the bitmap, and/or reinitialize it, if necessary,
as well as set a "clean" indicator flag.

This moves a bit code out of kernel space.
As a side effect, it also prevents some 8.3 module from accidentally
ignoring the 8.4 style activity log, if someone should downgrade,
whether on purpose, or accidentally because he changed kernel versions
without providing an 8.4 for the new kernel, and the new kernel comes
with in-tree 8.3.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: detach from frozen backing device
Philipp Reisner [Tue, 5 Jul 2011 13:38:59 +0000 (15:38 +0200)]
drbd: detach from frozen backing device

* drbd-8.3:
  documentation: Documented detach's --force and disk's --disk-timeout
  drbd: Implemented the disk-timeout option
  drbd: Force flag for the detach operation
  drbd: Allow new IOs while the local disk in in FAILED state
  drbd: Bitmap IO functions can not return prematurely if the disk breaks
  drbd: Added a kref to bm_aio_ctx
  drbd: Hold a reference to ldev while doing meta-data IO
  drbd: Keep a reference to the bio until the completion handler finished
  drbd: Implemented wait_until_done_or_disk_failure()
  drbd: Replaced md_io_mutex by an atomic: md_io_in_use
  drbd: moved md_io into mdev
  drbd: Immediately allow completion of IOs, that wait for IO completions on a failed disk
  drbd: Keep a reference to barrier acked requests

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Improve the "unexpected packet" error messages
Andreas Gruenbacher [Sun, 3 Jul 2011 09:41:08 +0000 (11:41 +0200)]
drbd: Improve the "unexpected packet" error messages

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Fixed state transitions in case reading meta data failes
Philipp Reisner [Fri, 1 Jul 2011 15:00:57 +0000 (17:00 +0200)]
drbd: Fixed state transitions in case reading meta data failes

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Improve compatibility with drbd's older than 8.3.7
Philipp Reisner [Thu, 30 Jun 2011 13:43:06 +0000 (15:43 +0200)]
drbd: Improve compatibility with drbd's older than 8.3.7

Regression introduced with 8.3.11 commit:
drbd: Take a more conservative approach when deciding max_bio_size

Never ever tell an older drbd, that we support more than 32KiB
in a single data request (packet).
Never believe an older drbd, that is supports more than 32KiB
in a single data request (packet)

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Fixes from the 8.3 development branch
Philipp Reisner [Tue, 31 May 2011 11:07:24 +0000 (13:07 +0200)]
drbd: Fixes from the 8.3 development branch

 * commit 'ae57a0a':
   drbd: Only print sanitize state's warnings, if the state change happens
   drbd: we should write meta data updates with FLUSH FUA
   drbd: fix limit define, we support 1 PiByte now
   drbd: fix log message argument order
   drbd: Typo in user-visible message.
   drbd: Make "(rcv|snd)buf-size" and "ping-timeout" available for the proxy, too.
   drbd: Allow keywords to be used in multiple config sections.
   drbd: fix typos in comments.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: downgraded error printk to info
Lars Ellenberg [Mon, 20 Jun 2011 23:13:37 +0000 (01:13 +0200)]
drbd: downgraded error printk to info

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: allow ping-timeout of up to 30 seconds
Lars Ellenberg [Mon, 20 Jun 2011 20:21:19 +0000 (22:21 +0200)]
drbd: allow ping-timeout of up to 30 seconds

Allow up to 300 centi-seconds to be configured for the "ping timeout".
There may be setups where heavy congestion, huge buffers, and asymmetric
bandwidth limitations may need a "huge" ping-timeout as work-around
for "spurious connection loss" problems.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agoDRBD: Fix comparison always false warning due to long/long long compare
David Howells [Tue, 14 Jun 2011 23:59:04 +0000 (00:59 +0100)]
DRBD: Fix comparison always false warning due to long/long long compare

Fix warnings of the following nature in the drbd header:

In file included from drivers/block/drbd/drbd_bitmap.c:32:
drivers/block/drbd/drbd_int.h: In function 'drbd_get_syncer_progress':
drivers/block/drbd/drbd_int.h:2234: warning: comparison is always false due to limited range of data

where mdev->rs_total (an unsigned long) is being compared to 1ULL << 32, which
is always false on a 32-bit machine.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Rename --dry-run to --tentative
Andreas Gruenbacher [Tue, 28 Jun 2011 12:18:12 +0000 (14:18 +0200)]
drbd: Rename --dry-run to --tentative

drbdadm already has a --dry-run option, so this option cannot directly be
passed through to drbdsetup.  Rename the drbdsetup option to resolve this
conflict.

For backward compatibility, make --dry-run an alias of --tentative.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Remove dead code
Andreas Gruenbacher [Tue, 21 Jun 2011 10:58:22 +0000 (12:58 +0200)]
drbd: Remove dead code

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Allow to pass resource options to the new-resource command
Andreas Gruenbacher [Thu, 16 Jun 2011 15:58:02 +0000 (17:58 +0200)]
drbd: Allow to pass resource options to the new-resource command

This is equivalent to how the attach and connect commands work.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Convert the generic netlink interface to accept connection endpoints
Andreas Gruenbacher [Tue, 14 Jun 2011 16:28:09 +0000 (18:28 +0200)]
drbd: Convert the generic netlink interface to accept connection endpoints

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Rename DRBD_ADM_NEED_{CONN -> RESOURCE}
Andreas Gruenbacher [Tue, 14 Jun 2011 14:07:32 +0000 (16:07 +0200)]
drbd: Rename DRBD_ADM_NEED_{CONN -> RESOURCE}

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Split off netlink mandatory attribute handling into separate file
Andreas Gruenbacher [Fri, 10 Jun 2011 10:57:26 +0000 (12:57 +0200)]
drbd: Split off netlink mandatory attribute handling into separate file

Duplicate this file in the kernel module and in user space; both sides need it.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Also need to check for DRBD_GENLA_F_MANDATORY flags before nla_find_nested()
Andreas Gruenbacher [Thu, 9 Jun 2011 15:52:12 +0000 (17:52 +0200)]
drbd: Also need to check for DRBD_GENLA_F_MANDATORY flags before nla_find_nested()

This is done by introducing drbd_nla_find_nested() which handles the flag
before calling nla_find_nested().

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Use the terminology suggested by the command names in the source code and messages
Andreas Gruenbacher [Mon, 6 Jun 2011 14:16:44 +0000 (16:16 +0200)]
drbd: Use the terminology suggested by the command names in the source code and messages

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: spelling fix: too small
Lars Ellenberg [Mon, 6 Jun 2011 13:36:04 +0000 (15:36 +0200)]
drbd: spelling fix: too small

It is not "to small", but "too small".

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: cosmetic: fix accidental division instead of modulo when pretty printing
Lars Ellenberg [Fri, 3 Jun 2011 19:13:17 +0000 (21:13 +0200)]
drbd: cosmetic: fix accidental division instead of modulo when pretty printing

For large resync rates, seq_printf_with_thousands_grouping()
accidentally only produced Y,000,00Y, instead of the real numbers.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Use DRBD_MINOR_COUNT_DEF in one more place
Andreas Gruenbacher [Tue, 31 May 2011 11:08:53 +0000 (13:08 +0200)]
drbd: Use DRBD_MINOR_COUNT_DEF in one more place

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Lower log priority for an event that is definitely not an error
Philipp Reisner [Wed, 25 May 2011 09:03:04 +0000 (11:03 +0200)]
drbd: Lower log priority for an event that is definitely not an error

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Don't use empty nested netlink attributes
Andreas Gruenbacher [Tue, 24 May 2011 12:18:31 +0000 (14:18 +0200)]
drbd: Don't use empty nested netlink attributes

Before mainline commit ea5693cc (v2.6.29-rc1), empty nested netlink attributes
were not allowed.  Fix that by leaving out nested attributes if they are empty
and by allowing the top-level attributes to be missing.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: drbd_adm_prepare(): Pass through error codes
Andreas Gruenbacher [Tue, 24 May 2011 12:17:08 +0000 (14:17 +0200)]
drbd: drbd_adm_prepare(): Pass through error codes

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: drbd_nla_check_mandatory(): Need to remove the DRBD_GENLA_F_MANDATORY flag...
Andreas Gruenbacher [Tue, 24 May 2011 12:08:58 +0000 (14:08 +0200)]
drbd: drbd_nla_check_mandatory(): Need to remove the DRBD_GENLA_F_MANDATORY flag first

We need to remove the flag before checking for valid types.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Make drbd's use of netlink attribute flags less confusing
Andreas Gruenbacher [Thu, 19 May 2011 15:39:28 +0000 (17:39 +0200)]
drbd: Make drbd's use of netlink attribute flags less confusing

Make it more clear in the flag names which flags are internal to drbd, and
which are not.

The check for mandatory attributes is the only extension visible at the netlink
layer.  Attributes with this flag set would look like unknown attributes to
some kernel versions.  The netlink layer would ignore them and also skip
consistency checks on the attribute type and legth.  To avoid this, we check
for mandatory attributes first, remove the mandatory flag, and then process the
attributes normally.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Remove unused GENLA_F_MAY_IGNORE flag
Andreas Gruenbacher [Wed, 18 May 2011 14:48:16 +0000 (16:48 +0200)]
drbd: Remove unused GENLA_F_MAY_IGNORE flag

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Output signed / unsigned netlink fields correctly
Andreas Gruenbacher [Tue, 17 May 2011 11:29:46 +0000 (13:29 +0200)]
drbd: Output signed / unsigned netlink fields correctly

Note: All input values are still treated as signed; unsigned long long values
are still broken.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Use more generic constant names
Andreas Gruenbacher [Thu, 12 May 2011 23:24:14 +0000 (01:24 +0200)]
drbd: Use more generic constant names

These constants are useful for the same purpose in more than one place.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Send PROTOCOL_UPDATE packets when appropriate
Philipp Reisner [Mon, 16 May 2011 15:38:45 +0000 (17:38 +0200)]
drbd: Send PROTOCOL_UPDATE packets when appropriate

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Receiving part for the PROTOCOL_UPDATE packet
Philipp Reisner [Mon, 16 May 2011 15:38:11 +0000 (17:38 +0200)]
drbd: Receiving part for the PROTOCOL_UPDATE packet

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Allocation of int_dig_in and int_dig_vv was missing
Philipp Reisner [Tue, 17 May 2011 08:12:56 +0000 (10:12 +0200)]
drbd: Allocation of int_dig_in and int_dig_vv was missing

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Made cmp_after_sb() more generic into convert_after_sb()
Philipp Reisner [Mon, 16 May 2011 15:31:47 +0000 (17:31 +0200)]
drbd: Made cmp_after_sb() more generic into convert_after_sb()

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: protect updates to integrits_tfm by tconn->data->mutex
Philipp Reisner [Mon, 16 May 2011 10:57:15 +0000 (12:57 +0200)]
drbd: protect updates to integrits_tfm by tconn->data->mutex

Since we need to hold that mutex anyways to make sure the peer
gets that change in the right position in the data stream,
it makes a lot of sense to use the same mutex to ensure existence
of the tfm.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Refuse to change network options online when...
Philipp Reisner [Mon, 16 May 2011 12:30:24 +0000 (14:30 +0200)]
drbd: Refuse to change network options online when...

* the peer does not speak protocol_version 100 and the
  user wants to change one of:
    - wire_protocol
    - two_primaries
    - integrity_alg

* the user wants to remove the allow_two_primaries flag
  when there are two primaries

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Rename DISK_SIZE_SECT -> DISK_SIZE
Andreas Gruenbacher [Wed, 11 May 2011 12:44:55 +0000 (14:44 +0200)]
drbd: Rename DISK_SIZE_SECT -> DISK_SIZE

We don't have the units in constant names in other places, either.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Convert resync-after into a signed netlink field
Andreas Gruenbacher [Thu, 12 May 2011 10:02:54 +0000 (12:02 +0200)]
drbd: Convert resync-after into a signed netlink field

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Fix the upper limit of resync-after
Andreas Gruenbacher [Thu, 12 May 2011 09:15:34 +0000 (11:15 +0200)]
drbd: Fix the upper limit of resync-after

The 32-bit resync_after netlink field takes a device minor number as
parameter, which is no longer limited to 255.  We cannot statically
verify which device numbers are valid, so set the ummer limit to the
highest possible signed 32-bit integer.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Refer to connect-int consistently throughout the code
Andreas Gruenbacher [Wed, 11 May 2011 12:34:35 +0000 (14:34 +0200)]
drbd: Refer to connect-int consistently throughout the code

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Refer to resync-rate consistently throughout the code
Andreas Gruenbacher [Wed, 11 May 2011 12:29:52 +0000 (14:29 +0200)]
drbd: Refer to resync-rate consistently throughout the code

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: skip spurious wait_event in drbd_al_begin_io
Lars Ellenberg [Tue, 3 May 2011 14:49:20 +0000 (16:49 +0200)]
drbd: skip spurious wait_event in drbd_al_begin_io

Activity log transaction writes are serialized on a bit lock.
If several CPUs race to write an AL transaction,
those that did not get the lock the first time
may continue as soon as there are no more pending transactions.

The do not need to all grab the lock in turn,
just to realize that the AL is clean already,
and they have nothing to do.

This also closes a potential deadlock with drbd_adm_disk_opts.
Once it got the AL bit lock, it knows there are no pending transactions,
the AL is clean, and it should be safe to wait for all element references
to drop to zero.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Rename the want_lose field/flag to discard_my_data
Andreas Gruenbacher [Fri, 6 May 2011 18:00:02 +0000 (20:00 +0200)]
drbd: Rename the want_lose field/flag to discard_my_data

This is what it is called in config files and on the command line as
well.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Also define the default values of boolean flags in a single place
Andreas Gruenbacher [Fri, 6 May 2011 15:50:57 +0000 (17:50 +0200)]
drbd: Also define the default values of boolean flags in a single place

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Make broadcast events return NO_ERROR
Andreas Gruenbacher [Thu, 5 May 2011 23:03:32 +0000 (01:03 +0200)]
drbd: Make broadcast events return NO_ERROR

Instead of returning a ret_code outside of the range of enum
drbd_ret_code, use NO_ERROR to indicate success.  This way,
ret_code has the same meaning in all packets.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Removing drbd_cfg_rwsem
Philipp Reisner [Thu, 5 May 2011 14:13:10 +0000 (16:13 +0200)]
drbd: Removing drbd_cfg_rwsem

 * Updates to all configuration items is done under genl_lock().
   Including removal of mdevs or tconns.
 * All read non sleeping read sides are protected by rcu
 * All sleeping read sides keep reference counts to keep the
   objects alive

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Use RCU for the drbd_tconns list
Philipp Reisner [Wed, 4 May 2011 13:47:01 +0000 (15:47 +0200)]
drbd: Use RCU for the drbd_tconns list

Preparing removal of drbd_cfg_rwsem

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Refcounting for mdev objects
Philipp Reisner [Wed, 4 May 2011 13:10:30 +0000 (15:10 +0200)]
drbd: Refcounting for mdev objects

Preparing removal of drbd_cfg_rwsem

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Turn no-tcp-cork into tcp-cork={yes|no}
Andreas Gruenbacher [Wed, 4 May 2011 13:25:35 +0000 (15:25 +0200)]
drbd: Turn no-tcp-cork into tcp-cork={yes|no}

Change the --no-tcp-cork drbdsetup command line option as well as
the no_cork netlink packet.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Turn no-md-flushes into md-flushes={yes|no}
Andreas Gruenbacher [Wed, 4 May 2011 13:25:35 +0000 (15:25 +0200)]
drbd: Turn no-md-flushes into md-flushes={yes|no}

Change the --no-md-flushes drbdsetup command line option as well as
the no_md_flush netlink packet.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Turn no-disk-drain into disk-drain={yes|no}
Andreas Gruenbacher [Wed, 4 May 2011 13:25:35 +0000 (15:25 +0200)]
drbd: Turn no-disk-drain into disk-drain={yes|no}

Change the --no-disk-drain drbdsetup command line option as well as
the no_disk_drain netlink packet.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Turn no-disk-flushes into disk-flushes={yes|no}
Andreas Gruenbacher [Wed, 4 May 2011 13:25:35 +0000 (15:25 +0200)]
drbd: Turn no-disk-flushes into disk-flushes={yes|no}

Change the --no-disk-flushes drbdsetup command line option as well as
the no_disk_flush netlink packet.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Convert boolean flags on netlink from NLA_FLAG to NLA_U8
Andreas Gruenbacher [Wed, 4 May 2011 14:06:51 +0000 (16:06 +0200)]
drbd: Convert boolean flags on netlink from NLA_FLAG to NLA_U8

Flags of type NLA_FLAG are either present or absent, but do not have a
value by themselves.  Use type NLA_U8 for our boolean flags instead, and
use the value to determine if the flag should be on or off.

On the drbdsetup command line, all those flags have an optional yes/no
argument which defaults to yes.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: RCU for rs_plan_s
Philipp Reisner [Tue, 3 May 2011 14:47:02 +0000 (16:47 +0200)]
drbd: RCU for rs_plan_s

This removes the issue with using peer_seq_lock out of different
contexts.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Enforce limits of disk_conf members; centralized these checks
Philipp Reisner [Wed, 4 May 2011 08:06:52 +0000 (10:06 +0200)]
drbd: Enforce limits of disk_conf members; centralized these checks

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Made the fifo object a self contained object (preparing for RCU)
Philipp Reisner [Tue, 3 May 2011 14:19:31 +0000 (16:19 +0200)]
drbd: Made the fifo object a self contained object (preparing for RCU)

* Moved rs_planed into it, named total
* When having a pointer to the object the values can
  be embedded into the fifo object.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: RCU for disk_conf
Philipp Reisner [Tue, 3 May 2011 13:00:55 +0000 (15:00 +0200)]
drbd: RCU for disk_conf

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Introduce __s32_field in the genetlink macro magic
Lars Ellenberg [Wed, 4 May 2011 08:33:52 +0000 (10:33 +0200)]
drbd: Introduce __s32_field in the genetlink macro magic

...and drop explicit typecasts (int)meta_dev_idx < 0.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Renamed (old|new)_conf into (old|new)_net_conf in receive_SyncParam
Philipp Reisner [Tue, 3 May 2011 12:58:00 +0000 (14:58 +0200)]
drbd: Renamed (old|new)_conf into (old|new)_net_conf in receive_SyncParam

Preparing RCU for disk_conf

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Split drbd_alter_sa() into drbd_sync_after_valid() and drbd_sync_after_changed()
Philipp Reisner [Tue, 3 May 2011 12:27:15 +0000 (14:27 +0200)]
drbd: Split drbd_alter_sa() into drbd_sync_after_valid() and drbd_sync_after_changed()

Preparing RCU for disk_conf

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: drbd_dew_dev_size() gets the user requests disk_size as argument
Philipp Reisner [Tue, 3 May 2011 11:27:43 +0000 (13:27 +0200)]
drbd: drbd_dew_dev_size() gets the user requests disk_size as argument

Preparing RCU for disk_conf

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Renamed the net_conf_update mutex to conf_update
Philipp Reisner [Tue, 3 May 2011 11:14:15 +0000 (13:14 +0200)]
drbd: Renamed the net_conf_update mutex to conf_update

Preparing to use the same mutex for disk_conf updates

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Removed dead code
Philipp Reisner [Mon, 2 May 2011 09:24:04 +0000 (11:24 +0200)]
drbd: Removed dead code

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Generate the drbd_set_*_defaults() functions from drbd_genl.h
Andreas Gruenbacher [Tue, 3 May 2011 12:56:09 +0000 (14:56 +0200)]
drbd: Generate the drbd_set_*_defaults() functions from drbd_genl.h

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Remove left-over unused define
Andreas Gruenbacher [Tue, 3 May 2011 10:27:11 +0000 (12:27 +0200)]
drbd: Remove left-over unused define

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: fix schedule in atomic
Lars Ellenberg [Mon, 2 May 2011 09:51:31 +0000 (11:51 +0200)]
drbd: fix schedule in atomic

An administrative detach used to request a state change directly to D_DISKLESS,
first suspending IO to avoid the last put_ldev() occuring from an endio handler,
potentially in irq context.

This is not enough on the receiving side (typically secondary), we may miss
some peer_req on the way to local disk, which then may do the last put_ldev()
from their drbd_peer_request_endio().

This patch makes the detach always go through the intermediate D_FAILED state.
We may consider to rename it D_DETACHING.

Alternative approach would be to create yet an other work item to be scheduled
on the worker, do the destructor work from there, and get the timing right.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: fix thread stop deadlock
Lars Ellenberg [Mon, 2 May 2011 09:47:18 +0000 (11:47 +0200)]
drbd: fix thread stop deadlock

There are races where the receiver may be exiting,
but still need the worker to process some stuff.

Do not wait for the receiver to die from an exiting worker.
The receiver must already be dead in case the worker decides to exit.
If the receiver was still alive, it may still want to queue work, and do
drbd_flush_workqueue() from it's disconnect cleanup code,
which would no longer be processed by an exiting worker.

This also would deadlock,
if the worker was to synchornously wait for the receiver to die.

Do not implicitly stop the worker.
The worker will only be stopped from configuration context, from
conn_reconfig_done(), drbd_adm_down() or drbd_adm_delete_connection(),
after making sure the receiver is already stopped.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: fix race when forcefully disconnecting
Lars Ellenberg [Mon, 2 May 2011 08:45:05 +0000 (10:45 +0200)]
drbd: fix race when forcefully disconnecting

If a forced disconnect hits a restarting receiver right after it passed
its final "if (C_DISCONNECTING)" test in drbdd_init(), but before it was
actually restarted by drbd_thread_setup, we could be left with a
connection stuck in C_DISCONNECTING, never reaching C_STANDALONE,
which would be necessary to take it down or reconfigure it.

Move the last cleanup into w_after_conn_state_ch(), and do an additional
state change request in conn_try_disconnect(), just in case.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>