]> git.baikalelectronics.ru Git - kernel.git/commit
dm bufio: Add DM_BUFIO_CLIENT_NO_SLEEP flag
authorNathan Huckleberry <nhuck@google.com>
Fri, 22 Jul 2022 09:38:22 +0000 (09:38 +0000)
committerMike Snitzer <snitzer@kernel.org>
Thu, 28 Jul 2022 21:46:14 +0000 (17:46 -0400)
commit84dbd34b914030258904765ba0ef13ccd40952eb
treedb93c750daee944f024e6954659f8907100b48f9
parent8b91c6648cdb1cc3e9356f779a1ff5662a349c62
dm bufio: Add DM_BUFIO_CLIENT_NO_SLEEP flag

Add an optional flag that ensures dm_bufio_client does not sleep
(primary focus is to service dm_bufio_get without sleeping). This
allows the dm-bufio cache to be queried from interrupt context.

To ensure that dm-bufio does not sleep, dm-bufio must use a spinlock
instead of a mutex. Additionally, to avoid deadlocks, special care
must be taken so that dm-bufio does not sleep while holding the
spinlock.

But again: the scope of this no_sleep is initially confined to
dm_bufio_get, so __alloc_buffer_wait_no_callback is _not_ changed to
avoid sleeping because __bufio_new avoids allocation for NF_GET.

Signed-off-by: Nathan Huckleberry <nhuck@google.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
drivers/md/dm-bufio.c
include/linux/dm-bufio.h