projects
/
linux-2.6-block.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
md: protect against crash upon fsync on ro array
[linux-2.6-block.git]
/
drivers
/
md
/
md.c
diff --git
a/drivers/md/md.c
b/drivers/md/md.c
index 3db3d1b271f7ef18650a227a8dd07dbc2b8fefbc..1e634a68541ee82c891fa0ad2d0a0e1c996e9839 100644
(file)
--- a/
drivers/md/md.c
+++ b/
drivers/md/md.c
@@
-307,6
+307,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) {