kernel-hacking-2024-linux-s.../drivers/block
Lars Ellenberg 545752d5d8 drbd: fix race between disconnect and receive_state
If the asender thread, or request_timer_fn(), or some other part of
the code, decided to drop the connection (because of timeout or other),
but the receiver just now was processing a P_STATE packet, there was a
chance that receive_state() would do a hard state change
"re-establishing" an already failed connection without additional handshake.

Log excerpt:
  Remote failed to finish a request within ko-count * timeout
  peer( Secondary -> Unknown ) conn( Connected -> Timeout ) pdsk( UpToDate -> DUnknown )
  asender terminated
  ...
  peer( Unknown -> Secondary ) conn( Timeout -> Connected ) pdsk( DUnknown -> UpToDate ) peer_isp( 0 -> 1 )
  ...
  Connection closed
  peer( Secondary -> Unknown ) conn( Connected -> Unconnected ) pdsk( UpToDate -> DUnknown ) peer_isp( 1 -> 0 )
  receiver terminated

Impact:
while the connection state is erroneously "Connected",
requests may be queued and even sent,
which would never be acknowledged,
and may have been missed by the cleanup.
These requests would never be completed.

The next drbd_suspend_io() will then lock up,
waiting forever for these requests to complete.

Fixed in several code paths:
  Make sure the connection state is NetworkFailure or worse
  before starting the cleanup in drbd_disconnect().
  This should make sure the cleanup won't miss any requests.

  Disallow receive_state() to "upgrade" the connection state
  from an error state. This will make sure the "illegal" state
  transition won't happen.

  For all connection failure states,
  relax the safe-guard in sanitize_state() again
  to silently mask out those state changes
  (e.g. Timeout -> Connected becomes Timeout -> Timeout).

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2012-05-09 15:16:01 +02:00
..
aoe
drbd drbd: fix race between disconnect and receive_state 2012-05-09 15:16:01 +02:00
mtip32xx block: mtip32xx: remove HOTPLUG_PCI_PCIE dependancy 2012-04-12 08:47:05 +02:00
paride paride/pcd: fix bool verbose module parameter. 2012-01-13 09:32:26 +10:30
xen-blkback xen/blkback: Fix warning error. 2012-04-18 15:54:08 -04:00
amiflop.c
ataflop.c
brd.c block: remove the second argument of k[un]map_atomic() 2012-03-20 21:48:16 +08:00
cciss.c block: add and use scsi_blk_cmd_ioctl 2012-01-14 15:07:24 -08:00
cciss.h
cciss_cmd.h
cciss_scsi.c cciss: Fix scsi tape io with more than 255 scatter gather elements 2012-03-22 21:40:09 +01:00
cciss_scsi.h
cpqarray.c
cpqarray.h
cryptoloop.c
DAC960.c drivers/block/DAC960: fix -Wuninitialized warning 2012-03-02 10:48:35 +01:00
DAC960.h
floppy.c x86: Remove the ancient and deprecated disable_hlt() and enable_hlt() facility 2012-03-30 08:50:27 +02:00
hd.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
ida_cmd.h
ida_ioctl.h
Kconfig usb/ub: deprecate & schedule for removal the "Low Performance USB Block" driver 2012-03-16 13:30:10 -07:00
loop.c block: remove the second argument of k[un]map_atomic() 2012-03-20 21:48:16 +08:00
Makefile Merge git://git.infradead.org/users/willy/linux-nvme 2012-01-18 12:34:09 -08:00
mg_disk.c
nbd.c Merge branch 'akpm' (Andrew's patch-bomb) 2012-03-28 17:19:28 -07:00
nvme.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2012-03-20 21:12:50 -07:00
osdblk.c
pktcdvd.c block: remove the second argument of k[un]map_atomic() 2012-03-20 21:48:16 +08:00
ps3disk.c
ps3vram.c
rbd.c rbd: move snap_rwsem to the device, rename to header_rwsem 2012-03-22 10:47:52 -05:00
rbd_types.h rbd: small changes 2012-03-22 10:47:50 -05:00
smart1,2.h
sunvdc.c powerpc+sparc/vio: Modernize driver registration 2012-03-28 11:33:24 +11:00
swim.c
swim3.c
swim_asm.S
sx8.c block, sx8: fix pointer math issue getting fw version 2012-03-03 19:44:39 +01:00
ub.c usb/ub: deprecate & schedule for removal the "Low Performance USB Block" driver 2012-03-16 13:30:10 -07:00
umem.c
umem.h
virtio_blk.c virtio: fixes on top of 3.4-rc2 2012-04-16 18:34:12 -07:00
xd.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
xd.h
xen-blkfront.c Merge branch 'for-3.4/drivers' of git://git.kernel.dk/linux-block 2012-04-13 18:45:13 -07:00
xsysace.c
z2ram.c