--- /dev/null
+--- omv/filesystemmgmt.inc.org 2014-09-18 09:39:59.956015279 +0200
++++ omv/filesystemmgmt.inc 2014-09-18 15:36:01.981792621 +0200
+@@ -83,7 +83,7 @@
+ if (!in_array($objectv['type'], array("ext", "ext2", "ext3",
+ "ext4", "xfs", "jfs", "iso9660", "msdos", "ntfs", "udf",
+ "umsdos", "vfat", "ufs", "reiserfs", "btrfs", "hfsplus",
+- "zfs")))
++ "zfs", "zfs_member")))
+ continue;
+ // Use the devicefile to get the filesystem details because vfat
+ // filesystems do not have a valid UUID. Any idea why?
+@@ -117,24 +117,46 @@
+ // exists, then check if it is referenced by any other object,
+ // e.g. by a shared folder configuration object.
+ if (FALSE !== ($meObject = OMVRpc::exec("FsTab", "getByFsName",
+- array("id" => $fs->getDeviceFile()), $context))) {
+- $xpath = sprintf("//mntentref[contains(.,'%s')]",
+- $meObject['uuid']);
+- if (TRUE === $xmlConfig->exists($xpath))
+- $object['_used'] = TRUE;
+- }
++ array("id" => $fs->getDeviceFile()), $context))) {
++ if (strcmp($object['type'], "zfs_member") === 0) {
++ //This is a zfs filesystem which uses another format for UUID.
++ //The UUID of the filesystem is stored in the fsname property.
++ $xpath = "//system/fstab/mntent[fsname='" . $object['uuid'] . "']";
++ $zfs_obj = $xmlConfig->get($xpath);
++ if (!is_null($zfs_obj)) {
++ $xpath = sprintf("//mntentref[contains(.,'%s')]",$zfs_obj['uuid']);
++ if (TRUE === $xmlConfig->exists($xpath)) {
++ $object['_used'] = TRUE;
++ }
++ }
++ } else {
++ $xpath = sprintf("//mntentref[contains(.,'%s')]",
++ $meObject['uuid']);
++ if (TRUE === $xmlConfig->exists($xpath))
++ $object['_used'] = TRUE;
++ }
++ }
+ // Mark the device where the operating system is installed on
+ // as used and read-only.
+ if (OMVSystem::isRootDeviceFile($object['devicefile'])) {
+ $object['_used'] = TRUE;
+ $object['_readonly'] = TRUE;
+ }
++ //zfs filesystems are not detected by the isMounted method, but can be
++ //probed via /proc/mounts
++ $zfs_mounted = FALSE;
++ if (strcmp($object['type'], "zfs_member") === 0) {
++ $cmd = "cat /proc/mounts | grep '^" . $object['label'] . "[[:space:]]' 2>&1";
++ $this->exec($cmd, $output, $result);
++ if (count($output) === 1)
++ $zfs_mounted = TRUE;
++ }
+ // If the filesystem is mounted then try to get more
+ // informations about it. Note,it is not possible to get
+ // details from unmounted filesystems, because on most kinds
+ // of systems doing so requires very nonportable intimate
+ // knowledge of filesystem structures. See man (1) df.
+- if (TRUE === $fs->isMounted()) {
++ if ((TRUE === $fs->isMounted()) || ($zfs_mounted)) {
+ $object['mounted'] = TRUE;
+ // Get some more filesystem details if possible.
+ if (FALSE !== ($fsStats = $fs->getStatistics())) {
+@@ -183,8 +205,8 @@
+ "includeRoot":{"type":"boolean","optional":true}
+ }
+ }');
+- // Get list of mount points, except bind mounts.
+- $xpath = "//system/fstab/mntent[not(contains(opts,'bind'))]";
++ // Get list of mount points, except bind mounts and zfs mountpoints
++ $xpath = "//system/fstab/mntent[not(contains(opts,'bind') or contains(type,'zfs'))]";
+ $objects = $xmlConfig->getList($xpath);
+ if (is_null($objects)) {
+ throw new OMVException(OMVErrorMsg::E_CONFIG_GET_OBJECT_FAILED,
+@@ -344,7 +366,7 @@
+ // exist anymore. This is necessary to be able remove invalid mount
+ // point configuration objects. Mark such filesystem as missing.
+ $xpath = "//system/fstab/mntent[not(contains(opts,'bind') or ".
+- "contains(opts,'loop'))]";
++ "contains(opts,'loop') or contains(type,'zfs'))]";
+ $mntents = $xmlConfig->getList($xpath);
+ if(is_null($mntents)) {
+ throw new OMVException(OMVErrorMsg::E_CONFIG_GET_OBJECT_FAILED,