commit 87b8f936e9f58031ae638e720361f548bcb9e121 Author: Tomohiro Kusumi <kusumi.tomoh...@gmail.com> Date: Thu Sep 17 19:31:56 2015 +0900
sys/vfs/hammer: Fix incomplete mountctl(2) vop behavior mount(8) is unable to print nomirror mount option while other two (nohistory, master=) are properly printed. This is because hammer's mountctl and mount flags aren't implemented the way vfs expects them to be. mount(8) generates option strings by mountctl(2). ===== missing nomirror string # mount_hammer -o nohistory -o master=5 -o nomirror /dev/da1:/dev/da2:/dev/da3 /HAMMER # mount | grep /HAMMER TEST on /HAMMER (hammer, local, nohistory, master) ===== using this commit # mount_hammer -o nohistory -o master=5 -o nomirror /dev/da1:/dev/da2:/dev/da3 /HAMMER # mount | grep /HAMMER TEST on /HAMMER (hammer, local, nohistory, master, nomirror) This commit adds HMNT_NOMIRROR using a reserved HMNT_RESERVED and assigns HMNT_NOMIRROR to nomirror. This is necessary since two options (master=, nomirror) using the same HMNT_MASTERID is the root cause of above behavior. This change would affect userspace in theory, however the only userspace that would actually use these mount option flags is mount command itself (for inbox userspace programs at least). It's more important that hammer properly handles mount(8). This commit also adds a missing nomirror mountctl element in hammer_vop_mountctl() using HMNT_NOMIRROR so mountctl becomes aware of nomirror option. The reason nomirror needs to use HMNT_NOMIRROR instead of HMNT_MASTERID is because vfs_flagstostr() assumes each option has an unique flag (see vfs_flagstostr() where it does the following). flags &= ~optp->o_opt; This could have been fixed by changing above vfs code, but fixing hammer code is probably the right approach. Also note that master= and nomirror options aren't alias of each other. These two are similar but they do have different purpose, which should make sense to have independent flags, and that's what vfs expects. Summary of changes: sbin/mount_hammer/mount_hammer.c | 4 +++- sys/vfs/hammer/hammer_mount.h | 4 ++-- sys/vfs/hammer/hammer_vfsops.c | 2 +- sys/vfs/hammer/hammer_vnops.c | 1 + 4 files changed, 7 insertions(+), 4 deletions(-) http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/87b8f936e9f58031ae638e720361f548bcb9e121 -- DragonFly BSD source repository