freebsd: implement snapdir=disabled
there might be room for improvement w.r.t. runtime changes of the snapdir value after something obtained a handle/descriptor, but this at least implements the basic support. Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
parent
ab9c8a425c
commit
548e4187dc
|
@ -40,7 +40,7 @@ extern "C" {
|
|||
((zdp)->z_zfsvfs->z_ctldir != NULL))
|
||||
#define zfs_show_ctldir(zdp) \
|
||||
(zfs_has_ctldir(zdp) && \
|
||||
((zdp)->z_zfsvfs->z_show_ctldir))
|
||||
((zdp)->z_zfsvfs->z_show_ctldir == ZFS_SNAPDIR_VISIBLE))
|
||||
|
||||
void zfsctl_create(zfsvfs_t *);
|
||||
void zfsctl_destroy(zfsvfs_t *);
|
||||
|
|
|
@ -95,7 +95,7 @@ struct zfsvfs {
|
|||
list_t z_all_znodes; /* all vnodes in the fs */
|
||||
kmutex_t z_znodes_lock; /* lock for z_all_znodes */
|
||||
struct zfsctl_root *z_ctldir; /* .zfs directory pointer */
|
||||
boolean_t z_show_ctldir; /* expose .zfs in the root dir */
|
||||
uint_t z_show_ctldir; /* how to expose .zfs in the root dir */
|
||||
boolean_t z_issnap; /* true if this is a snapshot */
|
||||
boolean_t z_use_fuids; /* version allows fuids */
|
||||
boolean_t z_replay; /* set during ZIL replay */
|
||||
|
|
|
@ -913,6 +913,8 @@ zfs_lookup(vnode_t *dvp, const char *nm, vnode_t **vpp,
|
|||
}
|
||||
if (zfs_has_ctldir(zdp) && strcmp(nm, ZFS_CTLDIR_NAME) == 0) {
|
||||
zfs_exit(zfsvfs, FTAG);
|
||||
if ((zdp)->z_zfsvfs->z_show_ctldir == ZFS_SNAPDIR_DISABLED)
|
||||
return (SET_ERROR(ENOENT));
|
||||
if ((cnp->cn_flags & ISLASTCN) != 0 && nameiop != LOOKUP)
|
||||
return (SET_ERROR(ENOTSUP));
|
||||
error = zfsctl_root(zfsvfs, cnp->cn_lkflags, vpp);
|
||||
|
|
Loading…
Reference in New Issue