diff options
author | Turbo Fredriksson <[email protected]> | 2014-07-25 12:42:00 +0200 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2014-08-15 13:39:19 -0700 |
commit | f67d709080f3d4a247191f0d25cbedc5da103f78 (patch) | |
tree | 5050bf2725b9ed94387e6901ea30325e0a16c1ae /cmd/zfs | |
parent | 194e56234a58fa39c22aada5210f06ddf62c69d5 (diff) |
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 <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes: #2503
Diffstat (limited to 'cmd/zfs')
-rw-r--r-- | cmd/zfs/zfs_main.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c index 84073435e..83f02666d 100644 --- a/cmd/zfs/zfs_main.c +++ b/cmd/zfs/zfs_main.c @@ -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; @@ -5748,6 +5749,19 @@ share_mount_one(zfs_handle_t *zhp, int op, int flags, char *protocol, } /* + * 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 * filesystem is already mounted or shared, return (failing |