platform/upstream/kernel-adaptation-pc.git
11 years agodrbd: drbd_send_ack_{dp,rp}(): Return void: the result is never used
Andreas Gruenbacher [Wed, 16 Mar 2011 00:30:14 +0000 (01:30 +0100)]
drbd: drbd_send_ack_{dp,rp}(): Return void: the result is never used

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: drbd_send_ack(): Return 0 upon success and an error code otherwise
Andreas Gruenbacher [Wed, 16 Mar 2011 14:39:08 +0000 (15:39 +0100)]
drbd: drbd_send_ack(): Return 0 upon success and an error code otherwise

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: _drbd_send_ack(): Return 0 upon success and an error code otherwise
Andreas Gruenbacher [Wed, 16 Mar 2011 00:27:22 +0000 (01:27 +0100)]
drbd: _drbd_send_ack(): Return 0 upon success and an error code otherwise

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: drbd_send_b_ack(): Return void: the result is never used
Andreas Gruenbacher [Wed, 16 Mar 2011 00:25:28 +0000 (01:25 +0100)]
drbd: drbd_send_b_ack(): Return void: the result is never used

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: drbd_send_sr_reply(): Return void: the result is never used
Andreas Gruenbacher [Wed, 16 Mar 2011 00:20:38 +0000 (01:20 +0100)]
drbd: drbd_send_sr_reply(): Return void: the result is never used

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: drbd_send_state_req(): Return 0 upon success and an error code otherwise
Andreas Gruenbacher [Wed, 16 Mar 2011 00:19:27 +0000 (01:19 +0100)]
drbd: drbd_send_state_req(): Return 0 upon success and an error code otherwise

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: conn_send_state_req(): Return 0 upon success and an error code otherwise
Andreas Gruenbacher [Wed, 16 Mar 2011 00:17:35 +0000 (01:17 +0100)]
drbd: conn_send_state_req(): Return 0 upon success and an error code otherwise

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: _conn_send_state_req(): Return 0 upon success and an error code otherwise
Andreas Gruenbacher [Wed, 16 Mar 2011 00:16:25 +0000 (01:16 +0100)]
drbd: _conn_send_state_req(): Return 0 upon success and an error code otherwise

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: drbd_send_sizes(): Return 0 upon success and an error code otherwise
Andreas Gruenbacher [Wed, 16 Mar 2011 00:12:50 +0000 (01:12 +0100)]
drbd: drbd_send_sizes(): Return 0 upon success and an error code otherwise

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: drbd_gen_and_send_sync_uuid(): Return void: the result is never used
Andreas Gruenbacher [Wed, 16 Mar 2011 00:09:01 +0000 (01:09 +0100)]
drbd: drbd_gen_and_send_sync_uuid(): Return void: the result is never used

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: drbd_send_uuids() and its variants: Return 0 upon success and an error code...
Andreas Gruenbacher [Wed, 16 Mar 2011 00:07:20 +0000 (01:07 +0100)]
drbd: drbd_send_uuids() and its variants: Return 0 upon success and an error code otherwise

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: drbd_send_protocol(): Return 0 upon success and an error code otherwise
Andreas Gruenbacher [Wed, 16 Mar 2011 00:05:37 +0000 (01:05 +0100)]
drbd: drbd_send_protocol(): Return 0 upon success and an error code otherwise

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: drbd_send_handshake(): Return 0 upon success and an error code otherwise
Andreas Gruenbacher [Tue, 15 Mar 2011 23:54:19 +0000 (00:54 +0100)]
drbd: drbd_send_handshake(): Return 0 upon success and an error code otherwise

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: drbd_send_state(): Return 0 upon success and an error code otherwise
Andreas Gruenbacher [Tue, 15 Mar 2011 23:50:00 +0000 (00:50 +0100)]
drbd: drbd_send_state(): Return 0 upon success and an error code otherwise

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: drbd_send_sync_param(): Return 0 upon success and an error code otherwise
Andreas Gruenbacher [Tue, 15 Mar 2011 23:43:02 +0000 (00:43 +0100)]
drbd: drbd_send_sync_param(): Return 0 upon success and an error code otherwise

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: drbd_send_cmd(): Return 0 upon success and an error code otherwise
Andreas Gruenbacher [Tue, 15 Mar 2011 23:38:58 +0000 (00:38 +0100)]
drbd: drbd_send_cmd(): Return 0 upon success and an error code otherwise

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Get rid of USE_DATA_SOCKET and USE_META_SOCKET
Andreas Gruenbacher [Tue, 15 Mar 2011 23:11:25 +0000 (00:11 +0100)]
drbd: Get rid of USE_DATA_SOCKET and USE_META_SOCKET

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: conn_send_cmd(): Return 0 upon success and an error code otherwise
Andreas Gruenbacher [Tue, 15 Mar 2011 22:55:59 +0000 (23:55 +0100)]
drbd: conn_send_cmd(): Return 0 upon success and an error code otherwise

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: _drbd_send_cmd(): Return 0 upon success and an error code otherwise
Andreas Gruenbacher [Tue, 15 Mar 2011 22:51:21 +0000 (23:51 +0100)]
drbd: _drbd_send_cmd(): Return 0 upon success and an error code otherwise

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: _conn_send_cmd(): Return 0 upon success and an error code otherwise
Andreas Gruenbacher [Tue, 15 Mar 2011 22:48:25 +0000 (23:48 +0100)]
drbd: _conn_send_cmd(): Return 0 upon success and an error code otherwise

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: conn_send_cmd2(): Return 0 upon success and an error code otherwise
Andreas Gruenbacher [Tue, 15 Mar 2011 22:34:29 +0000 (23:34 +0100)]
drbd: conn_send_cmd2(): Return 0 upon success and an error code otherwise

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Add drbd_send_all(): Send an entire buffer
Andreas Gruenbacher [Wed, 15 Dec 2010 16:04:36 +0000 (17:04 +0100)]
drbd: Add drbd_send_all(): Send an entire buffer

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: drbd_get_data_sock(): Return 0 upon success and an error code otherwise
Andreas Gruenbacher [Tue, 15 Mar 2011 15:15:10 +0000 (16:15 +0100)]
drbd: drbd_get_data_sock(): Return 0 upon success and an error code otherwise

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: drbd_send(): Return a "real" error code if we have no socket
Andreas Gruenbacher [Thu, 9 Dec 2010 22:52:22 +0000 (23:52 +0100)]
drbd: drbd_send(): Return a "real" error code if we have no socket

Q: Can this case even trigger?  Is failing this way any better than one
that causes a NULL pointer access?

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Fixed conn_lowest_minor
Philipp Reisner [Tue, 22 Mar 2011 11:51:21 +0000 (12:51 +0100)]
drbd: Fixed conn_lowest_minor

It actually returned the lowest volume number. While doing that
renamed a few wrongly named variables.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: distribute former syncer_conf settings to disk, connection, and resource level
Lars Ellenberg [Wed, 23 Mar 2011 13:31:09 +0000 (14:31 +0100)]
drbd: distribute former syncer_conf settings to disk, connection, and resource level

This commit breaks the API again.

Move per-volume former syncer options into disk_conf.
Move per-connection former syncer options into net_conf.
Renamed the remainign sync_conf to res_opts

Syncer settings have been changeable at runtime, so we need to prepare
for these settings to be runtime-changeable in their new home as well.

Introduce new configuration operations, and share the netlink attribute
between "attach" (create new disk) and "disk-opts" (change options).
Same for "connect" and "net-opts".

Some fields cannot be changed at runtime, however.
Introduce a new flag GENLA_F_INVARIANT to be able to trigger on that in
the generated validation and assignment functions.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: conn_khelper() for user mode callbacks for connections
Philipp Reisner [Wed, 16 Mar 2011 16:39:12 +0000 (17:39 +0100)]
drbd: conn_khelper() for user mode callbacks for connections

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Allow volumes to become primary only on one side
Philipp Reisner [Wed, 16 Mar 2011 13:43:36 +0000 (14:43 +0100)]
drbd: Allow volumes to become primary only on one side

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: fix conn_reconfig_start without conn_reconfig_done in drbd_adm_attach
Lars Ellenberg [Wed, 16 Mar 2011 15:52:10 +0000 (16:52 +0100)]
drbd: fix conn_reconfig_start without conn_reconfig_done in drbd_adm_attach

If drbd_adm_attach failed early, it left the CONFIG_PENDING bit on,
blocking any further conn_reconfig_start on that connection.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Separate connection state changes from minor dev state changes #2
Philipp Reisner [Wed, 16 Mar 2011 10:27:48 +0000 (11:27 +0100)]
drbd: Separate connection state changes from minor dev state changes #2

New function got_conn_RqSReply()

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Converted got_Ping() and got_PingAck() from mdev to tconn
Philipp Reisner [Wed, 16 Mar 2011 10:21:50 +0000 (11:21 +0100)]
drbd: Converted got_Ping() and got_PingAck() from mdev to tconn

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Allow packet handler functions that take a connection (meta connection)
Philipp Reisner [Wed, 16 Mar 2011 10:13:17 +0000 (11:13 +0100)]
drbd: Allow packet handler functions that take a connection (meta connection)

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Separate connection state changes from minor dev state changes #1
Philipp Reisner [Wed, 16 Mar 2011 09:55:07 +0000 (10:55 +0100)]
drbd: Separate connection state changes from minor dev state changes #1

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Converted receive_protocol() from mdev to tconn
Philipp Reisner [Tue, 15 Mar 2011 17:51:47 +0000 (18:51 +0100)]
drbd: Converted receive_protocol() from mdev to tconn

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Allow packet handler functions that take a connection
Philipp Reisner [Tue, 15 Mar 2011 17:50:22 +0000 (18:50 +0100)]
drbd: Allow packet handler functions that take a connection

That is necessary in case a connection does not have a volume 0

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Moved CONN_DRY_RUN to the per connection (tconn) flags
Philipp Reisner [Tue, 15 Mar 2011 17:40:27 +0000 (18:40 +0100)]
drbd: Moved CONN_DRY_RUN to the per connection (tconn) flags

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Do not modify the connection state with something else that conn_request_state()
Philipp Reisner [Tue, 15 Mar 2011 17:24:49 +0000 (18:24 +0100)]
drbd: Do not modify the connection state with something else that conn_request_state()

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Allow two diskless minors to be connected
Philipp Reisner [Tue, 15 Mar 2011 16:27:47 +0000 (17:27 +0100)]
drbd: Allow two diskless minors to be connected

In the context of drbd-8.4 it no longer makes sense to
dissalow that.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: New minors have to intherit the connection state form their connection
Philipp Reisner [Tue, 15 Mar 2011 15:56:18 +0000 (16:56 +0100)]
drbd: New minors have to intherit the connection state form their connection

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: process_done_ee() has to handle unconfigured devices now
Philipp Reisner [Tue, 15 Mar 2011 15:05:42 +0000 (16:05 +0100)]
drbd: process_done_ee() has to handle unconfigured devices now

Took the chance and converted tconn_process_done_ee() to use
idr_for_each_entry()

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Ignore packets for non existing volumes
Philipp Reisner [Tue, 15 Mar 2011 13:38:01 +0000 (14:38 +0100)]
drbd: Ignore packets for non existing volumes

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: introduce in-kernel "down" command
Lars Ellenberg [Tue, 15 Mar 2011 15:26:37 +0000 (16:26 +0100)]
drbd: introduce in-kernel "down" command

This greatly simplifies deconfiguration of whole resources.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: add forgotten spin_unlock
Lars Ellenberg [Tue, 15 Mar 2011 15:04:09 +0000 (16:04 +0100)]
drbd: add forgotten spin_unlock

somehow a "goto abort" was introduced with commit
  drbd: Extracted is_valid_transition() out of sanitize_state()
which left drbd_req_state still holding the spin lock.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: bail out if a config requrest is over-determined, and not matching
Lars Ellenberg [Mon, 14 Mar 2011 12:58:03 +0000 (13:58 +0100)]
drbd: bail out if a config requrest is over-determined, and not matching

We have resources resp. connections, volumes, and minor numbers.
A config request may specifies all three of them.
If it turns out that the minor belongs to a different connection, or a
different volume number in the same connection, that configuration
request is invalid.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: new-connection and new-minor succeed, if the object already exists
Lars Ellenberg [Mon, 14 Mar 2011 12:22:35 +0000 (13:22 +0100)]
drbd: new-connection and new-minor succeed, if the object already exists

Follow O_CREAT semantics when creating connection or minor device/volume
objects.  If we need O_CREAT|O_EXCL semantics some time down the road,
we can add NLM_F_EXCL to the netlink message flags.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: Allow a Diskless Secondary volume to be removed
Lars Ellenberg [Thu, 10 Mar 2011 22:33:15 +0000 (23:33 +0100)]
drbd: Allow a Diskless Secondary volume to be removed

Even if the connection is still established.
We should be able to reduce a volume from a replication group,
without taking the whole group offline.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: simplify conn_all_vols_unconf, make it bool
Lars Ellenberg [Thu, 10 Mar 2011 22:28:13 +0000 (23:28 +0100)]
drbd: simplify conn_all_vols_unconf, make it bool

Get rid of a temporary variable and, funny bitand assignment.
Just short circuit, returning false, once we encounter the first
still configured volume.

FIXME verify call sites for need of rcu_read_lock or stronger.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: drbd_adm_get_status needs to show some more detail
Lars Ellenberg [Thu, 10 Mar 2011 21:18:18 +0000 (22:18 +0100)]
drbd: drbd_adm_get_status needs to show some more detail

We want to see existing connection objects, even if they do not
currently have volumes attached.

Change the .dumpit variant of drbd_adm_get_status to iterate not over
minor devices, but over connections + volumes.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: remove now unused connector related files
Lars Ellenberg [Mon, 7 Mar 2011 09:38:56 +0000 (10:38 +0100)]
drbd: remove now unused connector related files

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: allow holes in minor and volume id allocation
Lars Ellenberg [Tue, 8 Mar 2011 15:11:16 +0000 (16:11 +0100)]
drbd: allow holes in minor and volume id allocation

s/idr_get_new/idr_get_new_above/

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
11 years agodrbd: switch configuration interface from connector to genetlink
Lars Ellenberg [Mon, 7 Mar 2011 11:49:34 +0000 (12:49 +0100)]
drbd: switch configuration interface from connector to genetlink

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: prepare the transition from connector to genetlink
Lars Ellenberg [Mon, 7 Mar 2011 09:20:08 +0000 (10:20 +0100)]
drbd: prepare the transition from connector to genetlink

This adds the new API header and helper files.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: get rid of drbd_bcast_ee, it is of no use anymore
Lars Ellenberg [Mon, 7 Mar 2011 09:00:58 +0000 (10:00 +0100)]
drbd: get rid of drbd_bcast_ee, it is of no use anymore

This function was used to broadcast the (leading part of the)
bio payload in case we see a data integrity error.  It could be received
from userland with the drbdsetup events subcommand,
to have a peek into the payload that caused the checksum mismatch,
and guess from there what may have caused the mismatch,
mainly to guess wether it was modification of in-flight data,
or data corruption by broken hardware or software bugs.

Meanwhile we support bios that are larger than the maximum payload a
netlink datagram can carry.
And we have means to reliably detect modification of in-flight data by
calculating, and comparing, the checksum before and after sendmsg.
There is no need to carry this around anymore.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: fix drbd_delete_device: remove vnr from volumes; idr_remove(); synchronize_rcu...
Lars Ellenberg [Mon, 7 Mar 2011 08:49:02 +0000 (09:49 +0100)]
drbd: fix drbd_delete_device: remove vnr from volumes; idr_remove(); synchronize_rcu(); before cleanup

Still missing: rcu_readlock() on the various call sites that
access/iterate over those idrs.

We don't need a specific write lock, as we only modify from
configuration context, which is already strictly serialized.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: introduce a bio_set to allocate housekeeping bios from
Lars Ellenberg [Wed, 23 Feb 2011 16:02:01 +0000 (17:02 +0100)]
drbd: introduce a bio_set to allocate housekeeping bios from

Don't rely on availability of bios from the global fs_bio_set,
we should use our own bio_set for meta data IO.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: use the newly introduced page pool for bitmap IO
Lars Ellenberg [Wed, 23 Feb 2011 14:38:47 +0000 (15:38 +0100)]
drbd: use the newly introduced page pool for bitmap IO

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: add page pool to be used for meta data IO
Lars Ellenberg [Wed, 23 Feb 2011 11:39:46 +0000 (12:39 +0100)]
drbd: add page pool to be used for meta data IO

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: only wakeup if something changed in update_peer_seq
Lars Ellenberg [Wed, 23 Feb 2011 15:10:01 +0000 (16:10 +0100)]
drbd: only wakeup if something changed in update_peer_seq

This commit got it wrong:
    drbd: Make the peer_seq updating code more obvious

    Make it more clear that update_peer_seq() is supposed to wake up the
    seq_wait queue whenever the sequence number changes.

We don't need to wake up everytime we receive a sequence number
that is _different_ from our currently stored "newest" sequence number,
but only if we receive a sequence number _newer_ than what we already
have, when we actually change mdev->peer_seq.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: default to detach on-io-error
Lars Ellenberg [Wed, 23 Feb 2011 11:51:43 +0000 (12:51 +0100)]
drbd: default to detach on-io-error

Old default behaviour was "pass-on",
which is not useful in production at all.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: remove unused define
Lars Ellenberg [Wed, 23 Feb 2011 16:18:24 +0000 (17:18 +0100)]
drbd: remove unused define

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Replaced the minor_table array by an idr
Philipp Reisner [Wed, 23 Feb 2011 00:53:16 +0000 (19:53 -0500)]
drbd: Replaced the minor_table array by an idr

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Implemented new commands to create/delete connections/minors
Philipp Reisner [Tue, 22 Feb 2011 07:07:03 +0000 (02:07 -0500)]
drbd: Implemented new commands to create/delete connections/minors

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Converted drbd_nl_(net_conf|disconnect)() from mdev to tconn
Philipp Reisner [Fri, 18 Feb 2011 13:56:45 +0000 (14:56 +0100)]
drbd: Converted drbd_nl_(net_conf|disconnect)() from mdev to tconn

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Preparing the connector interface to operator on connections
Philipp Reisner [Mon, 21 Feb 2011 14:38:08 +0000 (15:38 +0100)]
drbd: Preparing the connector interface to operator on connections

Up to now it only operated on minor numbers. Now it can work also
on named connections.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Converted the transfer log from mdev to tconn
Philipp Reisner [Mon, 21 Feb 2011 13:29:27 +0000 (14:29 +0100)]
drbd: Converted the transfer log from mdev to tconn

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Improved the dec_*() macros
Philipp Reisner [Mon, 21 Feb 2011 13:19:44 +0000 (14:19 +0100)]
drbd: Improved the dec_*() macros

Now those can be used with a struct drbd_conf * that has an other
name than 'mdev'.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Removed the mdev parameter from the ..to_tags() and ...from_tags() functions
Philipp Reisner [Thu, 17 Feb 2011 21:50:23 +0000 (22:50 +0100)]
drbd: Removed the mdev parameter from the ..to_tags() and ...from_tags() functions

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Reworked the unconfiguring and thread stopping code
Philipp Reisner [Fri, 18 Feb 2011 13:23:11 +0000 (14:23 +0100)]
drbd: Reworked the unconfiguring and thread stopping code

* Moved CONFIG_PENDING and DEVICE_DYING from mdev to tconn.
* Renamed drbd_reconfig_start() and drbd_reconfig_done() to
  conn_reconfig_start() and conn_reconfig_done().

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Remove left-over function prototypes
Andreas Gruenbacher [Wed, 16 Mar 2011 13:23:53 +0000 (14:23 +0100)]
drbd: Remove left-over function prototypes

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Replace get_asender_cmd() with its implementation
Andreas Gruenbacher [Mon, 14 Mar 2011 17:23:00 +0000 (18:23 +0100)]
drbd: Replace get_asender_cmd() with its implementation

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Get rid of P_MAX_CMD
Andreas Gruenbacher [Mon, 14 Mar 2011 16:27:45 +0000 (17:27 +0100)]
drbd: Get rid of P_MAX_CMD

Instead of artificially enlarging the command decoding arrays to
P_MAX_CMD entries, check if an index is within the valid range using the
ARRAY_SIZE() macro.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Remove redundant check
Andreas Gruenbacher [Fri, 28 Jan 2011 12:28:51 +0000 (13:28 +0100)]
drbd: Remove redundant check

Opening a device only succeeds on a primary node, or when explicitly
setting the allow_oos module parameter to allow opening the device
read-only on a secondary node.  There is no other way that a request can
get into drbd_make_request(), so this code cannot trigger.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Improve how conflicting writes are handled
Andreas Gruenbacher [Tue, 22 Feb 2011 01:15:32 +0000 (02:15 +0100)]
drbd: Improve how conflicting writes are handled

The previous algorithm for dealing with overlapping concurrent writes
was generating unnecessary warnings for scenarios which could be
legitimate, and did not always handle partially overlapping requests
correctly.  Improve it algorithm as follows:

* While local or remote write requests are in progress, conflicting new
  local write requests will be delayed (commit 82172f7).

* When a conflict between a local and remote write request is detected,
  the node with the discard flag decides how to resolve the conflict: It
  will ask its peer to discard conflicting requests which are fully
  contained in the local request and retry requests which overlap only
  partially.  This involves a protocol change.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Use ping-timeout when waiting for missing ack packets
Andreas Gruenbacher [Tue, 1 Mar 2011 14:40:43 +0000 (15:40 +0100)]
drbd: Use ping-timeout when waiting for missing ack packets

When the node with the discard flag resolves write conflicts in
dual-primary mode, it may determine that its peer has sent ack packets
on the metadata socket which did not arrive, yet.  Wait for the next ack
with ping-timeout instead of a hard-coded 30 seconds.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Replace atomic_add_return with atomic_inc_return
Andreas Gruenbacher [Thu, 24 Feb 2011 10:35:43 +0000 (11:35 +0100)]
drbd: Replace atomic_add_return with atomic_inc_return

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Concurrent write detection fix
Andreas Gruenbacher [Sat, 26 Feb 2011 22:19:15 +0000 (23:19 +0100)]
drbd: Concurrent write detection fix

Commit 9b1e63e changed the concurrent write detection algorithm to only insert
peer requests into write_requests tree after determining that there is no
conflict.  With this change, new conflicting local requests could be added
while the algorithm runs, but this case was not handled correctly.  Instead of
making the algorithm deal with this case, switch back to adding peer requests
to the write_requests tree immediately: this improves fairness.

When a peer request is discarded, remove that request from the write_requests

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Use container_of() instead of casting
Andreas Gruenbacher [Fri, 18 Feb 2011 15:12:48 +0000 (16:12 +0100)]
drbd: Use container_of() instead of casting

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: fix a wrong likely(), updated comments
Lars Ellenberg [Tue, 22 Feb 2011 13:02:31 +0000 (14:02 +0100)]
drbd: fix a wrong likely(), updated comments

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: silence some log messages on bitmap IO
Lars Ellenberg [Mon, 21 Feb 2011 14:10:23 +0000 (15:10 +0100)]
drbd: silence some log messages on bitmap IO

Summary log messages meant for global bitmap IO
should not be printed for bitmap IO caused by
activity log transactions.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: new on-disk activity log transaction format
Lars Ellenberg [Mon, 21 Feb 2011 12:21:03 +0000 (13:21 +0100)]
drbd: new on-disk activity log transaction format

Use a new on-disk transaction format for the activity log, which allows
for multiple changes to the active set per transaction.

Using 4k transaction blocks, we can now get rid of the work-around code
to deal with devices not supporting 512 byte logical block size.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agolru_cache: allow multiple changes per transaction
Lars Ellenberg [Mon, 21 Feb 2011 12:21:01 +0000 (13:21 +0100)]
lru_cache: allow multiple changes per transaction

Allow multiple changes to the active set of elements in lru_cache.
The only current user of lru_cache, drbd, is driving this generalisation.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: allow to select specific bitmap pages for writeout
Lars Ellenberg [Mon, 21 Feb 2011 12:21:00 +0000 (13:21 +0100)]
drbd: allow to select specific bitmap pages for writeout

We are about to allow several changes to the active set in one activity
log transaction. We have to write out the corresponding bitmap pages as
well, if changed.

Introduce drbd_bm_mark_for_writeout(), then re-use the existing bitmap
writeout path to submit all marked pages in one go.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agolru_cache: consolidate lc_get and lc_try_get
Lars Ellenberg [Mon, 21 Feb 2011 12:20:58 +0000 (13:20 +0100)]
lru_cache: consolidate lc_get and lc_try_get

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agolru_cache.h: fix comments referring to ts_ instead of lc_
Lars Ellenberg [Mon, 21 Feb 2011 12:20:57 +0000 (13:20 +0100)]
lru_cache.h: fix comments referring to ts_ instead of lc_

For some time we contemplated calling the "struct lru_cache"
a "struct tracked_set", and some comments kept the ts_ prefix.

Fix those to match the member field names.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: use clear_bit_unlock() where appropriate
Lars Ellenberg [Mon, 21 Feb 2011 12:20:55 +0000 (13:20 +0100)]
drbd: use clear_bit_unlock() where appropriate

Some open-coded clear_bit(); smp_mb__after_clear_bit();
should in fact have been smp_mb__before_clear_bit(); clear_bit();

Instead, use clear_bit_unlock() to annotate the intention,
and have it do the right thing.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: in drbd_suspend_al, set AL_SUSPENDED before unlocking the activity log
Lars Ellenberg [Mon, 21 Feb 2011 12:20:54 +0000 (13:20 +0100)]
drbd: in drbd_suspend_al, set AL_SUSPENDED before unlocking the activity log

As using an empty activity log is the whole point of the excercise,
make sure it is still empty when setting AL_SUSPENDED.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: fix typo in comment
Lars Ellenberg [Mon, 21 Feb 2011 12:20:53 +0000 (13:20 +0100)]
drbd: fix typo in comment

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: simplify condition in drbd_may_do_local_read()
Lars Ellenberg [Fri, 18 Feb 2011 13:13:07 +0000 (14:13 +0100)]
drbd: simplify condition in drbd_may_do_local_read()

fold
if (x >= (N+1))
return 0;
if (x < N)
return 0;
into
if (x != N)
return 0;

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Use the IS_ALIGNED() macro in some more places
Andreas Gruenbacher [Mon, 21 Feb 2011 11:41:39 +0000 (12:41 +0100)]
drbd: Use the IS_ALIGNED() macro in some more places

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Remove obsolete comment
Andreas Gruenbacher [Mon, 21 Feb 2011 11:34:58 +0000 (12:34 +0100)]
drbd: Remove obsolete comment

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Iterate over all overlapping intervals in a tree
Andreas Gruenbacher [Thu, 17 Feb 2011 17:11:24 +0000 (18:11 +0100)]
drbd: Iterate over all overlapping intervals in a tree

Add a macro and helper function for doing that.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Rename drbd_endio_{pri,sec} -> drbd_{,peer_}request_endio
Andreas Gruenbacher [Thu, 17 Feb 2011 15:46:59 +0000 (16:46 +0100)]
drbd: Rename drbd_endio_{pri,sec} -> drbd_{,peer_}request_endio

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Rename drbd_submit_ee -> drbd_submit_peer_request
Andreas Gruenbacher [Thu, 17 Feb 2011 15:38:35 +0000 (16:38 +0100)]
drbd: Rename drbd_submit_ee -> drbd_submit_peer_request

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Implemented connection wide state changes
Philipp Reisner [Tue, 15 Feb 2011 10:14:44 +0000 (11:14 +0100)]
drbd: Implemented connection wide state changes

That is used for graceful disconnect only

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: implemented receiving of P_CONN_ST_CHG_REQ
Philipp Reisner [Tue, 15 Feb 2011 10:09:33 +0000 (11:09 +0100)]
drbd: implemented receiving of P_CONN_ST_CHG_REQ

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Implemented receiving of P_CONN_ST_CHG_REPLY
Philipp Reisner [Tue, 15 Feb 2011 10:07:59 +0000 (11:07 +0100)]
drbd: Implemented receiving of P_CONN_ST_CHG_REPLY

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Global_state_lock not necessary here...
Philipp Reisner [Thu, 10 Feb 2011 19:27:54 +0000 (20:27 +0100)]
drbd: Global_state_lock not necessary here...

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Implemented conn_send_state_req()
Philipp Reisner [Fri, 11 Feb 2011 14:11:24 +0000 (15:11 +0100)]
drbd: Implemented conn_send_state_req()

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Introduced tconn->cstate_mutex
Philipp Reisner [Fri, 11 Feb 2011 19:11:10 +0000 (20:11 +0100)]
drbd: Introduced tconn->cstate_mutex

In compatibility mode with old DRBDs, use that as the state_mutex
as well.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
12 years agodrbd: Removed drbd_state_lock() and drbd_state_unlock()
Philipp Reisner [Fri, 11 Feb 2011 18:43:55 +0000 (19:43 +0100)]
drbd: Removed drbd_state_lock() and drbd_state_unlock()

The lock they constructed is only taken when the state_mutex
was already taken. It is superficial.

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