Skip to content

Commit

Permalink
freebsd: implement snapdir=disabled
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Fabian-Gruenbichler committed Mar 6, 2024
1 parent ab9c8a4 commit 548e418
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/os/freebsd/zfs/sys/zfs_ctldir.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 *);
Expand Down
2 changes: 1 addition & 1 deletion include/os/freebsd/zfs/sys/zfs_vfsops_os.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 2 additions & 0 deletions module/os/freebsd/zfs/zfs_vnops_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 548e418

Please sign in to comment.