1. 22 6月, 2009 1 次提交
  2. 03 4月, 2009 1 次提交
  3. 17 3月, 2009 2 次提交
    • M
      dm crypt: wait for endio to complete before destruction · b35f8caa
      Milan Broz 提交于
      The following oops has been reported when dm-crypt runs over a loop device.
      
      ...
      [   70.381058] Process loop0 (pid: 4268, ti=cf3b2000 task=cf1cc1f0 task.ti=cf3b2000)
      ...
      [   70.381058] Call Trace:
      [   70.381058]  [<d0d76601>] ? crypt_dec_pending+0x5e/0x62 [dm_crypt]
      [   70.381058]  [<d0d767b8>] ? crypt_endio+0xa2/0xaa [dm_crypt]
      [   70.381058]  [<d0d76716>] ? crypt_endio+0x0/0xaa [dm_crypt]
      [   70.381058]  [<c01a2f24>] ? bio_endio+0x2b/0x2e
      [   70.381058]  [<d0806530>] ? dec_pending+0x224/0x23b [dm_mod]
      [   70.381058]  [<d08066e4>] ? clone_endio+0x79/0xa4 [dm_mod]
      [   70.381058]  [<d080666b>] ? clone_endio+0x0/0xa4 [dm_mod]
      [   70.381058]  [<c01a2f24>] ? bio_endio+0x2b/0x2e
      [   70.381058]  [<c02bad86>] ? loop_thread+0x380/0x3b7
      [   70.381058]  [<c02ba8a1>] ? do_lo_send_aops+0x0/0x165
      [   70.381058]  [<c013754f>] ? autoremove_wake_function+0x0/0x33
      [   70.381058]  [<c02baa06>] ? loop_thread+0x0/0x3b7
      
      When a table is being replaced, it waits for I/O to complete
      before destroying the mempool, but the endio function doesn't
      call mempool_free() until after completing the bio.
      
      Fix it by swapping the order of those two operations.
      
      The same problem occurs in dm.c with md referenced after dec_pending.
      Again, we swap the order.
      
      Cc: stable@kernel.org
      Signed-off-by: NMilan Broz <mbroz@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      b35f8caa
    • H
      dm crypt: fix kcryptd_async_done parameter · b2174eeb
      Huang Ying 提交于
      In the async encryption-complete function (kcryptd_async_done), the
      crypto_async_request passed in may be different from the one passed to
      crypto_ablkcipher_encrypt/decrypt.  Only crypto_async_request->data is
      guaranteed to be same as the one passed in.  The current
      kcryptd_async_done uses the passed-in crypto_async_request directly
      which may cause the AES-NI-based AES algorithm implementation to panic.
      
      This patch fixes this bug by only using crypto_async_request->data,
      which points to dm_crypt_request, the crypto_async_request passed in.
      The original data (convert_context) is gotten from dm_crypt_request.
      
      [mbroz@redhat.com: reworked]
      Cc: stable@kernel.org
      Signed-off-by: NHuang Ying <ying.huang@intel.com>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NMilan Broz <mbroz@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      b2174eeb
  4. 06 1月, 2009 1 次提交
    • M
      dm: consolidate target deregistration error handling · 10d3bd09
      Mikulas Patocka 提交于
      Change dm_unregister_target to return void and use BUG() for error
      reporting.
      
      dm_unregister_target can only fail because of programming bug in the
      target driver. It can't fail because of user's behavior or disk errors.
      
      This patch changes unregister_target to return void and use BUG if
      someone tries to unregister non-registered target or unregister target
      that is in use.
      
      This patch removes code duplication (testing of error codes in all dm
      targets) and reports bugs in just one place, in dm_unregister_target. In
      some target drivers, these return codes were ignored, which could lead
      to a situation where bugs could be missed.
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      10d3bd09
  5. 29 12月, 2008 1 次提交
    • J
      bio: allow individual slabs in the bio_set · bb799ca0
      Jens Axboe 提交于
      Instead of having a global bio slab cache, add a reference to one
      in each bio_set that is created. This allows for personalized slabs
      in each bio_set, so that they can have bios of different sizes.
      
      This means we can personalize the bios we return. File systems may
      want to embed the bio inside another structure, to avoid allocation
      more items (and stuffing them in ->bi_private) after the get a bio.
      Or we may want to embed a number of bio_vecs directly at the end
      of a bio, to avoid doing two allocations to return a bio. This is now
      possible.
      Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
      bb799ca0
  6. 22 10月, 2008 4 次提交
    • M
      dm crypt: remove waitqueue · 0a4a1047
      Milan Broz 提交于
      Remove waitqueue no longer needed with the async crypto interface.
      Signed-off-by: NMilan Broz <mbroz@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      0a4a1047
    • M
      dm crypt: fix async split · 393b47ef
      Milan Broz 提交于
      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: NMilan Broz <mbroz@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      393b47ef
    • M
      dm crypt: tidy sector · b635b00e
      Milan Broz 提交于
      Prepare local sector variable (offset) for later patch.
      Do not update io->sector for still-running I/O.
      
      No functional change.
      Signed-off-by: NMilan Broz <mbroz@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      b635b00e
    • M
      dm: remove dm header from targets · 586e80e6
      Mikulas Patocka 提交于
      Change #include "dm.h" to #include <linux/device-mapper.h> in all targets.
      Targets should not need direct access to internal DM structures.
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      586e80e6
  7. 10 10月, 2008 8 次提交
  8. 21 7月, 2008 1 次提交
  9. 02 7月, 2008 1 次提交
  10. 29 3月, 2008 1 次提交
  11. 08 2月, 2008 15 次提交
  12. 21 12月, 2007 2 次提交
    • M
      dm crypt: use bio_add_page · 91e10625
      Milan Broz 提交于
      Fix possible max_phys_segments violation in cloned dm-crypt bio.
      
      In write operation dm-crypt needs to allocate new bio request
      and run crypto operation on this clone. Cloned request has always
      the same size, but number of physical segments can be increased
      and violate max_phys_segments restriction.
      
      This can lead to data corruption and serious hardware malfunction.
      This was observed when using XFS over dm-crypt and at least
      two HBA controller drivers (arcmsr, cciss) recently.
      
      Fix it by using bio_add_page() call (which tests for other
      restrictions too) instead of constructing own biovec.
      
      All versions of dm-crypt are affected by this bug.
      
      Cc: stable@kernel.org
      Cc:  dm-crypt@saout.de
      Signed-off-by: NMilan Broz <mbroz@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      91e10625
    • M
      dm crypt: fix write endio · adfe4770
      Milan Broz 提交于
      Fix BIO_UPTODATE test for write io.
      
      Cc: stable@kernel.org
      Cc: dm-crypt@saout.de
      Signed-off-by: NMilan Broz <mbroz@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      adfe4770
  13. 27 10月, 2007 1 次提交
  14. 24 10月, 2007 1 次提交