From owner-svn-src-stable@freebsd.org Thu Mar 15 11:06:05 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E95CDF43201; Thu, 15 Mar 2018 11:06:04 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9E2187B1B9; Thu, 15 Mar 2018 11:06:04 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 98CAA154F0; Thu, 15 Mar 2018 11:06:04 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2FB64IY010542; Thu, 15 Mar 2018 11:06:04 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2FB64kS010538; Thu, 15 Mar 2018 11:06:04 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201803151106.w2FB64kS010538@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 15 Mar 2018 11:06:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r330990 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 330990 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Mar 2018 11:06:05 -0000 Author: avg Date: Thu Mar 15 11:06:04 2018 New Revision: 330990 URL: https://svnweb.freebsd.org/changeset/base/330990 Log: MFC r329823: another rework of getzfsvfs / getzfsvfs_impl code Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_get.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h Thu Mar 15 11:04:30 2018 (r330989) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h Thu Mar 15 11:06:04 2018 (r330990) @@ -426,7 +426,11 @@ extern int zfs_secpolicy_destroy_perms(const char *, c extern int zfs_busy(void); extern void zfs_unmount_snap(const char *); extern void zfs_destroy_unmount_origin(const char *); +#ifdef illumos extern int getzfsvfs_impl(struct objset *, struct zfsvfs **); +#else +extern int getzfsvfs_impl(struct objset *, vfs_t **); +#endif extern int getzfsvfs(const char *, struct zfsvfs **); /* Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_get.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_get.c Thu Mar 15 11:04:30 2018 (r330989) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_get.c Thu Mar 15 11:06:04 2018 (r330990) @@ -226,7 +226,9 @@ get_temporary_prop(dsl_dataset_t *ds, zfs_prop_t zfs_p return (0); #else int error; +#ifdef illumos zfsvfs_t *zfvp; +#endif vfs_t *vfsp; objset_t *os; uint64_t tmp = *val; @@ -235,12 +237,12 @@ get_temporary_prop(dsl_dataset_t *ds, zfs_prop_t zfs_p if (error != 0) return (error); - error = getzfsvfs_impl(os, &zfvp); + error = getzfsvfs_impl(os, &vfsp); if (error != 0) return (error); - +#ifdef illumos vfsp = zfvp->z_vfs; - +#endif switch (zfs_prop) { case ZFS_PROP_ATIME: if (vfs_optionisset(vfsp, MNTOPT_NOATIME, NULL)) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Thu Mar 15 11:04:30 2018 (r330989) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Thu Mar 15 11:06:04 2018 (r330990) @@ -1438,9 +1438,9 @@ put_nvlist(zfs_cmd_t *zc, nvlist_t *nvl) } int -getzfsvfs_impl(objset_t *os, zfsvfs_t **zfvp) +getzfsvfs_impl(objset_t *os, vfs_t **vfsp) { - vfs_t *vfsp; + zfsvfs_t *zfvp; int error = 0; if (dmu_objset_type(os) != DMU_OST_ZFS) { @@ -1448,9 +1448,10 @@ getzfsvfs_impl(objset_t *os, zfsvfs_t **zfvp) } mutex_enter(&os->os_user_ptr_lock); - *zfvp = dmu_objset_get_user(os); - if (*zfvp) { - vfs_ref((*zfvp)->z_vfs); + zfvp = dmu_objset_get_user(os); + if (zfvp) { + *vfsp = zfvp->z_vfs; + vfs_ref(zfvp->z_vfs); } else { error = SET_ERROR(ESRCH); } @@ -1458,57 +1459,31 @@ getzfsvfs_impl(objset_t *os, zfsvfs_t **zfvp) return (error); } -#ifdef illumos int getzfsvfs(const char *dsname, zfsvfs_t **zfvp) { objset_t *os; + vfs_t *vfsp; int error; error = dmu_objset_hold(dsname, FTAG, &os); if (error != 0) return (error); - - error = getzfsvfs_impl(os, zfvp); + error = getzfsvfs_impl(os, &vfsp); dmu_objset_rele(os, FTAG); - return (error); -} - -#else - -static int -getzfsvfs_ref(const char *dsname, zfsvfs_t **zfvp) -{ - objset_t *os; - int error; - - error = dmu_objset_hold(dsname, FTAG, &os); if (error != 0) return (error); - error = getzfsvfs_impl(os, zfvp); - dmu_objset_rele(os, FTAG); - return (error); -} - -int -getzfsvfs(const char *dsname, zfsvfs_t **zfvp) -{ - objset_t *os; - int error; - - error = getzfsvfs_ref(dsname, zfvp); - if (error != 0) - return (error); - error = vfs_busy((*zfvp)->z_vfs, 0); - vfs_rel((*zfvp)->z_vfs); + error = vfs_busy(vfsp, 0); + vfs_rel(vfsp); if (error != 0) { *zfvp = NULL; error = SET_ERROR(ESRCH); + } else { + *zfvp = vfsp->vfs_data; } return (error); } -#endif /* * Find a zfsvfs_t for a mounted filesystem, or create our own, in which @@ -3572,7 +3547,7 @@ zfs_unmount_snap(const char *snapname) if (strchr(snapname, '@') == NULL) return; - int err = getzfsvfs_ref(snapname, &zfsvfs); + int err = getzfsvfs(snapname, &zfsvfs); if (err != 0) { ASSERT3P(zfsvfs, ==, NULL); return; @@ -3594,6 +3569,8 @@ zfs_unmount_snap(const char *snapname) #ifdef illumos (void) dounmount(vfsp, MS_FORCE, kcred); #else + vfs_ref(vfsp); + vfs_unbusy(vfsp); (void) dounmount(vfsp, MS_FORCE, curthread); #endif }