NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
kern/57010: ffs: mounting unclean non-root fs read-only causes spurious write to superblock
>Number: 57010
>Category: kern
>Synopsis: ffs: mounting unclean non-root fs read-only causes spurious write to superblock
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Sep 14 08:40:00 +0000 2022
>Originator: Taylor R Campbell
>Release: current
>Organization:
Ffe FfetBSD Ffoundation
>Environment:
NetBSD singbulli 9.99.99 NetBSD 9.99.99 (GENERIC) #174: Thu Sep 8 01:10:04 UTC 2022 root@singbulli:/home/riastradh/netbsd/current/obj.amd64/sys/arch/amd64/compile/GENERIC amd64
>Description:
The following logic in ffs_mount causes a write to the medium in ffs_cgupdate even if it is mounted read-only:
if (fs->fs_fmod != 0) { /* XXX */
int err;
fs->fs_fmod = 0;
if (fs->fs_clean & FS_WASCLEAN)
fs->fs_time = time_second;
else {
printf("%s: file system not clean (fs_clean=%#x); "
"please fsck(8)\n", mp->mnt_stat.f_mntfromname,
fs->fs_clean);
printf("%s: lost blocks %" PRId64 " files %d\n",
mp->mnt_stat.f_mntfromname, fs->fs_pendingblocks,
fs->fs_pendinginodes);
}
err = UFS_WAPBL_BEGIN(mp);
if (err == 0) {
(void) ffs_cgupdate(ump, MNT_WAIT);
UFS_WAPBL_END(mp);
}
}
This triggers the warning in the specfs spec_strategy function in spec_vnops.c (to which I added db_stacktrace, for attribution of blame):
[ 13476.731716] /altroot/altroot blk 5728 written while ro!
[ 13476.731716] VOP_STRATEGY() at netbsd:VOP_STRATEGY+0x3c
[ 13476.731716] bwrite() at netbsd:bwrite+0x158
[ 13476.731716] ffs_cgupdate() at netbsd:ffs_cgupdate+0x126
[ 13476.731716] ffs_mount() at netbsd:ffs_mount+0x281
[ 13476.741712] VFS_MOUNT() at netbsd:VFS_MOUNT+0x3c
[ 13476.741712] mount_domount() at netbsd:mount_domount+0xd0
[ 13476.741712] do_sys_mount() at netbsd:do_sys_mount+0x26a
[ 13476.741712] sys___mount50() at netbsd:sys___mount50+0x33
[ 13476.741712] syscall() at netbsd:syscall+0x196
[ 13476.741712] --- syscall (number 410) ---
>How-To-Repeat:
1. Interrupt use of a non-root file system during operation so fs->fs_fmod is set.
2. Mount the file system read-only.
>Fix:
Yes, please!
Home |
Main Index |
Thread Index |
Old Index