diff options
author | Milan Broz <mbroz@redhat.com> | 2008-10-21 17:45:02 +0100 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2008-10-21 17:45:02 +0100 |
commit | 393b47ef23bbcf16890c907d0144b5a8ec4caebf (patch) | |
tree | 8f3f26715fe81ef5fb78a6f30a46e163873de6b9 /crypto/ccm.c | |
parent | b635b00e0e159d858486fd899c4021d1d67757e2 (diff) |
dm crypt: fix async split
When writing io, dm-crypt has to allocate a new cloned bio
and encrypt the data into newly-allocated pages attached to this bio.
In rare cases, because of hw restrictions (e.g. physical segment limit)
or memory pressure, sometimes more than one cloned bio has to be used,
each processing a different fragment of the original.
Currently there is one waitqueue which waits for one fragment to finish
and continues processing the next fragment.
But when using asynchronous crypto this doesn't work, because several
fragments may be processed asynchronously or in parallel and there is
only one crypt context that cannot be shared between the bio fragments.
The result may be corruption of the data contained in the encrypted bio.
The patch fixes this by allocating new dm_crypt_io structs (with new
crypto contexts) and running them independently.
The fragments contains a pointer to the base dm_crypt_io struct to
handle reference counting, so the base one is properly deallocated
after all the fragments are finished.
In a low memory situation, this only uses one additional object from the
mempool. If the mempool is empty, the next allocation simple waits for
previous fragments to complete.
Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'crypto/ccm.c')
0 files changed, 0 insertions, 0 deletions