diff options
author | Lars Ellenberg <lars.ellenberg@linbit.com> | 2013-03-27 09:08:45 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2013-03-28 12:10:25 -0400 |
commit | 607f25e56ee0a31e451f6bd8a7109fa1f5dcbe29 (patch) | |
tree | 712acc8e7f7c7eac67ce8f9ed36535914f0ebc9b | |
parent | ef57f9e6bb9278720c8a5278728f252ab85d7ac6 (diff) |
drbd: fix drbd epoch write count for ahead/behind mode
The sanity check when receiving P_BARRIER_ACK does expect all write
requests with a given req->epoch to have been either all replicated,
or all not replicated.
Because req->epoch was assigned before calling maybe_pull_ahead(),
this expectation was not met, leading to an off-by-one in the sanity
check, and further to a "Protocol Error".
Fix: move the call to maybe_pull_ahead() a few lines up,
and assign req->epoch only after that.
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | drivers/block/drbd/drbd_req.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c index beefe65764ff..c24379ffd4e3 100644 --- a/drivers/block/drbd/drbd_req.c +++ b/drivers/block/drbd/drbd_req.c | |||
@@ -865,8 +865,10 @@ static void maybe_pull_ahead(struct drbd_conf *mdev) | |||
865 | bool congested = false; | 865 | bool congested = false; |
866 | enum drbd_on_congestion on_congestion; | 866 | enum drbd_on_congestion on_congestion; |
867 | 867 | ||
868 | rcu_read_lock(); | ||
868 | nc = rcu_dereference(tconn->net_conf); | 869 | nc = rcu_dereference(tconn->net_conf); |
869 | on_congestion = nc ? nc->on_congestion : OC_BLOCK; | 870 | on_congestion = nc ? nc->on_congestion : OC_BLOCK; |
871 | rcu_read_unlock(); | ||
870 | if (on_congestion == OC_BLOCK || | 872 | if (on_congestion == OC_BLOCK || |
871 | tconn->agreed_pro_version < 96) | 873 | tconn->agreed_pro_version < 96) |
872 | return; | 874 | return; |
@@ -960,14 +962,8 @@ static int drbd_process_write_request(struct drbd_request *req) | |||
960 | struct drbd_conf *mdev = req->w.mdev; | 962 | struct drbd_conf *mdev = req->w.mdev; |
961 | int remote, send_oos; | 963 | int remote, send_oos; |
962 | 964 | ||
963 | rcu_read_lock(); | ||
964 | remote = drbd_should_do_remote(mdev->state); | 965 | remote = drbd_should_do_remote(mdev->state); |
965 | if (remote) { | ||
966 | maybe_pull_ahead(mdev); | ||
967 | remote = drbd_should_do_remote(mdev->state); | ||
968 | } | ||
969 | send_oos = drbd_should_send_out_of_sync(mdev->state); | 966 | send_oos = drbd_should_send_out_of_sync(mdev->state); |
970 | rcu_read_unlock(); | ||
971 | 967 | ||
972 | /* Need to replicate writes. Unless it is an empty flush, | 968 | /* Need to replicate writes. Unless it is an empty flush, |
973 | * which is better mapped to a DRBD P_BARRIER packet, | 969 | * which is better mapped to a DRBD P_BARRIER packet, |
@@ -1087,9 +1083,13 @@ static void drbd_send_and_submit(struct drbd_conf *mdev, struct drbd_request *re | |||
1087 | * but will re-aquire it before it returns here. | 1083 | * but will re-aquire it before it returns here. |
1088 | * Needs to be before the check on drbd_suspended() */ | 1084 | * Needs to be before the check on drbd_suspended() */ |
1089 | complete_conflicting_writes(req); | 1085 | complete_conflicting_writes(req); |
1086 | /* no more giving up req_lock from now on! */ | ||
1087 | |||
1088 | /* check for congestion, and potentially stop sending | ||
1089 | * full data updates, but start sending "dirty bits" only. */ | ||
1090 | maybe_pull_ahead(mdev); | ||
1090 | } | 1091 | } |
1091 | 1092 | ||
1092 | /* no more giving up req_lock from now on! */ | ||
1093 | 1093 | ||
1094 | if (drbd_suspended(mdev)) { | 1094 | if (drbd_suspended(mdev)) { |
1095 | /* push back and retry: */ | 1095 | /* push back and retry: */ |