linux-stable/drivers/block/drbd
Lars Ellenberg fe43ed97bb drbd: reject attach of unsuitable uuids even if connected
Multiple failure scenario:
a) all good
   Connected Primary/Secondary UpToDate/UpToDate
b) lose disk on Primary,
   Connected Primary/Secondary Diskless/UpToDate
c) continue to write to the device,
   changes only make it to the Secondary storage.
d) lose disk on Secondary,
   Connected Primary/Secondary Diskless/Diskless
e) now try to re-attach on Primary

This would have succeeded before, even though that is clearly the
wrong data set to attach to (missing the modifications from c).
Because we only compared our "effective" and the "to-be-attached"
data generation uuid tags if (device->state.conn < C_CONNECTED).

Fix: change that constraint to (device->state.pdsk != D_UP_TO_DATE)
compare the uuids, and reject the attach.

This patch also tries to improve the reverse scenario:
first lose Secondary, then Primary disk,
then try to attach the disk on Secondary.

Before this patch, the attach on the Secondary succeeds, but since commit
drbd: disconnect, if the wrong UUIDs are attached on a connected peer
the Primary will notice unsuitable data, and drop the connection hard.

Though unfortunately at a point in time during the handshake where
we cannot easily abort the attach on the peer without more
refactoring of the handshake.

We now reject any attach to "unsuitable" uuids,
as long as we can see a Primary role,
unless we already have access to "good" data.

Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2018-12-20 09:51:30 -07:00
..
drbd_actlog.c block: replace bi_bdev with a gendisk pointer and partitions index 2017-08-23 12:49:55 -06:00
drbd_bitmap.c drbd: convert to bioset_init()/mempool_init() 2018-05-30 15:33:32 -06:00
drbd_debugfs.c block drivers/block: Use octal not symbolic permissions 2018-05-24 13:38:59 -06:00
drbd_debugfs.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
drbd_int.h drbd: centralize printk reporting of new size into drbd_set_my_capacity() 2018-12-20 09:51:29 -07:00
drbd_interval.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
drbd_interval.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
drbd_main.c drbd: centralize printk reporting of new size into drbd_set_my_capacity() 2018-12-20 09:51:29 -07:00
drbd_nl.c drbd: reject attach of unsuitable uuids even if connected 2018-12-20 09:51:30 -07:00
drbd_nla.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
drbd_nla.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
drbd_proc.c drbd: switch to proc_create_single 2018-05-16 07:24:30 +02:00
drbd_protocol.h block: Finish renaming REQ_DISCARD into REQ_OP_DISCARD 2018-10-03 16:12:28 -06:00
drbd_receiver.c drbd: reject attach of unsuitable uuids even if connected 2018-12-20 09:51:30 -07:00
drbd_req.c block: Finish renaming REQ_DISCARD into REQ_OP_DISCARD 2018-10-03 16:12:28 -06:00
drbd_req.h drbd: convert to bioset_init()/mempool_init() 2018-05-30 15:33:32 -06:00
drbd_state.c drbd: must not use connection after kref_put(&connection->kref) 2018-12-20 09:51:29 -07:00
drbd_state.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
drbd_state_change.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
drbd_strings.c drbd: code cleanups without semantic changes 2016-06-13 21:43:07 -06:00
drbd_strings.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
drbd_vli.h Fix common misspellings 2011-03-31 11:26:23 -03:00
drbd_worker.c block: Finish renaming REQ_DISCARD into REQ_OP_DISCARD 2018-10-03 16:12:28 -06:00
Kconfig drivers/block: remove redundant 'default n' from Kconfig-s 2018-10-10 14:11:08 -06:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00