aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorPhilipp Reisner <philipp.reisner@linbit.com>2012-08-28 10:48:03 -0400
committerPhilipp Reisner <philipp.reisner@linbit.com>2012-11-09 08:11:08 -0500
commit19fffd7b0303e8843aa2decfd43fa57c9d511409 (patch)
tree19ac111fafeec46eac2b0e8cee4f41f4327a1129 /drivers
parentd76440181d0e05826f228189b74b4dbf64b68981 (diff)
drbd: Call drbd_md_sync() explicitly after a state change on the connection
Without this, the meta-data gets updates after 5 seconds by the md_sync_timer. Better to do it immeditaly after a state change. If the asender detects a network failure, it may take a bit until the worker processes the according after-conn-state-change work item. The worker might be blocked in sending something, i.e. it takes until it gets into its timeout. That is 6 seconds by default which is longer than the 5 seconds of the md_sync_timer. Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/drbd/drbd_int.h1
-rw-r--r--drivers/block/drbd/drbd_main.c16
-rw-r--r--drivers/block/drbd/drbd_nl.c16
-rw-r--r--drivers/block/drbd/drbd_receiver.c1
-rw-r--r--drivers/block/drbd/drbd_state.c3
5 files changed, 21 insertions, 16 deletions
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h
index 1c1576b942b6..f223f01b4e1c 100644
--- a/drivers/block/drbd/drbd_int.h
+++ b/drivers/block/drbd/drbd_int.h
@@ -1116,6 +1116,7 @@ extern void drbd_free_bc(struct drbd_backing_dev *ldev);
1116extern void drbd_mdev_cleanup(struct drbd_conf *mdev); 1116extern void drbd_mdev_cleanup(struct drbd_conf *mdev);
1117void drbd_print_uuids(struct drbd_conf *mdev, const char *text); 1117void drbd_print_uuids(struct drbd_conf *mdev, const char *text);
1118 1118
1119extern void conn_md_sync(struct drbd_tconn *tconn);
1119extern void drbd_md_sync(struct drbd_conf *mdev); 1120extern void drbd_md_sync(struct drbd_conf *mdev);
1120extern int drbd_md_read(struct drbd_conf *mdev, struct drbd_backing_dev *bdev); 1121extern int drbd_md_read(struct drbd_conf *mdev, struct drbd_backing_dev *bdev);
1121extern void drbd_uuid_set(struct drbd_conf *mdev, int idx, u64 val) __must_hold(local); 1122extern void drbd_uuid_set(struct drbd_conf *mdev, int idx, u64 val) __must_hold(local);
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 732053de1dbf..5e5a6abb2819 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -2820,6 +2820,22 @@ void drbd_free_sock(struct drbd_tconn *tconn)
2820 2820
2821/* meta data management */ 2821/* meta data management */
2822 2822
2823void conn_md_sync(struct drbd_tconn *tconn)
2824{
2825 struct drbd_conf *mdev;
2826 int vnr;
2827
2828 rcu_read_lock();
2829 idr_for_each_entry(&tconn->volumes, mdev, vnr) {
2830 kref_get(&mdev->kref);
2831 rcu_read_unlock();
2832 drbd_md_sync(mdev);
2833 kref_put(&mdev->kref, &drbd_minor_destroy);
2834 rcu_read_lock();
2835 }
2836 rcu_read_unlock();
2837}
2838
2823struct meta_data_on_disk { 2839struct meta_data_on_disk {
2824 u64 la_size; /* last agreed size. */ 2840 u64 la_size; /* last agreed size. */
2825 u64 uuid[UI_SIZE]; /* UUIDs. */ 2841 u64 uuid[UI_SIZE]; /* UUIDs. */
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index 363034a77e88..476491ffdabc 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -363,22 +363,6 @@ int drbd_khelper(struct drbd_conf *mdev, char *cmd)
363 return ret; 363 return ret;
364} 364}
365 365
366static void conn_md_sync(struct drbd_tconn *tconn)
367{
368 struct drbd_conf *mdev;
369 int vnr;
370
371 rcu_read_lock();
372 idr_for_each_entry(&tconn->volumes, mdev, vnr) {
373 kref_get(&mdev->kref);
374 rcu_read_unlock();
375 drbd_md_sync(mdev);
376 kref_put(&mdev->kref, &drbd_minor_destroy);
377 rcu_read_lock();
378 }
379 rcu_read_unlock();
380}
381
382int conn_khelper(struct drbd_tconn *tconn, char *cmd) 366int conn_khelper(struct drbd_tconn *tconn, char *cmd)
383{ 367{
384 char *envp[] = { "HOME=/", 368 char *envp[] = { "HOME=/",
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index d5afa0a81fd0..fed34a7bef4a 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -5390,6 +5390,7 @@ int drbd_asender(struct drbd_thread *thi)
5390 if (0) { 5390 if (0) {
5391reconnect: 5391reconnect:
5392 conn_request_state(tconn, NS(conn, C_NETWORK_FAILURE), CS_HARD); 5392 conn_request_state(tconn, NS(conn, C_NETWORK_FAILURE), CS_HARD);
5393 conn_md_sync(tconn);
5393 } 5394 }
5394 if (0) { 5395 if (0) {
5395disconnect: 5396disconnect:
diff --git a/drivers/block/drbd/drbd_state.c b/drivers/block/drbd/drbd_state.c
index c3ec578918f2..84512ec19173 100644
--- a/drivers/block/drbd/drbd_state.c
+++ b/drivers/block/drbd/drbd_state.c
@@ -1563,6 +1563,9 @@ static int w_after_conn_state_ch(struct drbd_work *w, int unused)
1563 } 1563 }
1564 } 1564 }
1565 kref_put(&tconn->kref, &conn_destroy); 1565 kref_put(&tconn->kref, &conn_destroy);
1566
1567 conn_md_sync(tconn);
1568
1566 return 0; 1569 return 0;
1567} 1570}
1568 1571