]> git.proxmox.com Git - mirror_zfs-debian.git/commitdiff
Add snapshot-mount.patch
authorDarik Horn <dajhorn@vanadac.com>
Fri, 6 May 2011 00:47:07 +0000 (19:47 -0500)
committerDarik Horn <dajhorn@vanadac.com>
Fri, 6 May 2011 00:47:07 +0000 (19:47 -0500)
The upstream zfs-0.6.0-rc4 tag was pushed back to include commit
3613204cd7e3ab1ae658e31dac875e58827a6655, which fixes a regression
that prevents mounting snapshots.

debian/patches/series
debian/patches/snapshot-mount.patch [new file with mode: 0644]

index 79424fb2084c3a2cb6927ebbf7cc6860692d4e68..19bb45a388d13c93285a38d02b0a017c21a790e8 100644 (file)
@@ -4,3 +4,4 @@ disable-dist-dracut.patch
 disable-dist-scripts.patch
 lintian-COPYING.patch
 lintian-ltmain.patch
+snapshot-mount.patch
diff --git a/debian/patches/snapshot-mount.patch b/debian/patches/snapshot-mount.patch
new file mode 100644 (file)
index 0000000..bdc643b
--- /dev/null
@@ -0,0 +1,40 @@
+commit 3613204cd7e3ab1ae658e31dac875e58827a6655
+Author: Brian Behlendorf <behlendorf1@llnl.gov>
+Date:   Thu May 5 09:40:57 2011 -0700
+
+    Allow mounting of read-only snapshots
+    
+    With the addition of the mount helper we accidentally regressed
+    the ability to manually mount snapshots.  This commit updates
+    the mount helper to expect the possibility of a ZFS_TYPE_SNAPSHOT.
+    All snapshot will be automatically treated as 'legacy' type mounts
+    so they can be mounted manually.
+
+diff --git a/cmd/mount_zfs/mount_zfs.c b/cmd/mount_zfs/mount_zfs.c
+index c38ba51..e97b2b8 100644
+--- a/cmd/mount_zfs/mount_zfs.c
++++ b/cmd/mount_zfs/mount_zfs.c
+@@ -428,15 +428,20 @@ main(int argc, char **argv)
+               return (MOUNT_SYSERR);
+       /* try to open the dataset to access the mount point */
+-      if ((zhp = zfs_open(g_zfs, dataset, ZFS_TYPE_FILESYSTEM)) == NULL) {
++      if ((zhp = zfs_open(g_zfs, dataset,
++          ZFS_TYPE_FILESYSTEM | ZFS_TYPE_SNAPSHOT)) == NULL) {
+               (void) fprintf(stderr, gettext("filesystem '%s' cannot be "
+                   "mounted, unable to open the dataset\n"), dataset);
+               libzfs_fini(g_zfs);
+               return (MOUNT_USAGE);
+       }
+-      (void) zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, legacy,
+-          sizeof (legacy), NULL, NULL, 0, B_FALSE);
++      /* treat all snapshots as legacy mount points */
++      if (zfs_get_type(zhp) == ZFS_TYPE_SNAPSHOT)
++              (void) strlcpy(legacy, ZFS_MOUNTPOINT_LEGACY, ZFS_MAXPROPLEN);
++      else
++              (void) zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, legacy,
++                  sizeof (legacy), NULL, NULL, 0, B_FALSE);
+       zfs_close(zhp);
+       libzfs_fini(g_zfs);