summaryrefslogtreecommitdiffstats
path: root/drivers/block/drbd/drbd_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/drbd/drbd_main.c')
-rw-r--r--drivers/block/drbd/drbd_main.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 1061b9fff2b..34ee8e44a75 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -1261,9 +1261,14 @@ __drbd_set_state(struct drbd_conf *mdev, union drbd_state ns,
if (os.conn < C_CONNECTED && ns.conn >= C_CONNECTED)
drbd_resume_al(mdev);
- if (os.conn == C_AHEAD && ns.conn != C_AHEAD)
+ /* Start a new epoch in case we start to mirror write requests */
+ if (!drbd_should_do_remote(os) && drbd_should_do_remote(ns))
tl_forget(mdev);
+ /* Do not add local-only requests to an epoch with mirrored requests */
+ if (drbd_should_do_remote(os) && !drbd_should_do_remote(ns))
+ set_bit(CREATE_BARRIER, &mdev->flags);
+
ascw = kmalloc(sizeof(*ascw), GFP_ATOMIC);
if (ascw) {
ascw->os = os;