aboutsummaryrefslogtreecommitdiffstats
path: root/lib/libzfs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libzfs')
-rw-r--r--lib/libzfs/libzfs_mount.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libzfs/libzfs_mount.c b/lib/libzfs/libzfs_mount.c
index 6758f6a09..0fe83e550 100644
--- a/lib/libzfs/libzfs_mount.c
+++ b/lib/libzfs/libzfs_mount.c
@@ -440,9 +440,11 @@ zfs_mount(zfs_handle_t *zhp, const char *options, int flags)
/*
* Determine if the mountpoint is empty. If so, refuse to perform the
- * mount. We don't perform this check if 'remount' is specified.
+ * mount. We don't perform this check if 'remount' is
+ * specified or if overlay option(-O) is given
*/
- if (!remount && !dir_is_empty(mountpoint)) {
+ if ((flags & MS_OVERLAY) == 0 && !remount &&
+ !dir_is_empty(mountpoint)) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"directory is not empty"));
return (zfs_error_fmt(hdl, EZFS_MOUNTFAILED,