Bug 239797 - zfs promote corrupted df/mount output of device names of UFS filesystems
Summary: zfs promote corrupted df/mount output of device names of UFS filesystems
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-fs mailing list
Depends on:
Reported: 2019-08-12 08:55 UTC by ota
Modified: 2019-08-14 08:24 UTC (History)
2 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description ota 2019-08-12 08:55:41 UTC
After running several zfs promote and zfs destroy commands, the output of df/mount incorrectly list zvol name for / and /usr UFS filesystems.  Below is the output of zfs list and df to compare.

sys/zlib_BBD_CTF@starting_bxe prefixes to these UFS filesystems are incorrect.
I didn't see any functionality issues with these although I wasn't comfortable.

After rebooting, the output of df and mount became correct.

% zfs list
sys                15.6G  7.12G   262K  /mnt/sys
sys/local          4.39G  7.12G  2.20G  /usr/local
sys/obj            6.43G  7.12G  6.43G  /usr/obj
sys/ports           309M  7.12G   309M  /usr/ports
sys/ports-build    16.5M  7.12G  16.5M  /ports
sys/src-git-zlib   2.96G  7.12G  1.51G  /usr/obj/freebsd
sys/src2            742M  7.12G   742M  /usr/src
sys/zlib-dual-git  77.2M  7.12G  1.76G  /mnt/sys/zlib-dual-git
sys/zlib_BBD_CTF    729M  7.12G   729M  /usr/obj/zlib
% df -h
Filesystem                                   Size    Used   Avail Capacity  Mounted on
sys/zlib_BBD_CTF@starting_bxe/dev/ada0s1a    989M    779M    131M    86%    /
devfs                                        1.0K    1.0K      0B   100%    /dev
sys/zlib_BBD_CTF@starting_bxe/dev/ada0s1d    6.8G    2.6G    3.7G    41%    /usr
tmpfs                                        2.0G     28K    2.0G     0%    /tmp
tmpfs                                        2.0G    4.0K    2.0G     0%    /usr/tmp
sys                                          7.1G    262K    7.1G     0%    /mnt/sys
sys/obj                                       14G    6.4G    7.1G    47%    /usr/obj
sys/ports-build                              7.1G     16M    7.1G     0%    /ports
sys/src2                                     7.8G    742M    7.1G     9%    /usr/src
sys/local                                    9.3G    2.2G    7.1G    24%    /usr/local
sys/ports                                    7.4G    309M    7.1G     4%    /usr/ports
sys/zlib_BBD_CTF                             7.8G    729M    7.1G     9%    /usr/obj/zlib
sys/zlib-dual-git                            8.9G    1.8G    7.1G    20%    /mnt/sys/zlib-dual-git
sys/src-git-zlib                             8.6G    1.5G    7.1G    18%    /usr/obj/freebsd
Comment 1 martin 2019-08-13 10:20:46 UTC
The code leading up to https://svnweb.freebsd.org/base/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c?view=markup#l3128 looks suspicious to me.  Unless I'm misreading it, oldname is allocated but never filled with a name, so if the first byte is null then it will rename all mounts whose f_mntfromname starts with /.
Comment 2 Andriy Gapon freebsd_committer 2019-08-14 08:24:46 UTC
(In reply to martin from comment #1)
Good catch! Comparing dsl_dataset_promote_sync to dsl_dataset_rename_snapshot_sync_impl, it seems that the former is missing some snprintf-s.