Bug 253048 - unionfs shows old file with link count of zero
Summary: unionfs shows old file with link count of zero
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 12.2-RELEASE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-fs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-27 16:12 UTC by Jan Martin Mikkelsen
Modified: 2021-01-28 08:09 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Martin Mikkelsen 2021-01-27 16:12:53 UTC
After executing pwd_mkdb on a system with a unionfs mount above /etc, the /etc/spwd.db file is the old version of the file with a link count of zero.

Filesystems:

/dev/gpt/root1 on / (ufs, local, read-only)
/dev/gpt/cfg on /cfg (ufs, local, synchronous, soft-updates)
<above>:/cfg/etc on /etc (unionfs, local, read-only)

Command:

pwd_mkdb -p -d /cfg/etc /cfg/etc/master.passwd

Results:

$ ls -il /etc/*pwd.db
65721 -rw-r--r--  1 root  wheel  40960 27 Jan 16:32 /etc/pwd.db
65720 -rw-------  0 root  wheel  40960 26 Jan 14:04 /etc/spwd.db

$ ls -il /cfg/etc/*pwd.db
65721 -rw-r--r--  1 root  wheel  40960 27 Jan 16:32 /cfg/etc/pwd.db
65724 -rw-------  1 root  wheel  40960 27 Jan 16:32 /cfg/etc/spwd.db

The /etc/spwd.db file with inode number 65720, and a link count of zero, is identical to the /cfg/etc/spwd.db file from before the pwd_mkdb command (checked against a backup).

Removing /cfg/etc/spwd.db removes the file from /cfg/etc/spwd.db, but the /etc/spwd.db version does not change.