Create an 'overlay' property

Add a new 'overlay' property (default 'off') that controls whether the
filesystem should be mounted even if the mountpoint is busy or if it
should fail with a 'mountpoint not empty'.

Doing overlay mounts is the default mount behavior on Linux, but not
in ZFS. It have been decided that following the ZFS behavior should
be the default, but this overlay allows for site administrator to
override this decision on a per-dataset basis.

Signed-off-by: Turbo Fredriksson <turbo@bayour.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes: #2503
This commit is contained in:
Turbo Fredriksson
2014-07-25 12:42:00 +02:00
committed by Brian Behlendorf
parent 194e56234a
commit f67d709080
4 changed files with 28 additions and 0 deletions
+14
View File
@@ -5641,6 +5641,7 @@ share_mount_one(zfs_handle_t *zhp, int op, int flags, char *protocol,
char mountpoint[ZFS_MAXPROPLEN];
char shareopts[ZFS_MAXPROPLEN];
char smbshareopts[ZFS_MAXPROPLEN];
char overlay[ZFS_MAXPROPLEN];
const char *cmdname = op == OP_SHARE ? "share" : "mount";
struct mnttab mnt;
uint64_t zoned, canmount;
@@ -5747,6 +5748,19 @@ share_mount_one(zfs_handle_t *zhp, int op, int flags, char *protocol,
return (0);
}
/*
* Overlay mounts are disabled by default but may be enabled
* via the 'overlay' property or the 'zfs mount -O' option.
*/
if (!(flags & MS_OVERLAY)) {
if (zfs_prop_get(zhp, ZFS_PROP_OVERLAY, overlay,
sizeof (overlay), NULL, NULL, 0, B_FALSE) == 0) {
if (strcmp(overlay, "on") == 0) {
flags |= MS_OVERLAY;
}
}
}
/*
* At this point, we have verified that the mountpoint and/or
* shareopts are appropriate for auto management. If the