From: Lars Ellenberg Date: Mon, 28 Apr 2014 16:43:26 +0000 (+0200) Subject: drbd: fix a race between start_resync and send_and_submit X-Git-Tag: omap-for-v3.17/soc-cleanup~42^2~7^2~29 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=074f4afeb2277bd5ecb9fa7f91eaffa55e262126;p=pandora-kernel.git drbd: fix a race between start_resync and send_and_submit In the drbd make request function, specifically in drbd_send_and_submit(), we decide whether we want to send the actual write request, or only a "set this block out of sync" information. We do so based on the current connection state, while holding the req_lock. The connection state is not supposed to change while holding the req_lock. But in drbd_start_resync, we did change that state anyways, while only holding the global_state_lock, which is enough to change sync-after dependencies (paused vs active resync), but not good enough to change the connection state. Fix: in drbd_start_resync, first grab the req_lock to serialize with drbd_send_and_submit(), before grabbing the global_state_lock to be able to evaluate the sync-after dependencies. Signed-off-by: Philipp Reisner Signed-off-by: Lars Ellenberg Signed-off-by: Jens Axboe --- Reading git-diff-tree failed