[patch 41/56] md: Dont try to set an array to read-auto if it isalready in that state.

From: Greg KH
Date: Tue Feb 10 2009 - 19:42:51 EST


2.6.27-stable review patch. If anyone has any objections, please let us know.
------------------

From: NeilBrown <neilb@xxxxxxx>

commit 80268ee9270ebe4847365a7426de91d179e870d0 upstream.

'read-auto' is a variant of 'readonly' which will switch to writable
on the first write attempt.

Calling do_md_stop to set the array readonly when it is already readonly
returns an error. So make sure not to do that.

Signed-off-by: NeilBrown <neilb@xxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>

---
drivers/md/md.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -2742,9 +2742,9 @@ array_state_store(mddev_t *mddev, const
break;
case read_auto:
if (mddev->pers) {
- if (mddev->ro != 1)
+ if (mddev->ro == 0)
err = do_md_stop(mddev, 1, 0);
- else
+ else if (mddev->ro == 1)
err = restart_array(mddev);
if (err == 0) {
mddev->ro = 2;

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/