summaryrefslogtreecommitdiffstats
path: root/drivers/md/md.h
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2012-03-28 18:41:22 +0100
committerAlasdair G Kergon <agk@redhat.com>2012-03-28 18:41:22 +0100
commitaeb2deae2660a1773c83d3c6e9e6575daa3855d6 (patch)
tree7bd2b85fa918285dbc6e857993fb3c20ec108554 /drivers/md/md.h
parentaadbe266f2f89ccc68b52f4effc7b3a8b29521ef (diff)
downloadlinux-aeb2deae2660a1773c83d3c6e9e6575daa3855d6.tar.gz
linux-aeb2deae2660a1773c83d3c6e9e6575daa3855d6.tar.bz2
linux-aeb2deae2660a1773c83d3c6e9e6575daa3855d6.zip
dm crypt: fix mempool deadlock
This patch fixes a possible deadlock in dm-crypt's mempool use. Currently, dm-crypt reserves a mempool of MIN_BIO_PAGES reserved pages. It allocates first MIN_BIO_PAGES with non-failing allocation (the allocation cannot fail and waits until the mempool is refilled). Further pages are allocated with different gfp flags that allow failing. Because allocations may be done in parallel, this code can deadlock. Example: There are two processes, each tries to allocate MIN_BIO_PAGES and the processes run simultaneously. It may end up in a situation where each process allocates (MIN_BIO_PAGES / 2) pages. The mempool is exhausted. Each process waits for more pages to be freed to the mempool, which never happens. To avoid this deadlock scenario, this patch changes the code so that only the first page is allocated with non-failing gfp mask. Allocation of further pages may fail. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Cc: stable@kernel.org Signed-off-by: Milan Broz <mbroz@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/md.h')
0 files changed, 0 insertions, 0 deletions