]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
md: avoid races when stopping resync.
authorNeilBrown <neilb@suse.de>
Wed, 25 Feb 2009 02:18:47 +0000 (13:18 +1100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 17 Mar 2009 00:32:08 +0000 (17:32 -0700)
commit42a52b79eae73b159e0ecbcf9111b306399aa4d2
tree75ea3c39fb1a587b0d1d3f6d7685a4a40f5d7de3
parent6d21e78dd40d9a292c837b34b3cbcea02f8c7ae1
md: avoid races when stopping resync.

commit 73d5c38a9536142e062c35997b044e89166e063b upstream.

There has been a race in raid10 and raid1 for a long time
which has only recently started showing up due to a scheduler changed.

When a sync_read request finishes, as soon as reschedule_retry
is called, another thread can mark the resync request as having
completed, so md_do_sync can finish, ->stop can be called, and
->conf can be freed.  So using conf after reschedule_retry is not
safe.

Similarly, when finishing a sync_write, calling md_done_sync must be
the last thing we do, as it allows a chain of events which will free
conf and other data structures.

The first of these requires action in raid10.c
The second requires action in raid1.c and raid10.c

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/md/raid1.c
drivers/md/raid10.c