GitHub/LineageOS/android_kernel_motorola_exynos9610.git
13 years agocciss: fix missed command status value CMD_UNABORTABLE
Stephen M. Cameron [Sat, 12 Mar 2011 09:02:30 +0000 (10:02 +0100)]
cciss: fix missed command status value CMD_UNABORTABLE

and fix a nearby typo, "do" that should have been "due"

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
13 years agocciss: remove unnecessary casts
Stephen M. Cameron [Sat, 12 Mar 2011 09:02:24 +0000 (10:02 +0100)]
cciss: remove unnecessary casts

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
13 years agocciss: Mask off error bits of c->busaddr in cmd_special_free when calling pci_free_co...
Stephen M. Cameron [Sat, 12 Mar 2011 09:02:21 +0000 (10:02 +0100)]
cciss: Mask off error bits of c->busaddr in cmd_special_free when calling pci_free_consistent

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
13 years agocciss: Inform controller we are using 32-bit tags.
Stephen M. Cameron [Sat, 12 Mar 2011 09:02:16 +0000 (10:02 +0100)]
cciss: Inform controller we are using 32-bit tags.

Controller will DMA only 32-bits of the tag per command
on completion if it knows we are only using 32-bit tags.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
13 years agocciss: hoist tag masking out of loop
Stephen M. Cameron [Sat, 12 Mar 2011 09:02:11 +0000 (10:02 +0100)]
cciss: hoist tag masking out of loop

In process_nonindexed_cmd, hoist figuring of masked tag out of loop since
it is the same throughout.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
13 years agocciss: Add missing allocation in scsi_cmd_stack_setup and corresponding deallocation
Stephen M. Cameron [Fri, 11 Mar 2011 19:07:38 +0000 (20:07 +0100)]
cciss: Add missing allocation in scsi_cmd_stack_setup and  corresponding deallocation

This bit got lost somewhere along the way.  Without this, panic.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Cc: stable@kernel.org
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
13 years agocciss: export resettable host attribute
Stephen M. Cameron [Fri, 11 Mar 2011 19:06:09 +0000 (20:06 +0100)]
cciss: export resettable host attribute

This attribute, requested by Redhat, allows kexec-tools to know
whether the controller can honor the reset_devices kernel parameter
and actually reset the controller.  For kdump to work properly it
is necessary that the reset_devices parameter be honored.  This
attribute enables kexec-tools to warn the user if they attempt to
designate a non-resettable controller as the dump device.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
13 years agodrbd: drop code present under #ifdef which is relevant to 2.6.28 and below
Or Gerlitz [Thu, 13 Jan 2011 09:43:40 +0000 (10:43 +0100)]
drbd: drop code present under #ifdef which is relevant to 2.6.28 and below

Signed-off-by: Or Gerlitz <ogerlitz@voltaire.com>
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Fixed handling of read errors on a 'VerifyS' node
Philipp Reisner [Wed, 2 Mar 2011 22:14:44 +0000 (23:14 +0100)]
drbd: Fixed handling of read errors on a 'VerifyS' node

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Fixed handling of read errors on a 'VerifyT' node
Philipp Reisner [Tue, 1 Mar 2011 14:52:35 +0000 (15:52 +0100)]
drbd: Fixed handling of read errors on a 'VerifyT' node

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Implemented real timeout checking for request processing time
Philipp Reisner [Tue, 1 Mar 2011 10:08:28 +0000 (11:08 +0100)]
drbd: Implemented real timeout checking for request processing time

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Remove unused function atodb_endio()
Andreas Gruenbacher [Tue, 25 Jan 2011 16:33:38 +0000 (17:33 +0100)]
drbd: Remove unused function atodb_endio()

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: improve log message if received sector offset exceeds local capacity
Lars Ellenberg [Mon, 24 Jan 2011 14:11:01 +0000 (15:11 +0100)]
drbd: improve log message if received sector offset exceeds local capacity

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: kill dead code
Lars Ellenberg [Mon, 24 Jan 2011 13:58:39 +0000 (14:58 +0100)]
drbd: kill dead code

This code became obsolete and unused last December with
 drbd: bitmap keep track of changes vs on-disk bitmap

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: don't BUG_ON, if bio_add_page of a single page to an empty bio fails
Lars Ellenberg [Mon, 24 Jan 2011 13:47:09 +0000 (14:47 +0100)]
drbd: don't BUG_ON, if bio_add_page of a single page to an empty bio fails

Just deal with it more gracefully, if we fail to add even a single page
to an empty bio. We used to BUG_ON() there, but it has been observed in
some Xen deployment, so we need to handle that case more robustly now.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Removed left over, now wrong comments
Philipp Reisner [Fri, 21 Jan 2011 13:13:22 +0000 (14:13 +0100)]
drbd: Removed left over, now wrong comments

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: serialize admin requests for new verify run with pending bitmap io
Lars Ellenberg [Fri, 21 Jan 2011 21:53:48 +0000 (22:53 +0100)]
drbd: serialize admin requests for new verify run with pending bitmap io

This is an addendum to
 drbd: serialize admin requests for new resync with pending bitmap io

It avoids a race that could trigger "FIXME" assert log messages.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: fix potential imbalance of ap_in_flight
Lars Ellenberg [Fri, 21 Jan 2011 16:10:37 +0000 (17:10 +0100)]
drbd: fix potential imbalance of ap_in_flight

When we receive a barrier ack, we walk the ring list of drbd requests
in the transfer log of the respective epoch, do some housekeeping,
and free those objects.

We tried to keep epochs of mirrored and unmirrored drbd requests
separate, and assert that no local-only requests are present in a
barrier_acked epoch.

It turns out that this has quite a number of corner cases and would
add bloated code without functional benefit.

We now revert the (insufficient) commits
 drbd: Fixed an issue with AHEAD -> SYNC_SOURCE transitions
 drbd: Ensure that an epoch contains only requests of one kind
and instead fix the processing of barrier acks to cope with
a mix of local-only and mirrored requests.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: silence some noisy log messages during disconnect
Lars Ellenberg [Fri, 21 Jan 2011 11:35:15 +0000 (12:35 +0100)]
drbd: silence some noisy log messages during disconnect

If we fail to send the information that we lost our disk,
we have no connection, and no disk: no access to data anymore.
That is either expected (deconfiguration), or there will be so much
noise in the logs that "Sending state failed" is not useful at all.
Drop it.

If the reason for a shorter than expected receive was a signal,
which we sent because we already decided to disconnect,
these additional log messages are confusing and useless.

This patch follows this pattern:
 - dev_warn(DEV, "short read expecting header on sock: r=%d\n", r);
 + if (!signal_pending(current))
 +  dev_warn(DEV, "short read expecting header on sock: r=%d\n", r);

Also make them all dev_warn for consistency.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: describe bitmap locking for bulk operation in finer detail
Lars Ellenberg [Fri, 21 Jan 2011 09:56:44 +0000 (10:56 +0100)]
drbd: describe bitmap locking for bulk operation in finer detail

Now that we do no longer in-place endian-swap the bitmap, we allow
selected bitmap operations (testing bits, sometimes even settting bits)
during some bulk operations.

This caused us to hit a lot of FIXME asserts similar to
FIXME asender in drbd_bm_count_bits,
bitmap locked for 'write from resync_finished' by worker
Which now is nonsense: looking at the bitmap is perfectly legal
as long as it is not being resized.

This cosmetic patch defines some flags to describe expectations in finer
detail, so the asserts in e.g. bm_change_bits_to() can be skipped if
appropriate.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: log UUIDs whenever they change
Lars Ellenberg [Thu, 20 Jan 2011 12:25:21 +0000 (13:25 +0100)]
drbd: log UUIDs whenever they change

All decisions about sync, sync direction, and wether or not to
allow a connect or attach are based on our set of UUIDs to tag a
data generation.

Log changes to the UUIDs whenever they occur,
logging "new current UUID P:Q:R:S" is more useful
than "Creating new current UUID".

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: We can not process BIOs with a size of 0
Philipp Reisner [Thu, 20 Jan 2011 15:49:33 +0000 (16:49 +0100)]
drbd: We can not process BIOs with a size of 0

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Provide hints with the error message when clearing the sync pause flag
Philipp Reisner [Thu, 20 Jan 2011 10:46:41 +0000 (11:46 +0100)]
drbd: Provide hints with the error message when clearing the sync pause flag

When the user clears the sync-pause flag, and sync stays in pause
state, give hints to the user, why it still is in pause state.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: queue bitmap writeout more intelligently
Lars Ellenberg [Thu, 20 Jan 2011 09:32:05 +0000 (10:32 +0100)]
drbd: queue bitmap writeout more intelligently

The "lazy writeout" of cleared bitmap pages happens during resync, and
should happen again once the resync finishes cleanly, or is aborted.

If resync finished cleanly, or was aborted because of peer disk
failure, we trigger the writeout from worker context in the after
state change work.

If resync was aborted because of connection failure, we should not
immediately trigger bitmap writeout, but rather postpone the
writeout to after the connection cleanup happened.  We now do it
in the receiver context from drbd_disconnect().

If resync was aborted because of local disk failure, well, there
is nothing to write to anymore.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: don't pointlessly queue bitmap send, if we lost connection
Lars Ellenberg [Thu, 20 Jan 2011 09:47:53 +0000 (10:47 +0100)]
drbd: don't pointlessly queue bitmap send, if we lost connection

This is a minor optimization and cleanup,
and also considerably reduces some harmless (but noisy) race with
the connection cleanup code.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: serialize admin requests for new resync with pending bitmap io
Lars Ellenberg [Tue, 18 Jan 2011 09:38:01 +0000 (10:38 +0100)]
drbd: serialize admin requests for new resync with pending bitmap io

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: only generate and send a new sync uuid after a successful state change
Lars Ellenberg [Wed, 12 Jan 2011 10:51:13 +0000 (11:51 +0100)]
drbd: only generate and send a new sync uuid after a successful state change

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: cleaned up __set_current_state() followed by schedule_timeout() calls
Philipp Reisner [Tue, 18 Jan 2011 14:28:59 +0000 (15:28 +0100)]
drbd: cleaned up __set_current_state() followed by schedule_timeout() calls

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Ensure that an epoch contains only requests of one kind
Philipp Reisner [Mon, 17 Jan 2011 19:27:30 +0000 (20:27 +0100)]
drbd: Ensure that an epoch contains only requests of one kind

The assert in drbd_req.c:755 forces us to have only requests of
one kind in an epoch. The two kinds we distinguish here are:
local-only or mirrored.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Fixed P_NEG_ACK processing for protocol A and B
Philipp Reisner [Mon, 17 Jan 2011 17:39:18 +0000 (18:39 +0100)]
drbd: Fixed P_NEG_ACK processing for protocol A and B

Protocol A has no P_WRITE_ACKs, but has P_NEG_ACKs.
The master bio might already be completed, therefore the
request is no longer in the collision hash.
=> Do not try to validate block_id as request

In Protocol B we might already have got a P_RECV_ACK
but then get a P_NEG_ACK after wards.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Killed an assert that is no longer valid
Philipp Reisner [Mon, 17 Jan 2011 14:14:26 +0000 (15:14 +0100)]
drbd: Killed an assert that is no longer valid

The point is that drbd_disconnect() can be called with a cstate of
WFConnection.

That happens if the user issues "drbdsetup disconnect" while the
drbd_connect() function executes. Then drbdd_init() will call
drbdd(), which in turn will return without receiving any
packets. Then drbdd_init() will end up calling drbd_disconnect()
with a cstate of WFConnection.

Bottom line: This assertion is wrong as it is, and we do not
see value in fixing it. => Removing it.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Do not drop net config if sending in drbd_send_protocol() fails
Philipp Reisner [Fri, 14 Jan 2011 23:21:15 +0000 (00:21 +0100)]
drbd: Do not drop net config if sending in drbd_send_protocol() fails

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Work on the Ahead -> SyncSource transition
Philipp Reisner [Fri, 14 Jan 2011 15:03:11 +0000 (16:03 +0100)]
drbd: Work on the Ahead -> SyncSource transition

The test if rs_pending_cnt == 0 was too weak. Using Test for
unacked_cnt == 0 instead. Moved that into the worker.

Since unacked_cnt gets already increased when an P_RS_DATA_REQ
comes in.

Also using a timer to make Ahead -> SyncSource -> Ahead cycles
slower...

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Nothing should stop SyncSource -> Ahead transitions
Philipp Reisner [Fri, 14 Jan 2011 18:20:34 +0000 (19:20 +0100)]
drbd: Nothing should stop SyncSource -> Ahead transitions

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Do not full sync if a P_SYNC_UUID packet gets lost
Philipp Reisner [Tue, 11 Jan 2011 16:42:17 +0000 (17:42 +0100)]
drbd: Do not full sync if a P_SYNC_UUID packet gets lost

See also commit from 2009-08-15
"drbd_uuid_compare(): Do not full sync in case a P_SYNC_UUID packet gets lost."

We saw cases where the History UUIDs where not as expected. So the
detection of the special case did not trigger. With the sync UUID
no longer being a random number, but deducible from the previous
bitmap UUID, the detection of this special case becomes more
reliable.

The SyncUUID now is the previous bitmap UUID + 0x1000000000000.

Rule 5a:
Cs = H1p & H1p + Offset = Bp
  Connection was lost before SyncUUID Packet came through.
  Corrent (peer) UUIDs:
   Bp = H1p
   H1p = H2p
   H2p = 0
  Become Sync target.

Rule 7a:
Cp = H1s & H1s + Offset = Bs
  Connection was lost before SyncUUID Packet came through.
  Correct (own) UUIDs:
   Bs = H1s
   H1s = H2s
   H2s = 0
  Become Sync source.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Corrected off-by-one error in DRBD_MINOR_COUNT_MAX
Philipp Reisner [Mon, 10 Jan 2011 10:15:17 +0000 (11:15 +0100)]
drbd: Corrected off-by-one error in DRBD_MINOR_COUNT_MAX

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Remove useless / wrong comments
Andreas Gruenbacher [Mon, 3 Jan 2011 14:47:08 +0000 (15:47 +0100)]
drbd: Remove useless / wrong comments

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Cleaned up the resync timer logic
Philipp Reisner [Mon, 27 Dec 2010 10:51:23 +0000 (11:51 +0100)]
drbd: Cleaned up the resync timer logic

Besides removed a few lines of code, this moves the inspection
of the state from before the queuing process to after the queuing.
I.e. more closely to the actual invocation of the work.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Be more careful with SyncSource -> Ahead transitions
Philipp Reisner [Thu, 23 Dec 2010 13:24:33 +0000 (14:24 +0100)]
drbd: Be more careful with SyncSource -> Ahead transitions

We may not get from SyncSource to Ahead if we have sent some
P_RS_DATA_REPLY packets to the peer and are waiting for
P_WRITE_ACK.

Again, this is not relevant for proper tuned systems, but makes
sure that the not-tuned system does not get diverging bitmaps.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: No longer answer P_RS_DATA_REQUEST packets when in C_AHEAD mode
Philipp Reisner [Mon, 27 Dec 2010 09:53:28 +0000 (10:53 +0100)]
drbd: No longer answer P_RS_DATA_REQUEST packets when in C_AHEAD mode

When the sync source node replies to a P_RS_DATA_REQUEST packet
when it is already in ahead mode. I.e. those two packets
crossed each other on the wire, that may lead to diverging
bitmaps.

  This never happens in a well-tuned-system. In a well-tuned-
  system the resync controller has reduced the resync speed
  to zero long before we got into ahead-mode.

But we have to be prepared for the not-well-tuned-system
of course as well.
Because -> diverging bitmaps = non terminating resync.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Fixed an issue with AHEAD -> SYNC_SOURCE transitions
Philipp Reisner [Wed, 22 Dec 2010 11:48:31 +0000 (12:48 +0100)]
drbd: Fixed an issue with AHEAD -> SYNC_SOURCE transitions

Create a new barrier when leaving the AHEAD mode.

  Otherwise we trigger the assertion in req_mod(, barrier_acked)
  D_ASSERT(req->rq_state & RQ_NET_SENT);

The new barrier is created by recycling the newest existing one.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: ratelimit io error messages
Lars Ellenberg [Mon, 20 Dec 2010 14:38:07 +0000 (15:38 +0100)]
drbd: ratelimit io error messages

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: There might be a resync after unfreezing IO due to no disk [Bugz 332]
Philipp Reisner [Mon, 20 Dec 2010 13:48:20 +0000 (14:48 +0100)]
drbd: There might be a resync after unfreezing IO due to no disk [Bugz 332]

When on-no-data-accessible is set to suspend-io, also consider that
a Primary, SyncTarget node losses its connection.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: fix potential access of on-stack wait_queue_head_t after return
Lars Ellenberg [Sun, 19 Dec 2010 10:29:55 +0000 (11:29 +0100)]
drbd: fix potential access of on-stack wait_queue_head_t after return

I run into something declaring itself as "spinlock deadlock",
 BUG: spinlock lockup on CPU#1, kjournald/27816, ffff88000ad6bca0
 Pid: 27816, comm: kjournald Tainted: G        W 2.6.34.6 #2
 Call Trace:
  <IRQ>  [<ffffffff811ba0aa>] do_raw_spin_lock+0x11e/0x14d
  [<ffffffff81340fde>] _raw_spin_lock_irqsave+0x6a/0x81
  [<ffffffff8103b694>] ? __wake_up+0x22/0x50
  [<ffffffff8103b694>] __wake_up+0x22/0x50
  [<ffffffffa07ff661>] bm_async_io_complete+0x258/0x299 [drbd]
but the call traces do not fit at all,
all other cpus are cpu_idle.

I think it may be this race:

drbd_bm_write_page
 wait_queue_head_t io_wait;
 atomic_t in_flight;
 bm_async_io
  submit_bio
bm_async_io_complete
  if (atomic_dec_and_test(in_flight))
 wait_event(io_wait,
atomic_read(in_flight) == 0)
 return
    wake_up(io_wait)

The wake_up now accesses the wait_queue_head_t spinlock, which is no
longer valid, since the stack frame of drbd_bm_write_page has been
clobbered now.

Fix this by using struct completion, which does both the condition test
as well as the wake_up inside its spinlock, so this race cannot happen.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: improve on bitmap write out timing
Lars Ellenberg [Sat, 18 Dec 2010 16:00:59 +0000 (17:00 +0100)]
drbd: improve on bitmap write out timing

Even though we now track the need for bitmap writeout per bitmap page,
there is no need to trigger the writeout while a resync is going on.

Once the resync is finished (or aborted),
we trigger bitmap writeout anyways.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: spelling fix in log message
Lars Ellenberg [Sat, 18 Dec 2010 12:36:54 +0000 (13:36 +0100)]
drbd: spelling fix in log message

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: be less noisy with some log messages
Lars Ellenberg [Fri, 17 Dec 2010 22:58:41 +0000 (23:58 +0100)]
drbd: be less noisy with some log messages

We expect changes to a bitmap page in drbd_bm_write_page,
that's why we submit a copy page.

If a page changes during global writeout, that would be unexpected,
and reason to warn, though.

Also, often page writeout can be skipped (on activity log transactions
during normal operation, for example), no need to log that everytime.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: serialize sending of resync uuid with pending w_send_oos
Lars Ellenberg [Fri, 17 Dec 2010 20:14:23 +0000 (21:14 +0100)]
drbd: serialize sending of resync uuid with pending w_send_oos

To improve the latency of IO requests during bitmap exchange,
we recently allowed writes while waiting for the bitmap, sending "set
out-of-sync" information packets for any newly dirtied bits.

We have to make sure that the new resync-uuid does not overtake
these "set oos" packets. Once the resync-uuid is received, the
sync target starts the resync process, and expects the bitmap to
only be cleared, not re-set.

If we use this protocol extension, we queue the generation and sending
of the resync-uuid on the worker, which naturally serializes with all
previously queued packets.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: add debugging assert to make sure the protocol is clean
Lars Ellenberg [Fri, 17 Dec 2010 20:06:18 +0000 (21:06 +0100)]
drbd: add debugging assert to make sure the protocol is clean

We expect to only receive the recently introduced "set out of sync"
packets in specific states. If we receive them in different states, that
may confuse the resync process to the point where it won't terminate, or
think it made negative progress.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Documenting drbd_should_do_remote() and drbd_should_send_oos()
Philipp Reisner [Mon, 20 Dec 2010 14:29:28 +0000 (15:29 +0100)]
drbd: Documenting drbd_should_do_remote() and drbd_should_send_oos()

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: fix potential dereference of NULL pointer
Lars Ellenberg [Thu, 16 Dec 2010 14:41:26 +0000 (15:41 +0100)]
drbd: fix potential dereference of NULL pointer

If drbd used to have crypto digest algorithms configured, then is being
unconfigured (but not unloaded), it frees the algorithms, but does not
reset the config.  If it then is reconfigured to use the very same
algorithm, it "forgot" to re-allocate the algorithms, thinking that the
config has not changed in that aspect.
It will then Oops on the first attempt to actually use those algorithms.

Fix this by resetting the config to defaults after cleanup.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: move bitmap write from resync_finished to after_state_change
Lars Ellenberg [Thu, 16 Dec 2010 13:47:39 +0000 (14:47 +0100)]
drbd: move bitmap write from resync_finished to after_state_change

We must not call it directly from resync_finished,
as we may be in either receiver or worker context there.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Removed a reference to debug macros removed long time ago
Lars Ellenberg [Wed, 15 Dec 2010 23:37:57 +0000 (00:37 +0100)]
drbd: Removed a reference to debug macros removed long time ago

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: get rid of unused debug code
Lars Ellenberg [Wed, 15 Dec 2010 23:32:38 +0000 (00:32 +0100)]
drbd: get rid of unused debug code

Long time ago, we had paranoia code in the bitmap that allocated one
extra word, assigned a magic value, and checked on every occasion that
the magic value was still unchanged.

That debug code is unused, the extra long word complicates code a bit.
Get rid of it.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: allow petabyte storage on 64bit arch
Lars Ellenberg [Tue, 14 Dec 2010 14:13:04 +0000 (15:13 +0100)]
drbd: allow petabyte storage on 64bit arch

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: bitmap keep track of changes vs on-disk bitmap
Lars Ellenberg [Wed, 15 Dec 2010 07:59:11 +0000 (08:59 +0100)]
drbd: bitmap keep track of changes vs on-disk bitmap

When we set or clear bits in a bitmap page,
also set a flag in the page->private pointer.

This allows us to skip writes of unchanged pages.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: store in-core bitmap little endian, regardless of architecture
Lars Ellenberg [Wed, 15 Dec 2010 07:59:09 +0000 (08:59 +0100)]
drbd: store in-core bitmap little endian, regardless of architecture

Our on-disk bitmap is a little endian bitstream.
Up to now, we have stored the in-core copy of that in
native endian, applying byte order conversion when necessary.

Instead, keep the bitmap pages little endian, as they are read from disk,
and use the generic_*_le_bit family of functions.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: bitmap: don't count unused bits (fix non-terminating resync)
Lars Ellenberg [Wed, 15 Dec 2010 22:21:39 +0000 (23:21 +0100)]
drbd: bitmap: don't count unused bits (fix non-terminating resync)

We trusted the on-disk bitmap to have unused bits cleared.
In case that is not true for whatever reason,
and we take a code path where the unused bits don't get cleared
elsewhere (bm_clear_surplus is not called), we may miscount the bits,
and get confused during resync, waiting for bits to get cleared that we
don't even use: the resync process would not terminate.

Fix this by masking out unused bits in __bm_count_bits.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Rename __inc_ap_bio_cond to may_inc_ap_bio
Andreas Gruenbacher [Mon, 13 Dec 2010 17:03:38 +0000 (18:03 +0100)]
drbd: Rename __inc_ap_bio_cond to may_inc_ap_bio

The old name is confusing: the function does not increment anything.
Also rename _inc_ap_bio_cond to inc_ap_bio_cond: there is no need for
an underscore.
Finally, make it clear that these functions return boolean values.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Fix: drbd_bitmap_io does not return an enum determine_dev_size
Andreas Gruenbacher [Sun, 12 Dec 2010 16:45:41 +0000 (17:45 +0100)]
drbd: Fix: drbd_bitmap_io does not return an enum determine_dev_size

I guess bitmap I/O errors are supposed to cause drbd_determin_dev_size
to return dev_size_error.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: receive_bitmap_plain: Get rid of ugly and useless enum
Andreas Gruenbacher [Sat, 11 Dec 2010 20:53:12 +0000 (21:53 +0100)]
drbd: receive_bitmap_plain: Get rid of ugly and useless enum

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: send_bitmap_rle_or_plain: Get rid of ugly and useless enum
Andreas Gruenbacher [Sat, 11 Dec 2010 17:51:50 +0000 (18:51 +0100)]
drbd: send_bitmap_rle_or_plain: Get rid of ugly and useless enum

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: receive_bitmap: Missing free_page() on error path
Andreas Gruenbacher [Fri, 10 Dec 2010 21:18:27 +0000 (22:18 +0100)]
drbd: receive_bitmap: Missing free_page() on error path

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: receive_bitmap: Avoid casting enum drbd_state_rv to int
Andreas Gruenbacher [Fri, 10 Dec 2010 20:04:00 +0000 (21:04 +0100)]
drbd: receive_bitmap: Avoid casting enum drbd_state_rv to int

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: receive_bitmap: Fix the wrong return value
Andreas Gruenbacher [Fri, 10 Dec 2010 16:09:10 +0000 (17:09 +0100)]
drbd: receive_bitmap: Fix the wrong return value

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: drbd_nl_disk_conf: Avoid a compiler warning
Andreas Gruenbacher [Fri, 10 Dec 2010 12:44:05 +0000 (13:44 +0100)]
drbd: drbd_nl_disk_conf: Avoid a compiler warning

Warning: comparison between ‘enum drbd_ret_code’ and ‘enum drbd_state_rv’

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Use the standard bool, true, and false keywords
Andreas Gruenbacher [Thu, 9 Dec 2010 14:03:57 +0000 (15:03 +0100)]
drbd: Use the standard bool, true, and false keywords

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: This code is dead now
Andreas Gruenbacher [Thu, 9 Dec 2010 13:23:27 +0000 (14:23 +0100)]
drbd: This code is dead now

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Another small enum drbd_state_rv cleanup
Andreas Gruenbacher [Thu, 9 Dec 2010 13:02:35 +0000 (14:02 +0100)]
drbd: Another small enum drbd_state_rv cleanup

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Be more explicit about functions that return an enum drbd_state_rv
Andreas Gruenbacher [Tue, 7 Dec 2010 23:39:32 +0000 (00:39 +0100)]
drbd: Be more explicit about functions that return an enum drbd_state_rv

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Rename enum drbd_state_ret_codes to enum drbd_state_rv
Andreas Gruenbacher [Wed, 8 Dec 2010 00:06:16 +0000 (01:06 +0100)]
drbd: Rename enum drbd_state_ret_codes to enum drbd_state_rv

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Rename enum drbd_ret_codes to enum drbd_ret_code
Andreas Gruenbacher [Wed, 8 Dec 2010 12:33:11 +0000 (13:33 +0100)]
drbd: Rename enum drbd_ret_codes to enum drbd_ret_code

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Get rid of unnecessary macros (2)
Andreas Gruenbacher [Tue, 7 Dec 2010 09:43:29 +0000 (10:43 +0100)]
drbd: Get rid of unnecessary macros (2)

The FAULT_ACTIVE macro just wraps the drbd_insert_fault macro for no
apparent reason.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Get rid of unnecessary macros (1)
Andreas Gruenbacher [Tue, 7 Dec 2010 02:01:41 +0000 (03:01 +0100)]
drbd: Get rid of unnecessary macros (1)

This macro doesn't save much code, but makes things a lot harder to read.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Rename drbd_make_request_26 to drbd_make_request
Andreas Gruenbacher [Mon, 13 Dec 2010 16:48:19 +0000 (17:48 +0100)]
drbd: Rename drbd_make_request_26 to drbd_make_request

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Remove left-over prototype
Andreas Gruenbacher [Thu, 9 Dec 2010 15:23:43 +0000 (16:23 +0100)]
drbd: Remove left-over prototype

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Make sure that drbd_send() has sent the right number of bytes
Andreas Gruenbacher [Thu, 9 Dec 2010 15:08:46 +0000 (16:08 +0100)]
drbd: Make sure that drbd_send() has sent the right number of bytes

Reviewed-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
13 years agodrbd: fix incomplete error message
Lars Ellenberg [Thu, 9 Dec 2010 14:21:02 +0000 (15:21 +0100)]
drbd: fix incomplete error message

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Removed an unnecessary #undef
Andreas Gruenbacher [Wed, 8 Dec 2010 18:02:09 +0000 (19:02 +0100)]
drbd: Removed an unnecessary #undef

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: fix regression, we need to close drbd epochs during normal operation
Lars Ellenberg [Sun, 5 Dec 2010 13:11:14 +0000 (14:11 +0100)]
drbd: fix regression, we need to close drbd epochs during normal operation

commit e2041475e6ddb081734d161f6421977323f5a9b9
drbd: Starting with protocol 96 we can allow app-IO while receiving the bitmap

Contained a bad chunk that tried to optimize away drbd barriers during
bitmap exchange, but accidentally dropped them for normal mode as well.

Impact: depending on activity log size and access pattern, activity log
extents may not be recycled in time, causeing IO to block indefinetely.

Fix: skip drbd barriers only if there is no connection to send them on,
or the request being completed has not been on the network at all.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Implemented the before-resync-source handler
Philipp Reisner [Fri, 3 Dec 2010 15:04:24 +0000 (16:04 +0100)]
drbd: Implemented the before-resync-source handler

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: --force option for disconnect
Philipp Reisner [Fri, 3 Dec 2010 14:22:48 +0000 (15:22 +0100)]
drbd: --force option for disconnect

As the network connection can be lost at any time, a --force option
for disconnect is just a matter of completeness.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: add packet_type 27 (return_code_only) to netlink api
Lars Ellenberg [Wed, 24 Nov 2010 09:11:14 +0000 (10:11 +0100)]
drbd: add packet_type 27 (return_code_only) to netlink api

In case we ever should add an other packet type,
we must not reuse 27, as that currently used for
"empty" return code only replies.
Document it as such.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: use kzalloc and memset(,0,) to start with clean buffers in drbd_nl
Lars Ellenberg [Wed, 24 Nov 2010 09:41:45 +0000 (10:41 +0100)]
drbd: use kzalloc and memset(,0,) to start with clean buffers in drbd_nl

Make sure we start with clean buffers to not accidentally send garbage
back to userspace. Note: has not been observed; but just in case.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: remove /proc/drbd before unregistering from netlink
Lars Ellenberg [Wed, 24 Nov 2010 09:37:35 +0000 (10:37 +0100)]
drbd: remove /proc/drbd before unregistering from netlink

There still exists a (theoretical) race on module unload, where
/proc/drbd may still exist, but the netlink callback has been
unregistered already, allowing drbdsetup to shout without listeners,
and get no reply.

Reorder remove_proc_entry and unregister of netlink callback.
drbdsetup first checks for existence of the proc entry,
and if that is missing, won't even try to contact the module.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: increase module count on /proc/drbd access
Lars Ellenberg [Wed, 24 Nov 2010 09:33:02 +0000 (10:33 +0100)]
drbd: increase module count on /proc/drbd access

If someone holds /proc/drbd open, previously rmmod would
"succeed" in starting the unload, but then block on remove_proc_entry,
leading to a situation where the lsmod does not show drbd anymore,
but /proc/drbd being still there (but no longer accessible).

I'd rather have rmmod fail up front in this case.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Removed 20 seconds upper bound for side-stepping
Philipp Reisner [Mon, 22 Nov 2010 14:49:17 +0000 (15:49 +0100)]
drbd: Removed 20 seconds upper bound for side-stepping

Given low-enough network bandwidth combined with a IO
pattern that hammers onto a single RS-extent, side-stepping
might be necessary for much longer times.

Changed the code to print a single informal message after
20 seconds, but it keeps on stepping aside forever.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Becoming sync target may not happen out of < C_WF_REPORT_PARAMS
Philipp Reisner [Mon, 22 Nov 2010 13:18:47 +0000 (14:18 +0100)]
drbd: Becoming sync target may not happen out of < C_WF_REPORT_PARAMS

This patch is acutally a necessary addendum to the patch
"fix for spurious full sync (becoming sync target looked like invalidate)"

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Starting with protocol 96 we can allow app-IO while receiving the bitmap
Philipp Reisner [Wed, 10 Nov 2010 11:08:37 +0000 (12:08 +0100)]
drbd: Starting with protocol 96 we can allow app-IO while receiving the bitmap

* C_STARTING_SYNC_S, C_STARTING_SYNC_T In these states the bitmap gets
  written to disk. Locking out of app-IO is done by using the
  drbd_queue_bitmap_io() and drbd_bitmap_io() functions these days.
  It is no longer necessary to lock out app-IO based on the connection
  state.
  App-IO that may come in after the BITMAP_IO flag got cleared before the
  state transition to C_SYNC_(SOURCE|TARGET) does not get mirrored, sets
  a bit in the local bitmap, that is already set, therefore changes nothing.

* C_WF_BITMAP_S In this state we send updates (P_OUT_OF_SYNC packets).
  With that we make sure they have the same number of bits when going
  into the C_SYNC_(SOURCE|TARGET) connection state.

* C_UNCONNECTED: The receiver starts, no need to lock out IO.

* C_DISCONNECTING: in drbd_disconnect() we had a wait_event()
  to wait until ap_bio_cnt reaches 0. Removed that.

* C_TIMEOUT, C_BROKEN_PIPE, C_NETWORK_FAILURE
  C_PROTOCOL_ERROR, C_TEAR_DOWN: Same as C_DISCONNECTING

* C_WF_REPORT_PARAMS: IO still possible since that is still
  like C_WF_CONNECTION.

And we do not need to send barriers in C_WF_BITMAP_S connection state.

Allow concurrent accesses to the bitmap when receiving the bitmap.
Everything gets ORed anyways.

A drbd_free_tl_hash() is in after_state_chg_work(). At that point
all the work items of the last connections must have been processed.

Introduced a call to drbd_free_tl_hash() into drbd_free_mdev()
for paranoia reasons.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Improvements in sanitize_state()
Philipp Reisner [Wed, 17 Nov 2010 15:54:36 +0000 (16:54 +0100)]
drbd: Improvements in sanitize_state()

The relevant change is that the state change to C_FW_BITMAP_S should
implicitly change pdsk to C_CONSISTENT. (Think of it as C_OUTDATED, only
without the guarantee that the peer has the outdated written to its
meta data)

At that opportunity I restructured the switch statement so that it
gets evaluated every time. (Has declarative character)

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Fixed race condition in drbd_queue_bitmap_io
Philipp Reisner [Tue, 16 Nov 2010 14:30:44 +0000 (15:30 +0100)]
drbd: Fixed race condition in drbd_queue_bitmap_io

May only test for ap_bio_cnt == 0 under req_lock. It can increase
only under req_lock.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Fixed inc_ap_bio()
Philipp Reisner [Wed, 17 Nov 2010 17:24:19 +0000 (18:24 +0100)]
drbd: Fixed inc_ap_bio()

The condition must be checked after perpare_to_wait(). The old
implementaion could loose wakeup events. Never observed in real
life.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: use test_and_set_bit() to decide if bm_io_work should be queued
Philipp Reisner [Tue, 16 Nov 2010 09:07:53 +0000 (10:07 +0100)]
drbd: use test_and_set_bit() to decide if bm_io_work should be queued

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Begin to account BIO processing time before inc_ap_bio()
Philipp Reisner [Tue, 9 Nov 2010 16:45:06 +0000 (17:45 +0100)]
drbd: Begin to account BIO processing time before inc_ap_bio()

Since inc_ap_bio() might sleep already

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Implemented side-stepping in drbd_res_begin_io()
Philipp Reisner [Tue, 9 Nov 2010 12:59:41 +0000 (13:59 +0100)]
drbd: Implemented side-stepping in drbd_res_begin_io()

Before:
  drbd_rs_begin_io() locked app-IO out of an RS extent, and
  waited then until all previous app-IO in that area finished.
  (But not only until the disk-IO was finished but until the
   barrier/epoch ack came in for that == round trip time latency ++)

After:
  As soon as a new app-IO waits wants to start new IO on that
  RS extent, drbd_rs_begin_io() steps aside (clearing the
  BME_NO_WRITES flag again). It retries after 100ms.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Make some functions static
Philipp Reisner [Sun, 7 Nov 2010 17:02:56 +0000 (18:02 +0100)]
drbd: Make some functions static

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Implemented priority inheritance for resync requests
Philipp Reisner [Sun, 7 Nov 2010 14:56:29 +0000 (15:56 +0100)]
drbd: Implemented priority inheritance for resync requests

We only issue resync requests if there is no significant application IO
going on. = Application IO has higher priority than resnyc IO.

If application IO can not be started because the resync process locked
an resync_lru entry, start the IO operations necessary to release the
lock ASAP.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: Do not cleanup resync LRU for the Ahead/Behind SyncSource/SyncTarget transitions
Philipp Reisner [Fri, 29 Oct 2010 10:44:20 +0000 (12:44 +0200)]
drbd: Do not cleanup resync LRU for the Ahead/Behind SyncSource/SyncTarget transitions

This one should be replaced with moving this cleanup to the
'right' position.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: When proxy's buffer drained off go into regular resync mode
Philipp Reisner [Wed, 27 Oct 2010 15:32:36 +0000 (17:32 +0200)]
drbd: When proxy's buffer drained off go into regular resync mode

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
13 years agodrbd: New packet for Ahead/Behind mode: P_OUT_OF_SYNC
Philipp Reisner [Wed, 27 Oct 2010 12:33:00 +0000 (14:33 +0200)]
drbd: New packet for Ahead/Behind mode: P_OUT_OF_SYNC

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