From owner-freebsd-fs@FreeBSD.ORG Sun Dec 2 22:53:43 2007 Return-Path: Delivered-To: freebsd-fs@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7FA3616A46E for ; Sun, 2 Dec 2007 22:53:43 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from gw.catspoiler.org (adsl-75-1-14-242.dsl.scrm01.sbcglobal.net [75.1.14.242]) by mx1.freebsd.org (Postfix) with ESMTP id 63E4913C457 for ; Sun, 2 Dec 2007 22:53:43 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from FreeBSD.org (mousie.catspoiler.org [192.168.101.2]) by gw.catspoiler.org (8.13.3/8.13.3) with ESMTP id lB2MrYMq037092; Sun, 2 Dec 2007 14:53:38 -0800 (PST) (envelope-from truckman@FreeBSD.org) Message-Id: <200712022253.lB2MrYMq037092@gw.catspoiler.org> Date: Sun, 2 Dec 2007 14:53:34 -0800 (PST) From: Don Lewis To: brde@optusnet.com.au In-Reply-To: <20071202193924.P1745@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii Cc: freebsd-fs@FreeBSD.org Subject: Re: File remove problem X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Dec 2007 22:53:43 -0000 On 2 Dec, Bruce Evans wrote: > So it should be safe to remove all the r/o checks in ufs_inactive() after > fixing the other bugs. ffs_truncate alread panics if fs_ronly, but only > in some cases. In particular, it doesn't panic for truncations that don't > change the file size. Such truncations aren't quite null, since standards > require [f]truncate(2) to mark the ctime and mtime for update. > ffs_truncate() sets the marks, which is correct for null truncations from > userland but not ones from syncer internals. Setting of the marks when > fs_ronly is set should cause panics later (my patch has a vprint() for it). I think the MNT_RDONLY check in ufs_itimes_locked() should be also be changed to look at fs_ronly and panic if any marks are set. This will require some changes to add some early MNT_RDONLY checks. In particular, ffs_read() and ffs_extread() need to check MNT_RDONLY in addition to MNT_NOATIME (as is already done in vfs_mark_atime()). This also looks like it should be a reasonable optimization for read-only file systems that should eliminate unnecessary work at the lower levels of the code. The early IN_ACCESS flag setting in ufs_setattr(), before the MNT_RDONLY check, appears to be protected by the MNT_RDONLY check in vfs_mark_atime().