linux/drivers/block/drbd
Lars Ellenberg 5dbfe7aedf drbd: add race-breaker to drbd_go_diskless
This adds a necessary race breaker to these commits:
    drbd: fix for possible deadlock on IO error during resync
    drbd: drop wrong debug asserts, fix recently introduced race

What we do is get a refcount, check the state, then depending on the
state and the requested minimum disk state, either hold it (success),
or give it back immediately (failed "try lock").

Some code paths (flushing of drbd metadata) may still grab and hold a
refcount even if we are D_FAILED (application IO won't).
So even if we hit local_cnt == 0 once after being D_FAILED,
we still need to wait for that again after we changed to D_DISKLESS.
Once local_cnt reaches 0 while we are D_DISKLESS, we can be sure that
no one will look at the protected members anymore, so only then is it
safe to free them.

We cannot easily convert to standard locking primitives here, as we want
to be able to use it in atomic context (we always do a "try lock"),
as well as hold references for a "long time" (from IO submission to
completion callback).

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2010-10-15 14:06:53 +02:00
..
drbd_actlog.c drbd: reduce code duplication when receiving data requests 2010-10-14 18:38:19 +02:00
drbd_bitmap.c drbd: Disable activity log updates when the whole device is out of sync 2010-10-14 18:38:26 +02:00
drbd_int.h drbd: fix for possible deadlock on IO error during resync 2010-10-14 18:38:50 +02:00
drbd_main.c drbd: add race-breaker to drbd_go_diskless 2010-10-15 14:06:53 +02:00
drbd_nl.c drbd: cleanup useless leftover warn/error printk's 2010-10-14 18:38:53 +02:00
drbd_proc.c drbd: cleanup: change "<= 0" to "== 0" 2010-10-14 19:17:23 +02:00
drbd_receiver.c drbd: add some more explicit drbd_md_sync 2010-10-14 19:08:58 +02:00
drbd_req.c drbd: Track the reasons to suspend IO in dedicated state bits 2010-10-14 18:38:40 +02:00
drbd_req.h drbd: Disable activity log updates when the whole device is out of sync 2010-10-14 18:38:26 +02:00
drbd_strings.c drbd: don't start a resync without access to up-to-date Data 2010-05-18 01:08:18 +02:00
drbd_vli.h
drbd_worker.c drbd: add explicit drbd_md_sync to drbd_resync_finished 2010-10-14 18:38:52 +02:00
drbd_wrappers.h drbd: Allow drbd_epoch_entries to use multiple bios. 2010-05-18 02:01:23 +02:00
Kconfig drbd: Kconfig fix 2009-12-29 17:38:28 +01:00
Makefile drbd: remove tracing bits 2009-10-01 21:17:58 +02:00