md: set mddev readonly flag on blkdev BLKROSET ioctl
commitd04e05f72668d77b66c91756c3d64c21970ea2a7
authorDan Williams <dan.j.williams@intel.com>
Tue, 11 May 2010 22:25:37 +0000 (12 08:25 +1000)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 5 Jul 2010 18:10:46 +0000 (5 11:10 -0700)
treeb7441b5ab9ecaeae511f673cde3cfe6ff3db6523
parent861fc8bdf88071da0e3ac140a23e532ae791ea43
md: set mddev readonly flag on blkdev BLKROSET ioctl

commit e2218350465e7e0931676b4849b594c978437bce upstream.

When the user sets the block device to readwrite then the mddev should
follow suit.  Otherwise, the BUG_ON in md_write_start() will be set to
trigger.

The reverse direction, setting mddev->ro to match a set readonly
request, can be ignored because the blkdev level readonly flag precludes
the need to have mddev->ro set correctly.  Nevermind the fact that
setting mddev->ro to 1 may fail if the array is in use.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/md/md.c