vfs_mountfs passes junk in flags to domount
... which can cause filesystems to fail to mount. Possibly more of an issue when using a newer compiler, or a higher optimisation level.
A little background: we have some extra filesystems that we mount at boot and were seeing mount failures when running on real hardware (things worked fine on VMware). The cause was tracked down to the vfs_mountfs function which was passing an improperly initialised mounta struct to domount. This was then passed to zfs_mount which was returning EINVAL because the mount flags were invalid (as they were junk from the stack).
To clarify it's actually the "datalen" field which causes this check to fail when non-zero: https://github.com/illumos/illumos-gate/blob/master/usr/src/uts/common/fs/zfs/zfs_vfsops.c#L1566
Updated by Electric Monk over 5 years ago
- Status changed from In Progress to Closed
- % Done changed from 0 to 100
commit 2fc78efe68572a35081bd6d8b1deb2560619c3e6 Author: Andrew Stormont <firstname.lastname@example.org> Date: 2017-01-25T15:55:09.000Z 7798 vfs_mountfs passes junk in flags to domount Reviewed by: Alexander Pyhalov <email@example.com> Reviewed by: Toomas Soome <firstname.lastname@example.org> Reviewed by: Yuri Pankov <email@example.com> Reviewed by: Juraj Lutter <firstname.lastname@example.org> Reviewed by: Marcel Telka <email@example.com> Approved by: Dan McDonald <firstname.lastname@example.org>