summaryrefslogtreecommitdiffstats
path: root/sys/geom/raid/g_raid.c
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2013-08-13 07:56:40 +0000
committermav <mav@FreeBSD.org>2013-08-13 07:56:40 +0000
commiteba4a485b224ae259700b960fe63abf2463a33aa (patch)
tree21db4ff3b5ea40848ed69e4ff8547e8266d7123c /sys/geom/raid/g_raid.c
parent9b26a416432eed29bc60e0a89a4db1554a89142a (diff)
downloadFreeBSD-src-eba4a485b224ae259700b960fe63abf2463a33aa.zip
FreeBSD-src-eba4a485b224ae259700b960fe63abf2463a33aa.tar.gz
Return error when opening read-only volumes (like RAID4/5/...) for writing.
Previously opens succeeded, but actual write operations returned errors. Requested by: peter MFC after: 2 weeks
Diffstat (limited to 'sys/geom/raid/g_raid.c')
-rw-r--r--sys/geom/raid/g_raid.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/geom/raid/g_raid.c b/sys/geom/raid/g_raid.c
index fd6d69c..41a1f96 100644
--- a/sys/geom/raid/g_raid.c
+++ b/sys/geom/raid/g_raid.c
@@ -1863,6 +1863,11 @@ g_raid_access(struct g_provider *pp, int acr, int acw, int ace)
error = ENXIO;
goto out;
}
+ /* Deny write opens for read-only volumes. */
+ if (vol->v_read_only && acw > 0) {
+ error = EROFS;
+ goto out;
+ }
if (dcw == 0)
g_raid_clean(vol, dcw);
vol->v_provider_open += acr + acw + ace;
OpenPOWER on IntegriCloud