md: protect ->pers changes with mddev->lock
authorNeilBrown <neilb@suse.de>
Mon, 15 Dec 2014 01:56:58 +0000 (12:56 +1100)
committerNeilBrown <neilb@suse.de>
Tue, 3 Feb 2015 21:35:53 +0000 (08:35 +1100)
commit36d091f4759d194c99f0705d412afe208622b45a
treef76abdd702316a37df60f6522adb3f6a3b230741
parentdb721d32b74b51a5ac9ec9fab1d85cba90dbdbd3
md: protect ->pers changes with mddev->lock

->pers is already protected by ->reconfig_mutex, and
cannot possibly change when there are threads running or
outstanding IO.

However there are some places where we access ->pers
not in a thread or IO context, and where ->reconfig_mutex
is unnecessarily heavy-weight:  level_show and md_seq_show().

So protect all changes, and those accesses, with ->lock.
This is a step toward taking those accesses out from under
reconfig_mutex.

[Fixed missing "mddev->pers" -> "pers" conversion, thanks to
 Dan Carpenter <dan.carpenter@oracle.com>]

Signed-off-by: NeilBrown <neilb@suse.de>
drivers/md/md.c
drivers/md/md.h