Message ID | 1362582871-25468-1-git-send-email-luis.henriques@canonical.com |
---|---|
State | New |
Headers | show |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 97edf9e..b7a551d 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -344,6 +344,10 @@ static void md_make_request(struct request_queue *q, struct bio *bio) bio_io_error(bio); return; } + if (mddev->ro == 1 && unlikely(rw == WRITE)) { + bio_endio(bio, bio_sectors(bio) == 0 ? 0 : -EROFS); + return; + } smp_rmb(); /* Ensure implications of 'active' are visible */ rcu_read_lock(); if (mddev->suspended) {