]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
md: Ensure no IO request to get md device before it is properly initialised.
authorNeilBrown <neilb@suse.de>
Thu, 13 Jan 2011 22:14:33 +0000 (09:14 +1100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 17 Feb 2011 22:47:24 +0000 (14:47 -0800)
commit7896fe54a75c5bfd8dfed08d98cb7e15896e3749
treee692ce100e27855167290a8c0c96d0ebba9fdd4f
parenta53775f3a5b7cfdca47560285bf87616a808f25b
md: Ensure no IO request to get md device before it is properly initialised.

commit 0ca69886a8273ac1350143d562280bfcbe4760dc upstream.

When an md device is in the process of coming on line it is possible
for an IO request (typically a partition table probe) to get through
before the array is fully initialised, which can cause unexpected
behaviour (e.g. a crash).

So explicitly record when the array is ready for IO and don't allow IO
through until then.

There is no possibility for a similar problem when the array is going
off-line as there must only be one 'open' at that time, and it is busy
off-lining the array and so cannot send IO requests.  So no memory
barrier is needed in md_stop()

This has been a bug since commit 409c57f3801 in 2.6.30 which
introduced md_make_request.  Before then, each personality would
register its own make_request_fn when it was ready.
This is suitable for any stable kernel from 2.6.30.y onwards.

Signed-off-by: NeilBrown <neilb@suse.de>
Reported-by: "Hawrylewicz Czarnowski, Przemyslaw" <przemyslaw.hawrylewicz.czarnowski@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/md/md.c
drivers/md/md.h