🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: muc.lists.freebsd.fs
Article #65

[Bug 223786] Remounting a UFS filesystem read-only takes very long time

#65
From: bugzilla-noreply
Date: Fri, 27 Nov 2026 08:05
77 lines
4862 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223786

Aadya Chinubhai <aadyachinubhai@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aadyachinubhai@gmail.com

--- Comment #10 from Aadya Chinubhai <aadyachinubhai@gmail.com> ---
I tried to reproduce this on FreeBSD 15.1 in QEMU, on a UFS2 filesystem
with soft updates and TRIM enabled. I did not see anything close to 330
seconds, but I found that the time spent in "mount -u -o ro" grows with
the number of new files or directories created just before it.

With 3000 new files of 512 bytes each, the remount issued 6040 block
writes and took 3.06 seconds on a disk with about 0.5ms write latency (on a
QEMU disk opened with cache=directsync). With 3000 new directories it issued
6027 writes and took 4.51 seconds. 3000 new empty files caused only 39 writes.
The context switch count is about equal to the write count, so the writes seem
to be issued one at a time.

A dtrace of the I/O issued by mount during the remount of the 3000 new files
shows two stacks with about 3000 hits each:

              kernel`bufwrite+0x1dc
              kernel`ffs_update+0x2ee
              kernel`ffs_syncvnode+0x560
              kernel`ffs_sync+0x17d
              kernel`vfs_write_suspend+0x156
              kernel`vfs_write_suspend_umnt+0x20
              kernel`ffs_mount+0x6a7
              3002

              kernel`bufwrite+0x1dc
              kernel`vfs_bio_awrite+0x3bd
              kernel`ffs_syncvnode+0x3ce
              kernel`ffs_sync+0x17d
              kernel`vfs_write_suspend+0x156
              kernel`vfs_write_suspend_umnt+0x20
              kernel`ffs_mount+0x6a7
              3000

For 3000 new directories the two big ones go through
softdep_sync_buf() instead of ffs_syncvnode() directly.

In ffs_sync() (ffs_vfsops.c) the loop calls

> error = ffs_syncvnode(vp, waitfor, 0);

for each dirty vnode, with waitfor being MNT_WAIT. In ffs_syncvnode()
(ffs_vnops.c) that means an async pass over the vnode's buffers, then

> bufobj_wwait(bo, 0, 0);

and finally

> error = ffs_update(vp, 1);

which ends in bwrite(bp) in ffs_update() (ffs_inode.c). If I read it
right, each inode is therefore written out with its whole block and
waited for before the next vnode is started, so the same inode block is
written once per inode and none of the I/O overlaps.

I have not tried a fix. Is there a reason the synchronous
ffs_update() has to happen per vnode?

-- 
You are receiving this mail because:
You are the assignee for the bug.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Technical Details
Message-ID: <bug-223786-3630-AvM3lxpCSX@https.bugs.freebsd.org/bugzilla/>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!weretis.net!feeder8.news.weretis.net!3.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.muc.de!.POSTED.news.muc.de!not-for-mail
References: <bug-223786-3630@https.bugs.freebsd.org/bugzilla/>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!weretis.net!feeder8.news.weretis.net!3.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.muc.de!.POSTED.news.muc.de!not-for-mail
From: bugzilla-noreply@freebsd.org
Newsgroups: muc.lists.freebsd.fs
Subject: [Bug 223786] Remounting a UFS filesystem read-only takes very long
 time
Date: Fri, 27 Nov 2026 08:05:31 +0000
Organization: Newsgate at muc.de e.V.
Approved: news-admin@muc.de
Distribution: world
Message-ID: <bug-223786-3630-AvM3lxpCSX@https.bugs.freebsd.org/bugzilla/>
References: <bug-223786-3630@https.bugs.freebsd.org/bugzilla/>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: news.muc.de; posting-host="news.muc.de:193.149.48.2";
	logging-data="44752"; mail-complaints-to="news-admin@muc.de"
X-Original-To: fs@mlmmj.nyi.freebsd.org
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1795766731;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=Azu16DkygKZJrt8kj83PocI/Y3s21STf1qfmam15IcI=;
	b=azEgYVXIdBdAwfVhGpsZERqsHhMAvvyNsowyuyDxvpuVzhPXIp2Ozdmx5NY5k5PeX31Glf
	A3uhw75lvBgVXnN+JqTFTKRjRpu9nd0rXBPPp4S1vQZxcUJL+WwkaafmKjCb86TOQKwVTS
	zdT6F6yLb/2kraSZrnDfgRlJwUMTdpVVM2KcBolpF3NH/Xumg3Xc76UbF/0N8dx73HQyP2
	bF8DkdMPACpggd2xSiq8JiIJVx+bJ8y7bkw4769odEAJhvoHt114wIpBArlnegBV1xgLzA
	bpgVe1U7WgTFi6U3zrMnGylMvsGCfcgnPgkD4ViFJHZxVyuQkP0NlC3gWslR5Q==
X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f
In-Reply-To: <bug-223786-3630@https.bugs.freebsd.org/bugzilla/>
Auto-Submitted: auto-generated
Precedence: list
X-Newsgate-Id: f02c70b8849f+
X-No-Archive: Yes