aboutsummaryrefslogtreecommitdiff
path: root/drivers/block/drbd/drbd_req.c
diff options
context:
space:
mode:
authorLars Ellenberg <lars.ellenberg@linbit.com>2012-03-26 15:09:44 +0200
committerPhilipp Reisner <philipp.reisner@linbit.com>2012-11-08 16:58:17 +0100
commit81f448629aa25051c47b4d5b81702da8cbe922c3 (patch)
treed2df79e1f6a7e442008bd69325e29bd80b06f116 /drivers/block/drbd/drbd_req.c
parent38a05c16b8fc855db2294eec36fde2c665b14e8f (diff)
downloadvexpress-lsk-81f448629aa25051c47b4d5b81702da8cbe922c3.tar.gz
drbd: Fix a potential race that could case data inconsistency
When we have a write request and a state change C_WF_BITMAP_S -> C_SYNC_SOURCE at the same time, and it happens that the line remote = remote && drbd_should_do_remote(s); stills sees C_WF_BITMAP_S, and send_oos = rw == WRITE && drbd_should_send_oos(s); already sees C_SYNC_SOURCE both are 0. This causes the write to not be mirrored, but marked as out-of-sync on the Sync_Source node. 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_req.c')
-rw-r--r--drivers/block/drbd/drbd_req.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c
index 3e4dc070d3f..c3f99bde0e1 100644
--- a/drivers/block/drbd/drbd_req.c
+++ b/drivers/block/drbd/drbd_req.c
@@ -822,6 +822,7 @@ int __drbd_make_request(struct drbd_conf *mdev, struct bio *bio, unsigned long s
int local, remote, send_oos = 0;
int err;
int ret = 0;
+ union drbd_dev_state s;
/* allocate outside of all locks; */
req = drbd_req_new(mdev, bio);
@@ -884,8 +885,9 @@ int __drbd_make_request(struct drbd_conf *mdev, struct bio *bio, unsigned long s
drbd_al_begin_io(mdev, &req->i);
}
- remote = remote && drbd_should_do_remote(mdev->state);
- send_oos = rw == WRITE && drbd_should_send_out_of_sync(mdev->state);
+ s = mdev->state;
+ remote = remote && drbd_should_do_remote(s);
+ send_oos = rw == WRITE && drbd_should_send_out_of_sync(s);
D_ASSERT(!(remote && send_oos));
if (!(local || remote) && !drbd_suspended(mdev)) {