Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 Dec 2008 20:21:01 +0100
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        Ulf Lilleengen <lulf@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r186038 - head/sbin/geom/misc
Message-ID:  <20081214192100.GB16926@garage.freebsd.pl>
In-Reply-To: <200812131414.mBDEEu0A031376@svn.freebsd.org>
References:  <200812131414.mBDEEu0A031376@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
On Sat, Dec 13, 2008 at 02:14:56PM +0000, Ulf Lilleengen wrote:
> Author: lulf
> Date: Sat Dec 13 14:14:56 2008
> New Revision: 186038
> URL: http://svn.freebsd.org/changeset/base/186038
> 
> Log:
>   - 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.

I think we discussed this in the past. In my opinion this change is
incorrect. The intend here is to only write something, that's why I use
O_WRONLY. If gvinum/raid5 needs also read something to satisfy the
write, this is gvinum/raid5's internal detail and should be handled
there. RAID5 by design needs to read before it can write (in most
cases), does it mean that the O_WRONLY flag became bogus suddenly? No.
The flag given to open(2) describes caller's intend, not provider's
internals.

> Modified:
>   head/sbin/geom/misc/subr.c
> 
> Modified: head/sbin/geom/misc/subr.c
> ==============================================================================
> --- head/sbin/geom/misc/subr.c	Sat Dec 13 13:07:12 2008	(r186037)
> +++ head/sbin/geom/misc/subr.c	Sat Dec 13 14:14:56 2008	(r186038)
> @@ -211,7 +211,7 @@ g_metadata_store(const char *name, u_cha
>  	sector = NULL;
>  	error = 0;
>  
> -	fd = open(path, O_WRONLY);
> +	fd = open(path, O_RDWR);
>  	if (fd == -1)
>  		return (errno);
>  	mediasize = g_get_mediasize(name);

-- 
Pawel Jakub Dawidek                       http://www.wheel.pl
pjd@FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4 (FreeBSD)

iD8DBQFJRVybForvXbEpPzQRAgc3AJ9DzXxiEepsESTEcxQpnh4UIrBKHQCg1n7F
pr0qTfPiyIFilu/4mEZuAbQ=
=IphU
-----END PGP SIGNATURE-----

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20081214192100.GB16926>