Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Jun 2015 10:41:24 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r284301 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Message-ID:  <201506121041.t5CAfOr3012077@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avg
Date: Fri Jun 12 10:41:24 2015
New Revision: 284301
URL: https://svnweb.freebsd.org/changeset/base/284301

Log:
  MFV r284040: check that datasets are snapshots
  
  5946 zfs_ioc_space_snaps must check that firstsnap and lastsnap refer to snapshots
  5945 zfs_ioc_send_space must ensure that fromsnap refers to a snapshot
  Reviewed by: Steven Hartland <killing@multiplay.co.uk>
  Reviewed by: Matthew Ahrens <mahrens@delphix.com>
  Approved by: Gordon Ross <gordon.ross@nexenta.com>
  
  illumos/illumos-gate@24218bebb460e4015fac2c9f2cec1902eddbcd7b
  
  Note that the upstream commit is modified during MFV: in the upstream
  the check is done by inspecting ds_is_snapshot field while in FreeBSD
  we call dsl_dataset_is_snapshot().
  This is because illumos/illumos-gate@bc9014e6a81272073b9854d9f65dd59e18d18c35
  (r277428 in vendor-sys/illumos) is not MFV-ed yet.
  
  MFC after:	10 days

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c	Fri Jun 12 10:25:35 2015	(r284300)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c	Fri Jun 12 10:41:24 2015	(r284301)
@@ -855,6 +855,10 @@ dmu_send_estimate(dsl_dataset_t *ds, dsl
 	if (!dsl_dataset_is_snapshot(ds))
 		return (SET_ERROR(EINVAL));
 
+	/* fromsnap, if provided, must be a snapshot */
+	if (fromds != NULL && !dsl_dataset_is_snapshot(fromds))
+		return (SET_ERROR(EINVAL));
+
 	/*
 	 * fromsnap must be an earlier snapshot from the same fs as tosnap,
 	 * or the origin's fs.

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c	Fri Jun 12 10:25:35 2015	(r284300)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c	Fri Jun 12 10:41:24 2015	(r284301)
@@ -5362,11 +5362,19 @@ zfs_ioc_space_snaps(const char *lastsnap
 		return (error);
 
 	error = dsl_dataset_hold(dp, lastsnap, FTAG, &new);
+	if (error == 0 && !dsl_dataset_is_snapshot(new)) {
+		dsl_dataset_rele(new, FTAG);
+		error = SET_ERROR(EINVAL);
+	}
 	if (error != 0) {
 		dsl_pool_rele(dp, FTAG);
 		return (error);
 	}
 	error = dsl_dataset_hold(dp, firstsnap, FTAG, &old);
+	if (error == 0 && !dsl_dataset_is_snapshot(old)) {
+		dsl_dataset_rele(old, FTAG);
+		error = SET_ERROR(EINVAL);
+	}
 	if (error != 0) {
 		dsl_dataset_rele(new, FTAG);
 		dsl_pool_rele(dp, FTAG);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201506121041.t5CAfOr3012077>