kern/176169: system unresponsive for 1min after mounting flash read-only

Norbert Koch nkoch at demig.de
Fri Feb 15 13:50:05 UTC 2013


>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:


More information about the freebsd-bugs mailing list