# What is intention of root_mount_hold/root_mount_rel?



## redriver (Dec 8, 2015)

When I read FreeBSD kernel code, I saw some places use "root_mount_hold/root_mount_rel", which looks like to "lock" something. But I did not find any introduction about them. Does anyone know the intention of them?

When shall the driver need that?

I found zfs__init uses them.

```
zfs__init(void)
{

        zfs_root_token = root_mount_hold("ZFS");

        mutex_init(&zfs_share_lock, NULL, MUTEX_DEFAULT, NULL);

        spa_init(FREAD | FWRITE);
        zfs_init();
        zvol_init();
        zfs_ioctl_init();

        tsd_create(&zfs_fsyncer_key, NULL);
        tsd_create(&rrw_tsd_key, rrw_tsd_destroy);
        tsd_create(&zfs_allow_log_key, zfs_allow_log_destroy);

        printf("ZFS storage pool version: features support (" SPA_VERSION_STRING ")\n");
        root_mount_rel(zfs_root_token);
```


----------

