Mercurial > illumos > illumos-gate
comparison usr/src/uts/common/fs/zfs/zfs_vfsops.c @ 13980:d7059eb1884c
3598 want to dtrace when errors are generated in zfs
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Approved by: Garrett D'Amore <garrett@damore.org>
author | Matthew Ahrens <mahrens@delphix.com> |
---|---|
date | Fri, 08 Mar 2013 10:41:28 -0800 |
parents | 4972ab336f54 |
children | 6a5a2f4a47db |
comparison
equal
deleted
inserted
replaced
13979:b01a4832cdf9 | 13980:d7059eb1884c |
---|---|
18 * | 18 * |
19 * CDDL HEADER END | 19 * CDDL HEADER END |
20 */ | 20 */ |
21 /* | 21 /* |
22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. | 22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. |
23 * Copyright (c) 2012 by Delphix. All rights reserved. | 23 * Copyright (c) 2013 by Delphix. All rights reserved. |
24 */ | 24 */ |
25 | 25 |
26 /* Portions Copyright 2010 Robert Milkowski */ | 26 /* Portions Copyright 2010 Robert Milkowski */ |
27 | 27 |
28 #include <sys/types.h> | 28 #include <sys/types.h> |
598 { | 598 { |
599 /* | 599 /* |
600 * Is it a valid type of object to track? | 600 * Is it a valid type of object to track? |
601 */ | 601 */ |
602 if (bonustype != DMU_OT_ZNODE && bonustype != DMU_OT_SA) | 602 if (bonustype != DMU_OT_ZNODE && bonustype != DMU_OT_SA) |
603 return (ENOENT); | 603 return (SET_ERROR(ENOENT)); |
604 | 604 |
605 /* | 605 /* |
606 * If we have a NULL data pointer | 606 * If we have a NULL data pointer |
607 * then assume the id's aren't changing and | 607 * then assume the id's aren't changing and |
608 * return EEXIST to the dmu to let it know to | 608 * return EEXIST to the dmu to let it know to |
609 * use the same ids | 609 * use the same ids |
610 */ | 610 */ |
611 if (data == NULL) | 611 if (data == NULL) |
612 return (EEXIST); | 612 return (SET_ERROR(EEXIST)); |
613 | 613 |
614 if (bonustype == DMU_OT_ZNODE) { | 614 if (bonustype == DMU_OT_ZNODE) { |
615 znode_phys_t *znp = data; | 615 znode_phys_t *znp = data; |
616 *userp = znp->zp_uid; | 616 *userp = znp->zp_uid; |
617 *groupp = znp->zp_gid; | 617 *groupp = znp->zp_gid; |
697 zap_attribute_t za; | 697 zap_attribute_t za; |
698 zfs_useracct_t *buf = vbuf; | 698 zfs_useracct_t *buf = vbuf; |
699 uint64_t obj; | 699 uint64_t obj; |
700 | 700 |
701 if (!dmu_objset_userspace_present(zfsvfs->z_os)) | 701 if (!dmu_objset_userspace_present(zfsvfs->z_os)) |
702 return (ENOTSUP); | 702 return (SET_ERROR(ENOTSUP)); |
703 | 703 |
704 obj = zfs_userquota_prop_to_obj(zfsvfs, type); | 704 obj = zfs_userquota_prop_to_obj(zfsvfs, type); |
705 if (obj == 0) { | 705 if (obj == 0) { |
706 *bufsizep = 0; | 706 *bufsizep = 0; |
707 return (0); | 707 return (0); |
741 int domainid = 0; | 741 int domainid = 0; |
742 | 742 |
743 if (domain && domain[0]) { | 743 if (domain && domain[0]) { |
744 domainid = zfs_fuid_find_by_domain(zfsvfs, domain, NULL, addok); | 744 domainid = zfs_fuid_find_by_domain(zfsvfs, domain, NULL, addok); |
745 if (domainid == -1) | 745 if (domainid == -1) |
746 return (ENOENT); | 746 return (SET_ERROR(ENOENT)); |
747 } | 747 } |
748 fuid = FUID_ENCODE(domainid, rid); | 748 fuid = FUID_ENCODE(domainid, rid); |
749 (void) sprintf(buf, "%llx", (longlong_t)fuid); | 749 (void) sprintf(buf, "%llx", (longlong_t)fuid); |
750 return (0); | 750 return (0); |
751 } | 751 } |
759 uint64_t obj; | 759 uint64_t obj; |
760 | 760 |
761 *valp = 0; | 761 *valp = 0; |
762 | 762 |
763 if (!dmu_objset_userspace_present(zfsvfs->z_os)) | 763 if (!dmu_objset_userspace_present(zfsvfs->z_os)) |
764 return (ENOTSUP); | 764 return (SET_ERROR(ENOTSUP)); |
765 | 765 |
766 obj = zfs_userquota_prop_to_obj(zfsvfs, type); | 766 obj = zfs_userquota_prop_to_obj(zfsvfs, type); |
767 if (obj == 0) | 767 if (obj == 0) |
768 return (0); | 768 return (0); |
769 | 769 |
786 dmu_tx_t *tx; | 786 dmu_tx_t *tx; |
787 uint64_t *objp; | 787 uint64_t *objp; |
788 boolean_t fuid_dirtied; | 788 boolean_t fuid_dirtied; |
789 | 789 |
790 if (type != ZFS_PROP_USERQUOTA && type != ZFS_PROP_GROUPQUOTA) | 790 if (type != ZFS_PROP_USERQUOTA && type != ZFS_PROP_GROUPQUOTA) |
791 return (EINVAL); | 791 return (SET_ERROR(EINVAL)); |
792 | 792 |
793 if (zfsvfs->z_version < ZPL_VERSION_USERSPACE) | 793 if (zfsvfs->z_version < ZPL_VERSION_USERSPACE) |
794 return (ENOTSUP); | 794 return (SET_ERROR(ENOTSUP)); |
795 | 795 |
796 objp = (type == ZFS_PROP_USERQUOTA) ? &zfsvfs->z_userquota_obj : | 796 objp = (type == ZFS_PROP_USERQUOTA) ? &zfsvfs->z_userquota_obj : |
797 &zfsvfs->z_groupquota_obj; | 797 &zfsvfs->z_groupquota_obj; |
798 | 798 |
799 err = id_to_fuidstr(zfsvfs, domain, rid, buf, B_TRUE); | 799 err = id_to_fuidstr(zfsvfs, domain, rid, buf, B_TRUE); |
917 zfs_zpl_version_map(spa_version(dmu_objset_spa(os)))) { | 917 zfs_zpl_version_map(spa_version(dmu_objset_spa(os)))) { |
918 (void) printf("Can't mount a version %lld file system " | 918 (void) printf("Can't mount a version %lld file system " |
919 "on a version %lld pool\n. Pool must be upgraded to mount " | 919 "on a version %lld pool\n. Pool must be upgraded to mount " |
920 "this file system.", (u_longlong_t)zfsvfs->z_version, | 920 "this file system.", (u_longlong_t)zfsvfs->z_version, |
921 (u_longlong_t)spa_version(dmu_objset_spa(os))); | 921 (u_longlong_t)spa_version(dmu_objset_spa(os))); |
922 error = ENOTSUP; | 922 error = SET_ERROR(ENOTSUP); |
923 goto out; | 923 goto out; |
924 } | 924 } |
925 if ((error = zfs_get_zplprop(os, ZFS_PROP_NORMALIZE, &zval)) != 0) | 925 if ((error = zfs_get_zplprop(os, ZFS_PROP_NORMALIZE, &zval)) != 0) |
926 goto out; | 926 goto out; |
927 zfsvfs->z_norm = (int)zval; | 927 zfsvfs->z_norm = (int)zval; |
1170 /* Initialize the generic filesystem structure. */ | 1170 /* Initialize the generic filesystem structure. */ |
1171 vfsp->vfs_bcount = 0; | 1171 vfsp->vfs_bcount = 0; |
1172 vfsp->vfs_data = NULL; | 1172 vfsp->vfs_data = NULL; |
1173 | 1173 |
1174 if (zfs_create_unique_device(&mount_dev) == -1) { | 1174 if (zfs_create_unique_device(&mount_dev) == -1) { |
1175 error = ENODEV; | 1175 error = SET_ERROR(ENODEV); |
1176 goto out; | 1176 goto out; |
1177 } | 1177 } |
1178 ASSERT(vfs_devismounted(mount_dev) == 0); | 1178 ASSERT(vfs_devismounted(mount_dev) == 0); |
1179 | 1179 |
1180 if (error = dsl_prop_get_integer(osname, "recordsize", &recordsize, | 1180 if (error = dsl_prop_get_integer(osname, "recordsize", &recordsize, |
1300 { | 1300 { |
1301 uint64_t num = 0; | 1301 uint64_t num = 0; |
1302 | 1302 |
1303 while (*str) { | 1303 while (*str) { |
1304 if (*str < '0' || *str > '9') | 1304 if (*str < '0' || *str > '9') |
1305 return (EINVAL); | 1305 return (SET_ERROR(EINVAL)); |
1306 | 1306 |
1307 num = num*10 + *str++ - '0'; | 1307 num = num*10 + *str++ - '0'; |
1308 } | 1308 } |
1309 | 1309 |
1310 *objnum = num; | 1310 *objnum = num; |
1322 char *slashp; | 1322 char *slashp; |
1323 uint64_t objnum; | 1323 uint64_t objnum; |
1324 int error; | 1324 int error; |
1325 | 1325 |
1326 if (*bpath == 0 || *bpath == '/') | 1326 if (*bpath == 0 || *bpath == '/') |
1327 return (EINVAL); | 1327 return (SET_ERROR(EINVAL)); |
1328 | 1328 |
1329 (void) strcpy(outpath, bpath); | 1329 (void) strcpy(outpath, bpath); |
1330 | 1330 |
1331 slashp = strchr(bpath, '/'); | 1331 slashp = strchr(bpath, '/'); |
1332 | 1332 |
1367 /* must be readonly */ | 1367 /* must be readonly */ |
1368 uint64_t rdonly; | 1368 uint64_t rdonly; |
1369 | 1369 |
1370 if (dsl_prop_get_integer(dsname, | 1370 if (dsl_prop_get_integer(dsname, |
1371 zfs_prop_to_name(ZFS_PROP_READONLY), &rdonly, NULL)) | 1371 zfs_prop_to_name(ZFS_PROP_READONLY), &rdonly, NULL)) |
1372 return (EACCES); | 1372 return (SET_ERROR(EACCES)); |
1373 return (rdonly ? 0 : EACCES); | 1373 return (rdonly ? 0 : EACCES); |
1374 } | 1374 } |
1375 return (EACCES); | 1375 return (SET_ERROR(EACCES)); |
1376 } | 1376 } |
1377 | 1377 |
1378 /* | 1378 /* |
1379 * zfs_mount_label_policy: | 1379 * zfs_mount_label_policy: |
1380 * Determine whether the mount is allowed according to MAC check. | 1380 * Determine whether the mount is allowed according to MAC check. |
1402 * Start by getting the dataset label if it exists. | 1402 * Start by getting the dataset label if it exists. |
1403 */ | 1403 */ |
1404 error = dsl_prop_get(osname, zfs_prop_to_name(ZFS_PROP_MLSLABEL), | 1404 error = dsl_prop_get(osname, zfs_prop_to_name(ZFS_PROP_MLSLABEL), |
1405 1, sizeof (ds_hexsl), &ds_hexsl, NULL); | 1405 1, sizeof (ds_hexsl), &ds_hexsl, NULL); |
1406 if (error) | 1406 if (error) |
1407 return (EACCES); | 1407 return (SET_ERROR(EACCES)); |
1408 | 1408 |
1409 /* | 1409 /* |
1410 * If labeling is NOT enabled, then disallow the mount of datasets | 1410 * If labeling is NOT enabled, then disallow the mount of datasets |
1411 * which have a non-default label already. No other label checks | 1411 * which have a non-default label already. No other label checks |
1412 * are needed. | 1412 * are needed. |
1413 */ | 1413 */ |
1414 if (!is_system_labeled()) { | 1414 if (!is_system_labeled()) { |
1415 if (strcasecmp(ds_hexsl, ZFS_MLSLABEL_DEFAULT) == 0) | 1415 if (strcasecmp(ds_hexsl, ZFS_MLSLABEL_DEFAULT) == 0) |
1416 return (0); | 1416 return (0); |
1417 return (EACCES); | 1417 return (SET_ERROR(EACCES)); |
1418 } | 1418 } |
1419 | 1419 |
1420 /* | 1420 /* |
1421 * Get the label of the mountpoint. If mounting into the global | 1421 * Get the label of the mountpoint. If mounting into the global |
1422 * zone (i.e. mountpoint is not within an active zone and the | 1422 * zone (i.e. mountpoint is not within an active zone and the |
1429 | 1429 |
1430 zone_rele(mntzone); | 1430 zone_rele(mntzone); |
1431 | 1431 |
1432 if (dsl_prop_get_integer(osname, | 1432 if (dsl_prop_get_integer(osname, |
1433 zfs_prop_to_name(ZFS_PROP_ZONED), &zoned, NULL)) | 1433 zfs_prop_to_name(ZFS_PROP_ZONED), &zoned, NULL)) |
1434 return (EACCES); | 1434 return (SET_ERROR(EACCES)); |
1435 if (!zoned) | 1435 if (!zoned) |
1436 return (zfs_check_global_label(osname, ds_hexsl)); | 1436 return (zfs_check_global_label(osname, ds_hexsl)); |
1437 else | 1437 else |
1438 /* | 1438 /* |
1439 * This is the case of a zone dataset being mounted | 1439 * This is the case of a zone dataset being mounted |
1499 * boot property "zfs-bootfs" with a format of | 1499 * boot property "zfs-bootfs" with a format of |
1500 * "poolname/root-dataset-objnum". | 1500 * "poolname/root-dataset-objnum". |
1501 */ | 1501 */ |
1502 if (why == ROOT_INIT) { | 1502 if (why == ROOT_INIT) { |
1503 if (zfsrootdone++) | 1503 if (zfsrootdone++) |
1504 return (EBUSY); | 1504 return (SET_ERROR(EBUSY)); |
1505 /* | 1505 /* |
1506 * the process of doing a spa_load will require the | 1506 * the process of doing a spa_load will require the |
1507 * clock to be set before we could (for example) do | 1507 * clock to be set before we could (for example) do |
1508 * something better by looking at the timestamp on | 1508 * something better by looking at the timestamp on |
1509 * an uberblock, so just set it to -1. | 1509 * an uberblock, so just set it to -1. |
1511 clkset(-1); | 1511 clkset(-1); |
1512 | 1512 |
1513 if ((zfs_bootfs = spa_get_bootprop("zfs-bootfs")) == NULL) { | 1513 if ((zfs_bootfs = spa_get_bootprop("zfs-bootfs")) == NULL) { |
1514 cmn_err(CE_NOTE, "spa_get_bootfs: can not get " | 1514 cmn_err(CE_NOTE, "spa_get_bootfs: can not get " |
1515 "bootfs name"); | 1515 "bootfs name"); |
1516 return (EINVAL); | 1516 return (SET_ERROR(EINVAL)); |
1517 } | 1517 } |
1518 zfs_devid = spa_get_bootprop("diskdevid"); | 1518 zfs_devid = spa_get_bootprop("diskdevid"); |
1519 error = spa_import_rootpool(rootfs.bo_name, zfs_devid); | 1519 error = spa_import_rootpool(rootfs.bo_name, zfs_devid); |
1520 if (zfs_devid) | 1520 if (zfs_devid) |
1521 spa_free_bootprop(zfs_devid); | 1521 spa_free_bootprop(zfs_devid); |
1580 | 1580 |
1581 /* | 1581 /* |
1582 * if "why" is equal to anything else other than ROOT_INIT, | 1582 * if "why" is equal to anything else other than ROOT_INIT, |
1583 * ROOT_REMOUNT, or ROOT_UNMOUNT, we do not support it. | 1583 * ROOT_REMOUNT, or ROOT_UNMOUNT, we do not support it. |
1584 */ | 1584 */ |
1585 return (ENOTSUP); | 1585 return (SET_ERROR(ENOTSUP)); |
1586 } | 1586 } |
1587 | 1587 |
1588 /*ARGSUSED*/ | 1588 /*ARGSUSED*/ |
1589 static int | 1589 static int |
1590 zfs_mount(vfs_t *vfsp, vnode_t *mvp, struct mounta *uap, cred_t *cr) | 1590 zfs_mount(vfs_t *vfsp, vnode_t *mvp, struct mounta *uap, cred_t *cr) |
1595 uio_seg_t fromspace = (uap->flags & MS_SYSSPACE) ? | 1595 uio_seg_t fromspace = (uap->flags & MS_SYSSPACE) ? |
1596 UIO_SYSSPACE : UIO_USERSPACE; | 1596 UIO_SYSSPACE : UIO_USERSPACE; |
1597 int canwrite; | 1597 int canwrite; |
1598 | 1598 |
1599 if (mvp->v_type != VDIR) | 1599 if (mvp->v_type != VDIR) |
1600 return (ENOTDIR); | 1600 return (SET_ERROR(ENOTDIR)); |
1601 | 1601 |
1602 mutex_enter(&mvp->v_lock); | 1602 mutex_enter(&mvp->v_lock); |
1603 if ((uap->flags & MS_REMOUNT) == 0 && | 1603 if ((uap->flags & MS_REMOUNT) == 0 && |
1604 (uap->flags & MS_OVERLAY) == 0 && | 1604 (uap->flags & MS_OVERLAY) == 0 && |
1605 (mvp->v_count != 1 || (mvp->v_flag & VROOT))) { | 1605 (mvp->v_count != 1 || (mvp->v_flag & VROOT))) { |
1606 mutex_exit(&mvp->v_lock); | 1606 mutex_exit(&mvp->v_lock); |
1607 return (EBUSY); | 1607 return (SET_ERROR(EBUSY)); |
1608 } | 1608 } |
1609 mutex_exit(&mvp->v_lock); | 1609 mutex_exit(&mvp->v_lock); |
1610 | 1610 |
1611 /* | 1611 /* |
1612 * ZFS does not support passing unparsed data in via MS_DATA. | 1612 * ZFS does not support passing unparsed data in via MS_DATA. |
1613 * Users should use the MS_OPTIONSTR interface; this means | 1613 * Users should use the MS_OPTIONSTR interface; this means |
1614 * that all option parsing is already done and the options struct | 1614 * that all option parsing is already done and the options struct |
1615 * can be interrogated. | 1615 * can be interrogated. |
1616 */ | 1616 */ |
1617 if ((uap->flags & MS_DATA) && uap->datalen > 0) | 1617 if ((uap->flags & MS_DATA) && uap->datalen > 0) |
1618 return (EINVAL); | 1618 return (SET_ERROR(EINVAL)); |
1619 | 1619 |
1620 /* | 1620 /* |
1621 * Get the objset name (the "special" mount argument). | 1621 * Get the objset name (the "special" mount argument). |
1622 */ | 1622 */ |
1623 if (error = pn_get(uap->spec, fromspace, &spn)) | 1623 if (error = pn_get(uap->spec, fromspace, &spn)) |
1661 * Refuse to mount a filesystem if we are in a local zone and the | 1661 * Refuse to mount a filesystem if we are in a local zone and the |
1662 * dataset is not visible. | 1662 * dataset is not visible. |
1663 */ | 1663 */ |
1664 if (!INGLOBALZONE(curproc) && | 1664 if (!INGLOBALZONE(curproc) && |
1665 (!zone_dataset_visible(osname, &canwrite) || !canwrite)) { | 1665 (!zone_dataset_visible(osname, &canwrite) || !canwrite)) { |
1666 error = EPERM; | 1666 error = SET_ERROR(EPERM); |
1667 goto out; | 1667 goto out; |
1668 } | 1668 } |
1669 | 1669 |
1670 error = zfs_mount_label_policy(vfsp, osname); | 1670 error = zfs_mount_label_policy(vfsp, osname); |
1671 if (error) | 1671 if (error) |
1817 * or a reopen of z_os failed then just bail out now. | 1817 * or a reopen of z_os failed then just bail out now. |
1818 */ | 1818 */ |
1819 if (!unmounting && (zfsvfs->z_unmounted || zfsvfs->z_os == NULL)) { | 1819 if (!unmounting && (zfsvfs->z_unmounted || zfsvfs->z_os == NULL)) { |
1820 rw_exit(&zfsvfs->z_teardown_inactive_lock); | 1820 rw_exit(&zfsvfs->z_teardown_inactive_lock); |
1821 rrw_exit(&zfsvfs->z_teardown_lock, FTAG); | 1821 rrw_exit(&zfsvfs->z_teardown_lock, FTAG); |
1822 return (EIO); | 1822 return (SET_ERROR(EIO)); |
1823 } | 1823 } |
1824 | 1824 |
1825 /* | 1825 /* |
1826 * At this point there are no vops active, and any new vops will | 1826 * At this point there are no vops active, and any new vops will |
1827 * fail with EIO since we have z_teardown_lock for writer (only | 1827 * fail with EIO since we have z_teardown_lock for writer (only |
1916 * own, and any active references underneath are | 1916 * own, and any active references underneath are |
1917 * reflected in the vnode count. | 1917 * reflected in the vnode count. |
1918 */ | 1918 */ |
1919 if (zfsvfs->z_ctldir == NULL) { | 1919 if (zfsvfs->z_ctldir == NULL) { |
1920 if (vfsp->vfs_count > 1) | 1920 if (vfsp->vfs_count > 1) |
1921 return (EBUSY); | 1921 return (SET_ERROR(EBUSY)); |
1922 } else { | 1922 } else { |
1923 if (vfsp->vfs_count > 2 || | 1923 if (vfsp->vfs_count > 2 || |
1924 zfsvfs->z_ctldir->v_count > 1) | 1924 zfsvfs->z_ctldir->v_count > 1) |
1925 return (EBUSY); | 1925 return (SET_ERROR(EBUSY)); |
1926 } | 1926 } |
1927 } | 1927 } |
1928 | 1928 |
1929 vfsp->vfs_flag |= VFS_UNMOUNTED; | 1929 vfsp->vfs_flag |= VFS_UNMOUNTED; |
1930 | 1930 |
1986 | 1986 |
1987 ZFS_EXIT(zfsvfs); | 1987 ZFS_EXIT(zfsvfs); |
1988 | 1988 |
1989 err = zfsctl_lookup_objset(vfsp, objsetid, &zfsvfs); | 1989 err = zfsctl_lookup_objset(vfsp, objsetid, &zfsvfs); |
1990 if (err) | 1990 if (err) |
1991 return (EINVAL); | 1991 return (SET_ERROR(EINVAL)); |
1992 ZFS_ENTER(zfsvfs); | 1992 ZFS_ENTER(zfsvfs); |
1993 } | 1993 } |
1994 | 1994 |
1995 if (fidp->fid_len == SHORT_FID_LEN || fidp->fid_len == LONG_FID_LEN) { | 1995 if (fidp->fid_len == SHORT_FID_LEN || fidp->fid_len == LONG_FID_LEN) { |
1996 zfid_short_t *zfid = (zfid_short_t *)fidp; | 1996 zfid_short_t *zfid = (zfid_short_t *)fidp; |
2000 | 2000 |
2001 for (i = 0; i < sizeof (zfid->zf_gen); i++) | 2001 for (i = 0; i < sizeof (zfid->zf_gen); i++) |
2002 fid_gen |= ((uint64_t)zfid->zf_gen[i]) << (8 * i); | 2002 fid_gen |= ((uint64_t)zfid->zf_gen[i]) << (8 * i); |
2003 } else { | 2003 } else { |
2004 ZFS_EXIT(zfsvfs); | 2004 ZFS_EXIT(zfsvfs); |
2005 return (EINVAL); | 2005 return (SET_ERROR(EINVAL)); |
2006 } | 2006 } |
2007 | 2007 |
2008 /* A zero fid_gen means we are in the .zfs control directories */ | 2008 /* A zero fid_gen means we are in the .zfs control directories */ |
2009 if (fid_gen == 0 && | 2009 if (fid_gen == 0 && |
2010 (object == ZFSCTL_INO_ROOT || object == ZFSCTL_INO_SNAPDIR)) { | 2010 (object == ZFSCTL_INO_ROOT || object == ZFSCTL_INO_SNAPDIR)) { |
2034 zp_gen = 1; | 2034 zp_gen = 1; |
2035 if (zp->z_unlinked || zp_gen != fid_gen) { | 2035 if (zp->z_unlinked || zp_gen != fid_gen) { |
2036 dprintf("znode gen (%u) != fid gen (%u)\n", zp_gen, fid_gen); | 2036 dprintf("znode gen (%u) != fid gen (%u)\n", zp_gen, fid_gen); |
2037 VN_RELE(ZTOV(zp)); | 2037 VN_RELE(ZTOV(zp)); |
2038 ZFS_EXIT(zfsvfs); | 2038 ZFS_EXIT(zfsvfs); |
2039 return (EINVAL); | 2039 return (SET_ERROR(EINVAL)); |
2040 } | 2040 } |
2041 | 2041 |
2042 *vpp = ZTOV(zp); | 2042 *vpp = ZTOV(zp); |
2043 ZFS_EXIT(zfsvfs); | 2043 ZFS_EXIT(zfsvfs); |
2044 return (0); | 2044 return (0); |
2235 int error; | 2235 int error; |
2236 objset_t *os = zfsvfs->z_os; | 2236 objset_t *os = zfsvfs->z_os; |
2237 dmu_tx_t *tx; | 2237 dmu_tx_t *tx; |
2238 | 2238 |
2239 if (newvers < ZPL_VERSION_INITIAL || newvers > ZPL_VERSION) | 2239 if (newvers < ZPL_VERSION_INITIAL || newvers > ZPL_VERSION) |
2240 return (EINVAL); | 2240 return (SET_ERROR(EINVAL)); |
2241 | 2241 |
2242 if (newvers < zfsvfs->z_version) | 2242 if (newvers < zfsvfs->z_version) |
2243 return (EINVAL); | 2243 return (SET_ERROR(EINVAL)); |
2244 | 2244 |
2245 if (zfs_spa_version_map(newvers) > | 2245 if (zfs_spa_version_map(newvers) > |
2246 spa_version(dmu_objset_spa(zfsvfs->z_os))) | 2246 spa_version(dmu_objset_spa(zfsvfs->z_os))) |
2247 return (ENOTSUP); | 2247 return (SET_ERROR(ENOTSUP)); |
2248 | 2248 |
2249 tx = dmu_tx_create(os); | 2249 tx = dmu_tx_create(os); |
2250 dmu_tx_hold_zap(tx, MASTER_NODE_OBJ, B_FALSE, ZPL_VERSION_STR); | 2250 dmu_tx_hold_zap(tx, MASTER_NODE_OBJ, B_FALSE, ZPL_VERSION_STR); |
2251 if (newvers >= ZPL_VERSION_SA && !zfsvfs->z_use_sa) { | 2251 if (newvers >= ZPL_VERSION_SA && !zfsvfs->z_use_sa) { |
2252 dmu_tx_hold_zap(tx, MASTER_NODE_OBJ, B_TRUE, | 2252 dmu_tx_hold_zap(tx, MASTER_NODE_OBJ, B_TRUE, |