Add overlay(-O) mount option support
[zfs.git] / lib / libzfs / libzfs_mount.c
index 6758f6a..0fe83e5 100644 (file)
@@ -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,