From a468c003ef518f117777db670a2d8ff8a59f61f1 Mon Sep 17 00:00:00 2001 From: Ulf Lilleengen Date: Sat, 13 Dec 2008 14:14:56 +0000 Subject: [PATCH] - When writing metadata to a geom provider, open the it as read-write since it might do subsequent reads from other providers. This stopped geli (and probably other classes using g_metadata_store as well) from being put on top of gvinum raid5 volumes. Note: The reason it fails in the gvinum raid5 case is that gvinum will read back the old parity stripe before calculating the new parity stripe to be written out again. The write will then fail because the underlying disk to be read is opened write only. MFC after: 1 week --- sbin/geom/misc/subr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/geom/misc/subr.c b/sbin/geom/misc/subr.c index 64df7c6845ed..800cdcfbd69d 100644 --- a/sbin/geom/misc/subr.c +++ b/sbin/geom/misc/subr.c @@ -211,7 +211,7 @@ g_metadata_store(const char *name, u_char *md, size_t size) sector = NULL; error = 0; - fd = open(path, O_WRONLY); + fd = open(path, O_RDWR); if (fd == -1) return (errno); mediasize = g_get_mediasize(name);