aboutsummaryrefslogtreecommitdiff
path: root/drivers/block/drbd/drbd_main.c
diff options
context:
space:
mode:
authorPhilipp Reisner <philipp.reisner@linbit.com>2011-01-17 20:27:30 +0100
committerPhilipp Reisner <philipp.reisner@linbit.com>2011-03-10 11:45:42 +0100
commit6a35c45f890dc18c5527ac501b308058118f20e7 (patch)
tree627c73d972af6905f2ab77131e4232c62d31a553 /drivers/block/drbd/drbd_main.c
parent2deb8336d04106f215c21ad1b029e78d12033d02 (diff)
drbd: Ensure that an epoch contains only requests of one kind
The assert in drbd_req.c:755 forces us to have only requests of one kind in an epoch. The two kinds we distinguish here are: local-only or mirrored. 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.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;