🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: muc.lists.freebsd.fs
1 messages
1 total messages Started by bugzilla-noreply Fri, 27 Nov 2026 08:05
[Bug 223786] Remounting a UFS filesystem read-only takes very long time
#65
Author: 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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads