From owner-freebsd-fs@FreeBSD.ORG  Wed Jul  4 01:08:41 2007
Return-Path: <owner-freebsd-fs@FreeBSD.ORG>
X-Original-To: freebsd-fs@freebsd.org
Delivered-To: freebsd-fs@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 35C3C16A400
	for <freebsd-fs@freebsd.org>; Wed,  4 Jul 2007 01:08:41 +0000 (UTC)
	(envelope-from brde@optusnet.com.au)
Received: from mail03.syd.optusnet.com.au (mail03.syd.optusnet.com.au
	[211.29.132.184])
	by mx1.freebsd.org (Postfix) with ESMTP id C85E113C44C
	for <freebsd-fs@freebsd.org>; Wed,  4 Jul 2007 01:08:40 +0000 (UTC)
	(envelope-from brde@optusnet.com.au)
Received: from c220-239-235-248.carlnfd3.nsw.optusnet.com.au
	(c220-239-235-248.carlnfd3.nsw.optusnet.com.au [220.239.235.248])
	by mail03.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id
	l6418aXY006573
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Wed, 4 Jul 2007 11:08:38 +1000
Date: Wed, 4 Jul 2007 11:08:36 +1000 (EST)
From: Bruce Evans <brde@optusnet.com.au>
X-X-Sender: bde@delplex.bde.org
To: David Cecil <david.cecil@nokia.com>
In-Reply-To: <4689EFAA.4080009@nokia.com>
Message-ID: <20070704102358.W95084@delplex.bde.org>
References: <45F776AE.8090702@nokia.com>
	<20070314161041.GI7847@garage.freebsd.pl>
	<45F8EE27.6070208@nokia.com>
	<20070315090031.GB80993@deviant.kiev.zoral.com.ua>
	<4689EFAA.4080009@nokia.com>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: freebsd-fs@freebsd.org, Pawel Jakub Dawidek <pjd@freebsd.org>
Subject: Re: FFS writes to read-only mount
X-BeenThere: freebsd-fs@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Filesystems <freebsd-fs.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-fs>,
	<mailto:freebsd-fs-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-fs>
List-Post: <mailto:freebsd-fs@freebsd.org>
List-Help: <mailto:freebsd-fs-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-fs>,
	<mailto:freebsd-fs-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 04 Jul 2007 01:08:41 -0000

On Tue, 3 Jul 2007, David Cecil wrote:

> in March I mailed the list about errors I'm seeing that look something like 
> this:
> g_vfs_done():mirror/gmroots1f[WRITE(offset=1349091328, length=16384)]error = 
> 1
> (Note that gmroots1f is not a complete mirror set, just one disk ,and was 
> never part of a complete mirror set.  Also, partition f is the root 
> partition.)
>
> The problem comes about because the underlying geom object has had its access 
> permissions changed so that g_io_check fails due to acw being 0 (as per my 
> original message at the end of this email).  This problem is most easily 
> reproducible when during boot if the root filesystem is changed from rw to ro 
> mount.  Our code is now 6.1-based.

At least -current seems to have the opposite problem -- that acw is not
changed to 0 on mount -o ro, as shown by:

boot
use the system a bit
# fsck -p /          # fails of course since / is rw
# mount -u -o ro /   # fails with EBUSY
# # I don't want to try mount -f ... /
# kill -TERM 1       # shut down to single user mode to run fsck safely
# umount -A          # old bug: this still doesn't remount / ro
                      # not so old bug: it now tries to unmount devfs; this
 		     # fails of course
# mount -u -o ro /   # finish unmounting / (works according to mount status)
# fsck -p /          # fails, apparently since acw is still nonzero

In some non-current versions of FreeBSD, I have debugging code in
ffs_update() that complains about attempts to update inodes on read-only
file systems.  Such attempts certainly occur, due to historical mistakes.
They are supposed to be handled (starting sometime in 4.x) by silently
ignoring the problem and clearing the IN_MODIFIED flag and related flags
so that the update is not retried later.  I don't know of any cases where
this doesn't work.

Bruce