All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Fix SMP races in dm-crypt
@ 2007-03-21  7:06 Olaf Kirch
  2007-03-21 10:03 ` Alasdair G Kergon
  2007-03-22 20:28 ` Christophe Saout
  0 siblings, 2 replies; 11+ messages in thread
From: Olaf Kirch @ 2007-03-21  7:06 UTC (permalink / raw)
  To: dm-devel, Alasdair G Kergon, Andrew Morton

(I'm resending this, because it seems mailman ate this posting
the first time around - apologies if you're seeing this twice).

I investigated kernel Bug 5948 (Oops when accessing SATA with device mapper on
AMD 64 X2) to help cut down on the number of open bugs.

The problem reported in that bug seems to be caused by memory pressure
when writing - crypt_alloc_buffer can return less than the full number of
pages required. In that case, the bio is split, but we're keeping a pointer
to the first chunk of the request around in first_clone, and copy it. If the
first clone completes I/O while we're cloning it, we oops on garbage in
the bvec.

I was able to reproduce this on 2.6.20 - and the following patches
seem to fix it for me.

dm-crypt-clone_init-early
	We need to call clone_init early on, before we can conceivably
	ever call bio_put on the clone

dm-crypt-clone-race
	Do no access bios after generic_make_request

dm-crypt-drop-first_clone
	Drop the first_clone business, and always allocate a fresh bio.

Olaf
-- 
Olaf Kirch  |  --- o --- Nous sommes du soleil we love when we play
okir@lst.de |    / | \   sol.dhoop.naytheet.ah kin.ir.samse.qurax

^ permalink raw reply	[flat|nested] 11+ messages in thread
* [PATCH 0/3] Fix SMP races in dm-crypt
@ 2007-03-20 19:54 Olaf Kirch
  0 siblings, 0 replies; 11+ messages in thread
From: Olaf Kirch @ 2007-03-20 19:54 UTC (permalink / raw)
  To: dm-devel

I investigated kernel Bug 5948 (Oops when accessing SATA with device mapper on
AMD 64 X2) to help cut down on the number of open bugs.

The problem reported in that bug seems to be caused by memory pressure
when writing - crypt_alloc_buffer can return less than the full number of
pages required. In that case, the bio is split, but we're keeping a pointer
to the first chunk of the request around in first_clone, and copy it. If the
first clone completes I/O while we're cloning it, we oops on garbage in
the bvec.

I was able to reproduce this on 2.6.20 - and the following patches
seem to fix it for me.

dm-crypt-clone_init-early
	We need to call clone_init early on, before we can conceivably
	ever call bio_put on the clone

dm-crypt-clone-race
	Do no access bios after generic_make_request

dm-crypt-drop-first_clone
	Drop the first_clone business, and always allocate a fresh bio.

Olaf
-- 
Olaf Kirch  |  --- o --- Nous sommes du soleil we love when we play
okir@lst.de |    / | \   sol.dhoop.naytheet.ah kin.ir.samse.qurax

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2007-03-22 22:44 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-21  7:06 [PATCH 0/3] Fix SMP races in dm-crypt Olaf Kirch
2007-03-21 10:03 ` Alasdair G Kergon
2007-03-21 10:47   ` [PATCH 4/3] Allocate smaller clones Olaf Kirch
2007-03-21 13:32   ` Re: [PATCH 0/3] Fix SMP races in dm-crypt Jim Meyering
2007-03-21 15:44     ` Alasdair G Kergon
2007-03-22 20:28 ` Christophe Saout
2007-03-22 20:41   ` Andrew Morton
2007-03-22 20:51     ` Christophe Saout
2007-03-22 21:53     ` Alasdair G Kergon
2007-03-22 22:44       ` Andrew Morton
  -- strict thread matches above, loose matches on Subject: below --
2007-03-20 19:54 Olaf Kirch

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.