summaryrefslogtreecommitdiffstats
path: root/drivers/block/drbd/drbd_main.c
diff options
context:
space:
mode:
authorLars Ellenberg2010-04-01 16:59:32 +0200
committerPhilipp Reisner2010-05-18 01:08:18 +0200
commit8d4ce82b3ccd755c8ba401469ced5286b1e02284 (patch)
tree9cd1b789104e4570294893856b49d3fb150379b5 /drivers/block/drbd/drbd_main.c
parentdrbd: fix potential protocol error (diff)
downloadkernel-qcow2-linux-8d4ce82b3ccd755c8ba401469ced5286b1e02284.tar.gz
kernel-qcow2-linux-8d4ce82b3ccd755c8ba401469ced5286b1e02284.tar.xz
kernel-qcow2-linux-8d4ce82b3ccd755c8ba401469ced5286b1e02284.zip
drbd: don't start a resync without access to up-to-date Data
In case both nodes are "inconsistent", invalidate would have started a resync anyways, without a chance to ever succeed, just filling the logs with warning messages. Simply disallow that state change, re-using the SS_NO_UP_TO_DATE_DISK return value. This also changes the corresponding error string to "Need access to UpToDate Data" -- I found the "Refusing to be Primary without at least one UpToDate disk" answer misleading in some situations anyways. Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block/drbd/drbd_main.c')
-rw-r--r--drivers/block/drbd/drbd_main.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index b1ce5dc7c603..e181e405e244 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -684,6 +684,9 @@ static int is_valid_state(struct drbd_conf *mdev, union drbd_state ns)
else if (ns.conn > C_CONNECTED && ns.pdsk < D_INCONSISTENT)
rv = SS_NO_REMOTE_DISK;
+ else if (ns.conn > C_CONNECTED && ns.disk < D_UP_TO_DATE && ns.pdsk < D_UP_TO_DATE)
+ rv = SS_NO_UP_TO_DATE_DISK;
+
else if ((ns.conn == C_CONNECTED ||
ns.conn == C_WF_BITMAP_S ||
ns.conn == C_SYNC_SOURCE ||