Index: UPDATING =================================================================== --- UPDATING (wersja 197018) +++ UPDATING (kopia robocza) @@ -22,6 +22,10 @@ machines to maximize performance. (To disable malloc debugging, run ln -s aj /etc/malloc.conf.) +20090910: + ZFS snapshots are now mounted with MNT_IGNORE flag. Use -v option for + mount(8) and -a option for df(1) to see them. + 20090825: The old tunable hw.bus.devctl_disable has been superseded by hw.bus.devctl_queue. hw.bus.devctl_disable=1 in loader.conf should be Index: sbin/mount/mount.c =================================================================== --- sbin/mount/mount.c (wersja 197018) +++ sbin/mount/mount.c (kopia robocza) @@ -348,6 +348,9 @@ if (checkvfsname(mntbuf[i].f_fstypename, vfslist)) continue; + if (!verbose && + (mntbuf[i].f_flags & MNT_IGNORE) != 0) + continue; prmount(&mntbuf[i]); } } Index: sbin/mount/mount.8 =================================================================== --- sbin/mount/mount.8 (wersja 197018) +++ sbin/mount/mount.8 (kopia robocza) @@ -469,6 +469,12 @@ option. .It Fl v Verbose mode. +If the +.Fl v +is used alone, show all file systems, including those that were mounted with the +.Dv MNT_IGNORE +flag and show additional information about each file system (including fsid +when run by root). .It Fl w The file system object is to be read and write. .El Index: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c =================================================================== --- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c (wersja 197018) +++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c (kopia robocza) @@ -880,17 +880,9 @@ mountpoint = kmem_alloc(mountpoint_len, KM_SLEEP); (void) snprintf(mountpoint, mountpoint_len, "%s/.zfs/snapshot/%s", dvp->v_vfsp->mnt_stat.f_mntonname, nm); - err = domount(curthread, *vpp, "zfs", mountpoint, snapname, 0); + err = mount_snapshot(curthread, vpp, "zfs", mountpoint, snapname, 0); kmem_free(mountpoint, mountpoint_len); if (err == 0) { - vnode_t *mvp; - - ASSERT((*vpp)->v_mountedhere != NULL); - err = VFS_ROOT((*vpp)->v_mountedhere, LK_EXCLUSIVE, &mvp); - ASSERT(err == 0); - VN_RELE(*vpp); - *vpp = mvp; - /* * Fix up the root vnode mounted on .zfs/snapshot/. * @@ -902,14 +894,6 @@ VTOZ(*vpp)->z_zfsvfs->z_parent = zfsvfs; } mutex_exit(&sdp->sd_lock); - /* - * If we had an error, drop our hold on the vnode and - * zfsctl_snapshot_inactive() will clean up. - */ - if (err) { - VN_RELE(*vpp); - *vpp = NULL; - } ZFS_EXIT(zfsvfs); return (err); } Index: sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c =================================================================== --- sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c (wersja 197018) +++ sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c (kopia robocza) @@ -112,12 +112,13 @@ } int -domount(kthread_t *td, vnode_t *vp, const char *fstype, char *fspath, +mount_snapshot(kthread_t *td, vnode_t **vpp, const char *fstype, char *fspath, char *fspec, int fsflags) { struct mount *mp; struct vfsconf *vfsp; struct ucred *cr; + vnode_t *vp = *vpp; int error; /* @@ -160,9 +161,14 @@ */ if (fsflags & MNT_RDONLY) mp->mnt_flag |= MNT_RDONLY; - mp->mnt_flag &=~ MNT_UPDATEMASK; + mp->mnt_flag &= ~MNT_UPDATEMASK; mp->mnt_flag |= fsflags & (MNT_UPDATEMASK | MNT_FORCE | MNT_ROOTFS); /* + * We don't want snapshots to be visible in regular + * mount(8) and df(1) output. + */ + mp->mnt_flag |= MNT_IGNORE; + /* * Unprivileged user can trigger mounting a snapshot, but we don't want * him to unmount it, so we switch to privileged of original mount. */ @@ -215,22 +221,17 @@ if (VFS_ROOT(mp, LK_EXCLUSIVE, &mvp)) panic("mount: lost mount"); mountcheckdirs(vp, mvp); - vput(mvp); - VOP_UNLOCK(vp, 0); - if ((mp->mnt_flag & MNT_RDONLY) == 0) - error = vfs_allocate_syncvnode(mp); + vput(vp); vfs_unbusy(mp); - if (error) - vrele(vp); - else - vfs_mountedfrom(mp, fspec); + *vpp = mvp; } else { VI_LOCK(vp); vp->v_iflag &= ~VI_MOUNT; VI_UNLOCK(vp); - VOP_UNLOCK(vp, 0); + vput(vp); vfs_unbusy(mp); vfs_mount_destroy(mp); + *vpp = NULL; } return (error); } Index: sys/cddl/compat/opensolaris/sys/vfs.h =================================================================== --- sys/cddl/compat/opensolaris/sys/vfs.h (wersja 197018) +++ sys/cddl/compat/opensolaris/sys/vfs.h (kopia robocza) @@ -110,8 +110,8 @@ int flags __unused); void vfs_clearmntopt(vfs_t *vfsp, const char *name); int vfs_optionisset(const vfs_t *vfsp, const char *opt, char **argp); -int domount(kthread_t *td, vnode_t *vp, const char *fstype, char *fspath, - char *fspec, int fsflags); +int mount_snapshot(kthread_t *td, vnode_t **vpp, const char *fstype, + char *fspath, char *fspec, int fsflags); typedef uint64_t vfs_feature_t;