mirror-linux/drivers/block/drbd
Sarah Newman 00c9c9628b drbd: add missing kref_get in handle_write_conflicts
With `two-primaries` enabled, DRBD tries to detect "concurrent" writes
and handle write conflicts, so that even if you write to the same sector
simultaneously on both nodes, they end up with the identical data once
the writes are completed.

In handling "superseeded" writes, we forgot a kref_get,
resulting in a premature drbd_destroy_device and use after free,
and further to kernel crashes with symptoms.

Relevance: No one should use DRBD as a random data generator, and apparently
all users of "two-primaries" handle concurrent writes correctly on layer up.
That is cluster file systems use some distributed lock manager,
and live migration in virtualization environments stops writes on one node
before starting writes on the other node.

Which means that other than for "test cases",
this code path is never taken in real life.

FYI, in DRBD 9, things are handled differently nowadays.  We still detect
"write conflicts", but no longer try to be smart about them.
We decided to disconnect hard instead: upper layers must not submit concurrent
writes. If they do, that's their fault.

Signed-off-by: Sarah Newman <srn@prgmr.com>
Signed-off-by: Lars Ellenberg <lars@linbit.com>
Signed-off-by: Christoph Böhmwalder <christoph.boehmwalder@linbit.com>
Link: https://lore.kernel.org/r/20250627095728.800688-1-christoph.boehmwalder@linbit.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2025-07-08 11:56:01 -06:00
..
Kconfig lib/crc: remove CONFIG_LIBCRC32C 2025-04-04 11:31:42 -07:00
Makefile
drbd_actlog.c drbd: actlog: fix kernel-doc warnings and spelling 2023-12-22 07:18:35 -07:00
drbd_bitmap.c drbd: use __bio_add_page to add page to bio 2023-05-31 09:50:02 -06:00
drbd_buildtag.c
drbd_debugfs.c
drbd_debugfs.h
drbd_int.h drbd: Remove unused conn_lowest_minor 2024-10-11 07:11:44 -06:00
drbd_interval.c
drbd_interval.h
drbd_main.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
drbd_nl.c treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
drbd_nla.c
drbd_nla.h
drbd_polymorph_printk.h
drbd_proc.c
drbd_protocol.h
drbd_receiver.c drbd: add missing kref_get in handle_write_conflicts 2025-07-08 11:56:01 -06:00
drbd_req.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
drbd_req.h drbd: pass drbd_peer_device to __req_mod 2023-04-01 20:27:55 -06:00
drbd_state.c drbd: Add NULL check for net_conf to prevent dereference in state validation 2024-09-10 13:44:06 -06:00
drbd_state.h
drbd_state_change.h drbd: fix function cast warnings in state machine 2024-02-13 08:55:40 -07:00
drbd_strings.c
drbd_strings.h
drbd_vli.h
drbd_worker.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00