From owner-freebsd-bugs@FreeBSD.ORG Fri Feb 15 13:50:05 2013 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0B30E8A8 for ; Fri, 15 Feb 2013 13:50:05 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id E3219D3B for ; Fri, 15 Feb 2013 13:50:04 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.6/8.14.6) with ESMTP id r1FDo4m5010061 for ; Fri, 15 Feb 2013 13:50:04 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.6/8.14.6/Submit) id r1FDo4GX010060; Fri, 15 Feb 2013 13:50:04 GMT (envelope-from gnats) Resent-Date: Fri, 15 Feb 2013 13:50:04 GMT Resent-Message-Id: <201302151350.r1FDo4GX010060@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Norbert Koch Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0C16C12E for ; Fri, 15 Feb 2013 13:43:14 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id E85F1C1F for ; Fri, 15 Feb 2013 13:43:13 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.5/8.14.5) with ESMTP id r1FDhD8p018890 for ; Fri, 15 Feb 2013 13:43:13 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.5/8.14.5/Submit) id r1FDhDAQ018889; Fri, 15 Feb 2013 13:43:13 GMT (envelope-from nobody) Message-Id: <201302151343.r1FDhDAQ018889@red.freebsd.org> Date: Fri, 15 Feb 2013 13:43:13 GMT From: Norbert Koch To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: kern/176169: system unresponsive for 1min after mounting flash read-only X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Feb 2013 13:50:05 -0000 >Number: 176169 >Category: kern >Synopsis: system unresponsive for 1min after mounting flash read-only >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri Feb 15 13:50:03 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Norbert Koch >Release: FreeBSD 9.1 >Organization: >Environment: FreeBSD 9.1 RELEASE >Description: This problem has already been reported and fixed(?) in pfsense's bug tracking system by adding the sysctl vfs.forcesync. The author of the fix is Ermal Luçi ( http://redmine.pfsense.org/users/6 ). http://redmine.pfsense.org/projects/pfsense-tools/repository/revisions/008742971cb44d8c0f81929504ab7330442c4ba4/entry/patches/RELENG_8_3/vfs_subr_mount_RO.diff I tried this under FreeBSD 9.1 and it seems to work. mount -ow / ; time mount -orf / : 65s without patch With patch time is <1s. As I am no vfs expert I do not know what potential negative consequences this change may have. The original patch uses CTLFLAG_RD for forcesync. I do not see why this should not be CTLFLAG_RW. >How-To-Repeat: >Fix: diff -r 89885db951fb src/sys/kern/vfs_subr.c --- a/src/sys/kern/vfs_subr.c Mon Feb 04 14:45:48 2013 +0100 +++ b/src/sys/kern/vfs_subr.c Fri Feb 15 14:32:09 2013 +0100 @@ -121,6 +121,11 @@ SYSCTL_ULONG(_vfs, OID_AUTO, numvnodes, CTLFLAG_RD, &numvnodes, 0, "Number of vnodes in existence"); +static int forcesync; + +SYSCTL_INT(_vfs, OID_AUTO, forcesync, CTLFLAG_RW, &forcesync, 0, + "Do full checks when switching to RO mount of FS"); + /* * Conversion tables for conversion from vnode types to inode formats * and back. @@ -2581,6 +2586,7 @@ * vnodes open for writing. */ if (flags & WRITECLOSE) { + if (forcesync) { if (vp->v_object != NULL) { VM_OBJECT_LOCK(vp->v_object); vm_object_page_clean(vp->v_object, 0, 0, 0); @@ -2593,6 +2599,7 @@ MNT_VNODE_FOREACH_ALL_ABORT(mp, mvp); return (error); } + } error = VOP_GETATTR(vp, &vattr, td->td_ucred); VI_LOCK(vp); >Release-Note: >Audit-Trail: >Unformatted: