From owner-svn-src-vendor@FreeBSD.ORG Tue Jun 11 18:35:15 2013 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 60AC453C; Tue, 11 Jun 2013 18:35:15 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 43281136F; Tue, 11 Jun 2013 18:35:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5BIZFZv044654; Tue, 11 Jun 2013 18:35:15 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5BIZEXJ044651; Tue, 11 Jun 2013 18:35:14 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201306111835.r5BIZEXJ044651@svn.freebsd.org> From: Xin LI Date: Tue, 11 Jun 2013 18:35:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r251622 - in vendor-sys/illumos/dist/uts/common/fs/zfs: . sys X-SVN-Group: vendor-sys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jun 2013 18:35:15 -0000 Author: delphij Date: Tue Jun 11 18:35:14 2013 New Revision: 251622 URL: http://svnweb.freebsd.org/changeset/base/251622 Log: Update vendor-sys/illumos/dist to illumos-gate 14048:ce96ca723606 Illumos ZFS issues: 3744 zfs shouldn't ignore errors unmounting snapshots Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_userhold.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_ioctl.h vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_userhold.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_userhold.c Tue Jun 11 18:34:08 2013 (r251621) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_userhold.c Tue Jun 11 18:35:14 2013 (r251622) @@ -433,7 +433,7 @@ dsl_dataset_user_release_tmp(dsl_pool_t dsl_dataset_name(ds, name); dsl_dataset_rele(ds, FTAG); dsl_pool_config_exit(dp, FTAG); - zfs_unmount_snap(name); + (void) zfs_unmount_snap(name); } else { dsl_pool_config_exit(dp, FTAG); } Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_ioctl.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_ioctl.h Tue Jun 11 18:34:08 2013 (r251621) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_ioctl.h Tue Jun 11 18:35:14 2013 (r251622) @@ -344,7 +344,7 @@ extern int zfs_secpolicy_rename_perms(co const char *to, cred_t *cr); extern int zfs_secpolicy_destroy_perms(const char *name, cred_t *cr); extern int zfs_busy(void); -extern void zfs_unmount_snap(const char *); +extern int zfs_unmount_snap(const char *); extern void zfs_destroy_unmount_origin(const char *); /* Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c Tue Jun 11 18:34:08 2013 (r251621) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c Tue Jun 11 18:35:14 2013 (r251622) @@ -3356,41 +3356,44 @@ zfs_ioc_log_history(const char *unused, * * This function is best-effort. Callers must deal gracefully if it * remains mounted (or is remounted after this call). + * + * Returns 0 if the argument is not a snapshot, or it is not currently a + * filesystem, or we were able to unmount it. Returns error code otherwise. */ -void +int zfs_unmount_snap(const char *snapname) { vfs_t *vfsp; zfsvfs_t *zfsvfs; + int err; if (strchr(snapname, '@') == NULL) - return; + return (0); vfsp = zfs_get_vfs(snapname); if (vfsp == NULL) - return; + return (0); zfsvfs = vfsp->vfs_data; ASSERT(!dsl_pool_config_held(dmu_objset_pool(zfsvfs->z_os))); - if (vn_vfswlock(vfsp->vfs_vnodecovered) != 0) { - VFS_RELE(vfsp); - return; - } + err = vn_vfswlock(vfsp->vfs_vnodecovered); VFS_RELE(vfsp); + if (err != 0) + return (SET_ERROR(err)); /* * Always force the unmount for snapshots. */ (void) dounmount(vfsp, MS_FORCE, kcred); + return (0); } /* ARGSUSED */ static int zfs_unmount_snap_cb(const char *snapname, void *arg) { - zfs_unmount_snap(snapname); - return (0); + return (zfs_unmount_snap(snapname)); } /* @@ -3413,7 +3416,7 @@ zfs_destroy_unmount_origin(const char *f char originname[MAXNAMELEN]; dsl_dataset_name(ds->ds_prev, originname); dmu_objset_rele(os, FTAG); - zfs_unmount_snap(originname); + (void) zfs_unmount_snap(originname); } else { dmu_objset_rele(os, FTAG); } @@ -3431,7 +3434,7 @@ zfs_destroy_unmount_origin(const char *f static int zfs_ioc_destroy_snaps(const char *poolname, nvlist_t *innvl, nvlist_t *outnvl) { - int poollen; + int error, poollen; nvlist_t *snaps; nvpair_t *pair; boolean_t defer; @@ -3452,7 +3455,9 @@ zfs_ioc_destroy_snaps(const char *poolna (name[poollen] != '/' && name[poollen] != '@')) return (SET_ERROR(EXDEV)); - zfs_unmount_snap(name); + error = zfs_unmount_snap(name); + if (error != 0) + return (error); } return (dsl_destroy_snapshots_nvl(snaps, defer, outnvl)); @@ -3470,8 +3475,12 @@ static int zfs_ioc_destroy(zfs_cmd_t *zc) { int err; - if (strchr(zc->zc_name, '@') && zc->zc_objset_type == DMU_OST_ZFS) - zfs_unmount_snap(zc->zc_name); + + if (zc->zc_objset_type == DMU_OST_ZFS) { + err = zfs_unmount_snap(zc->zc_name); + if (err != 0) + return (err); + } if (strchr(zc->zc_name, '@')) err = dsl_destroy_snapshot(zc->zc_name, zc->zc_defer_destroy); @@ -3517,8 +3526,7 @@ recursive_unmount(const char *fsname, vo char fullname[MAXNAMELEN]; (void) snprintf(fullname, sizeof (fullname), "%s@%s", fsname, snapname); - zfs_unmount_snap(fullname); - return (0); + return (zfs_unmount_snap(fullname)); } /* @@ -4977,14 +4985,18 @@ static int zfs_ioc_release(const char *pool, nvlist_t *holds, nvlist_t *errlist) { nvpair_t *pair; + int err; /* * The release may cause the snapshot to be destroyed; make sure it * is not mounted. */ for (pair = nvlist_next_nvpair(holds, NULL); pair != NULL; - pair = nvlist_next_nvpair(holds, pair)) - zfs_unmount_snap(nvpair_name(pair)); + pair = nvlist_next_nvpair(holds, pair)) { + err = zfs_unmount_snap(nvpair_name(pair)); + if (err != 0) + return (err); + } return (dsl_dataset_user_release(holds, errlist)); }