Port autofs to DragonFly

Tomohiro Kusumi kusumi.tomohiro at gmail.com
Sat May 7 13:23:56 PDT 2016


The code has become a bit more stable.
I haven't pushed the code to publicly available git repo yet because
it has way too many debug kprintfs all over in autofs and syscalls
that need to be cleaned up.

Some of the limitations in terms of features are

1. fstyp unable to detect ZFS and GEOM (but it does detect HAMMER).
2. automountd unable to mount HAMMER consists of multiple volumes.
3. automountd ignores /dev/md*
4. vfs.autofs.mount_on_stat is not supported.


1. This isn't a real issue. This is because DragonFly doesn't have
headers that define magic numbers for ZFS and GEOM, and I don't want
to spend extra time bringing them in since DragonFly can't use or
mount them anyway. Also ZFS headers are probably in CDDL.

2. This is because of the way automountd and autofs sh scripts work.
This should be fixed, but requires userspace rewrite. I probably don't
fix this initially.

3. I had to ignore /dev/md* because of the stupid behavior of /dev/md* open.
https://bugs.dragonflybsd.org/issues/2909

4. This is disabled by default on FreeBSD so it's usually unused.
DragonFly has this sysctl too, but does nothing regardless of its
value. Autofs recursivelly calls some of the VOPs from a vnode of
autofs to a vnode of another filesystem, which is probably something
that most filesystems never do. I couldn't find a way to make this
work without causing deadlock in namecache paths for
vfs.autofs.mount_on_stat case.


Other than autofs code, I need to bring in these from FreeBSD.
https://bugs.dragonflybsd.org/issues/2905
https://bugs.dragonflybsd.org/issues/2907

Most of the issues that I've had so far are something to do with
interaction between automountd (userspace daemon) and a process that
has accessed autofs directory. The basic mechanism of autofs is that
these two waking up each other after each has finished its job. If
these two fail to interact properly, it ends up panicing or
timeout/retry storm.


[root@]~# uname -r
4.5-DEVELOPMENT
[root@]~# newfs_hammer -L TEST /dev/da1 > /dev/null
[root@]~# /etc/autofs/special_media
TEST
Fedora-S-23-x86_64
[root@]~# kldload autofs
[root@]~# automount
[root@]~# df /mnt
Filesystem 1K-blocks Used Avail Capacity  Mounted on
map -media         0    0     0   100%    /mnt
[root@]~# automountd -vvvvvvvvvvvv
[root@]~# ls /mnt
Fedora-S-23-x86_64 TEST
[root@]~# cd /mnt/TEST
[root@]/mnt/TEST# ls
[root@]/mnt/TEST# cd ../Fedora-S-23-x86_64
[root@]/mnt/Fedora-S-23-x86_64# ls
.discinfo .treeinfo EFI       Packages  TRANS.TBL images    isolinux  repodata
[root@]/mnt/Fedora-S-23-x86_64# mount | grep "/mnt"
map -media on /mnt (autofs)
TEST on /mnt/TEST (hammer, nosuid, automounted, noatime, local)
/dev/da8 on /mnt/Fedora-S-23-x86_64 (cd9660, read-only, nosuid,
automounted, local)
[root@]~# autounmountd -r 30 -t 30 -vvvvvvvvvvv; sleep 30
[root@]~# mount | grep "/mnt"
map -media on /mnt (autofs)
[root@]~# ls /mnt
Fedora-S-23-x86_64 TEST
[root@]~# mount | grep "/mnt"
map -media on /mnt (autofs)
[root@]~# ls /mnt/Fedora-S-23-x86_64
.discinfo .treeinfo EFI       Packages  TRANS.TBL images    isolinux  repodata
[root@]~# mount | grep "/mnt"
map -media on /mnt (autofs)
/dev/da8 on /mnt/Fedora-S-23-x86_64 (cd9660, read-only, nosuid,
automounted, local)
[root@]~# automount -u
[root@]~# mount | grep "/mnt"
map -media on /mnt (autofs)



2016-05-04 18:48 GMT+09:00 Tomohiro Kusumi <kusumi.tomohiro at gmail.com>:
> I've been working on porting autofs from FreeBSD for the last 3-4 weeks.
> It finally started to work in the last few days though it's still *very* buggy.
>
> I'll be committing this to master sometime in May even if it's not
> 100% stable after tested by a user who asked me to port this, as I
> don't want to spend too much time on this.
> I don't use NFS, but it's easy to imagine issues with NFS just like
> other filesystems.
>
> It actually took more time than I thought it would be, because there
> were several features supported by FreeBSD but not on DragonFly,
> which broke portability of userspace and made me bring in those
> missing stuff from FreeBSD first.
>
> (I did this as a practice before I attempt to port HAMMER1 to other BSD kernel.
> I originally planned to do this with ext2, but changed my mind as
> someone asked me to port autofs.)
>
> -----
> [root@]~# uname -r
> 4.5-DEVELOPMENT
> [root@]~# kldload autofs
> [root@]~# grep "/mnt" /etc/auto_master
> /mnt            -media          -nosuid
> [root@]~# ls /mnt
> [root@]~# automount
> [root@]~# df /mnt
> Filesystem 1K-blocks Used Avail Capacity  Mounted on
> map -media         0    0     0   100%    /mnt
> [root@]~# automountd -vvvvvvvv
> [root@]~# ls /mnt
> Fedora-S-23-x86_64
> [root@]~# cd /mnt/Fedora-S-23-x86_64
> [root@]/mnt/Fedora-S-23-x86_64# ls
> .discinfo .treeinfo EFI       Packages  TRANS.TBL images    isolinux  repodata



More information about the Users mailing list