md: fix an occasional deadlock in raid5
commit46340efe3e4d0f5cd48bbba6339f86b14732600c
authorNeilBrown <neilb@suse.de>
Wed, 6 Feb 2008 09:40:00 +0000 (6 01:40 -0800)
committerOliver Pinter <oliver.pntr@gmail.com>
Sat, 5 Apr 2008 12:41:07 +0000 (5 14:41 +0200)
tree6a88fb58797a096a454b621a610b4ee6d87c8775
parent88af5e7a00f3bfe70a4dbc0c6b0d076572952ffb
md: fix an occasional deadlock in raid5

raid5's 'make_request' function calls generic_make_request on underlying
devices and if we run out of stripe heads, it could end up waiting for one of
those requests to complete.  This is bad as recursive calls to
generic_make_request go on a queue and are not even attempted until
make_request completes.

So: don't make any generic_make_request calls in raid5 make_request until all
waiting has been done.  We do this by simply setting STRIPE_HANDLE instead of
calling handle_stripe().

If we need more stripe_heads, raid5d will get called to process the pending
stripe_heads which will call generic_make_request from a

This change by itself causes a performance hit.  So add a change so that
raid5_activate_delayed is only called at unplug time, never in raid5.  This
seems to bring back the performance numbers.  Calling it in raid5d was
sometimes too soon...

Neil said:

  How about we queue it for 2.6.25-rc1 and then about when -rc2 comes out,
  we queue it for 2.6.24.y?

Acked-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Neil Brown <neilb@suse.de>
Tested-by: dean gaudet <dean@arctic.org>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Oliver Pinter <oliver.pntr@gmail.com>
drivers/md/raid5.c