zfs_vnops.c (4863:7b14ad153d91) | zfs_vnops.c (5326:6752aa2bd5bc) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 69 unchanged lines hidden (view full) --- 78 * properly lock its in-core state, create a DMU transaction, do the work, 79 * record this work in the intent log (ZIL), commit the DMU transaction, 80 * and wait the the intent log to commit if it's is a synchronous operation. 81 * Morover, the vnode ops must work in both normal and log replay context. 82 * The ordering of events is important to avoid deadlocks and references 83 * to freed memory. The example below illustrates the following Big Rules: 84 * 85 * (1) A check must be made in each zfs thread for a mounted file system. | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 69 unchanged lines hidden (view full) --- 78 * properly lock its in-core state, create a DMU transaction, do the work, 79 * record this work in the intent log (ZIL), commit the DMU transaction, 80 * and wait the the intent log to commit if it's is a synchronous operation. 81 * Morover, the vnode ops must work in both normal and log replay context. 82 * The ordering of events is important to avoid deadlocks and references 83 * to freed memory. The example below illustrates the following Big Rules: 84 * 85 * (1) A check must be made in each zfs thread for a mounted file system. |
86 * This is done avoiding races using ZFS_ENTER(zfsvfs). 87 * A ZFS_EXIT(zfsvfs) is needed before all returns. | 86 * This is done avoiding races using ZFS_ENTER(zfsvfs) or 87 * ZFS_ENTER_VERIFY(zfsvfs, zp). A ZFS_EXIT(zfsvfs) is needed before 88 * all returns. |
88 * 89 * (2) VN_RELE() should always be the last thing except for zil_commit() 90 * (if necessary) and ZFS_EXIT(). This is for 3 reasons: 91 * First, if it's the last reference, the vnode/znode 92 * can be freed, so the zp may point to freed memory. Second, the last 93 * reference will call zfs_zinactive(), which may induce a lot of work -- 94 * pushing cached pages (which acquires range locks) and syncing out 95 * cached atime changes. Third, zfs_zinactive() may require a new tx, --- 138 unchanged lines hidden (view full) --- 234/* ARGSUSED */ 235static int 236zfs_ioctl(vnode_t *vp, int com, intptr_t data, int flag, cred_t *cred, 237 int *rvalp) 238{ 239 offset_t off; 240 int error; 241 zfsvfs_t *zfsvfs; | 89 * 90 * (2) VN_RELE() should always be the last thing except for zil_commit() 91 * (if necessary) and ZFS_EXIT(). This is for 3 reasons: 92 * First, if it's the last reference, the vnode/znode 93 * can be freed, so the zp may point to freed memory. Second, the last 94 * reference will call zfs_zinactive(), which may induce a lot of work -- 95 * pushing cached pages (which acquires range locks) and syncing out 96 * cached atime changes. Third, zfs_zinactive() may require a new tx, --- 138 unchanged lines hidden (view full) --- 235/* ARGSUSED */ 236static int 237zfs_ioctl(vnode_t *vp, int com, intptr_t data, int flag, cred_t *cred, 238 int *rvalp) 239{ 240 offset_t off; 241 int error; 242 zfsvfs_t *zfsvfs; |
243 znode_t *zp; |
|
242 243 switch (com) { 244 case _FIOFFS: 245 return (zfs_sync(vp->v_vfsp, 0, cred)); 246 247 /* 248 * The following two ioctls are used by bfu. Faking out, 249 * necessary to avoid bfu errors. 250 */ 251 case _FIOGDIO: 252 case _FIOSDIO: 253 return (0); 254 255 case _FIO_SEEK_DATA: 256 case _FIO_SEEK_HOLE: 257 if (ddi_copyin((void *)data, &off, sizeof (off), flag)) 258 return (EFAULT); 259 | 244 245 switch (com) { 246 case _FIOFFS: 247 return (zfs_sync(vp->v_vfsp, 0, cred)); 248 249 /* 250 * The following two ioctls are used by bfu. Faking out, 251 * necessary to avoid bfu errors. 252 */ 253 case _FIOGDIO: 254 case _FIOSDIO: 255 return (0); 256 257 case _FIO_SEEK_DATA: 258 case _FIO_SEEK_HOLE: 259 if (ddi_copyin((void *)data, &off, sizeof (off), flag)) 260 return (EFAULT); 261 |
260 zfsvfs = VTOZ(vp)->z_zfsvfs; 261 ZFS_ENTER(zfsvfs); | 262 zp = VTOZ(vp); 263 zfsvfs = zp->z_zfsvfs; 264 ZFS_ENTER_VERIFY_ZP(zfsvfs, zp); |
262 263 /* offset parameter is in/out */ 264 error = zfs_holey(vp, com, &off); 265 ZFS_EXIT(zfsvfs); 266 if (error) 267 return (error); 268 if (ddi_copyout(&off, (void *)data, sizeof (off), flag)) 269 return (EFAULT); --- 123 unchanged lines hidden (view full) --- 393 * vp - atime updated if byte count > 0 394 */ 395/* ARGSUSED */ 396static int 397zfs_read(vnode_t *vp, uio_t *uio, int ioflag, cred_t *cr, caller_context_t *ct) 398{ 399 znode_t *zp = VTOZ(vp); 400 zfsvfs_t *zfsvfs = zp->z_zfsvfs; | 265 266 /* offset parameter is in/out */ 267 error = zfs_holey(vp, com, &off); 268 ZFS_EXIT(zfsvfs); 269 if (error) 270 return (error); 271 if (ddi_copyout(&off, (void *)data, sizeof (off), flag)) 272 return (EFAULT); --- 123 unchanged lines hidden (view full) --- 396 * vp - atime updated if byte count > 0 397 */ 398/* ARGSUSED */ 399static int 400zfs_read(vnode_t *vp, uio_t *uio, int ioflag, cred_t *cr, caller_context_t *ct) 401{ 402 znode_t *zp = VTOZ(vp); 403 zfsvfs_t *zfsvfs = zp->z_zfsvfs; |
401 objset_t *os = zfsvfs->z_os; | 404 objset_t *os; |
402 ssize_t n, nbytes; 403 int error; 404 rl_t *rl; 405 | 405 ssize_t n, nbytes; 406 int error; 407 rl_t *rl; 408 |
406 ZFS_ENTER(zfsvfs); | 409 ZFS_ENTER_VERIFY_ZP(zfsvfs, zp); 410 os = zfsvfs->z_os; |
407 408 /* 409 * Validate file offset 410 */ 411 if (uio->uio_loffset < (offset_t)0) { 412 ZFS_EXIT(zfsvfs); 413 return (EINVAL); 414 } --- 148 unchanged lines hidden (view full) --- 563{ 564 znode_t *zp = VTOZ(vp); 565 rlim64_t limit = uio->uio_llimit; 566 ssize_t start_resid = uio->uio_resid; 567 ssize_t tx_bytes; 568 uint64_t end_size; 569 dmu_tx_t *tx; 570 zfsvfs_t *zfsvfs = zp->z_zfsvfs; | 411 412 /* 413 * Validate file offset 414 */ 415 if (uio->uio_loffset < (offset_t)0) { 416 ZFS_EXIT(zfsvfs); 417 return (EINVAL); 418 } --- 148 unchanged lines hidden (view full) --- 567{ 568 znode_t *zp = VTOZ(vp); 569 rlim64_t limit = uio->uio_llimit; 570 ssize_t start_resid = uio->uio_resid; 571 ssize_t tx_bytes; 572 uint64_t end_size; 573 dmu_tx_t *tx; 574 zfsvfs_t *zfsvfs = zp->z_zfsvfs; |
571 zilog_t *zilog = zfsvfs->z_log; | 575 zilog_t *zilog; |
572 offset_t woff; 573 ssize_t n, nbytes; 574 rl_t *rl; 575 int max_blksz = zfsvfs->z_max_blksz; 576 int error; 577 578 /* 579 * Fasttrack empty write 580 */ 581 n = start_resid; 582 if (n == 0) 583 return (0); 584 585 if (limit == RLIM64_INFINITY || limit > MAXOFFSET_T) 586 limit = MAXOFFSET_T; 587 | 576 offset_t woff; 577 ssize_t n, nbytes; 578 rl_t *rl; 579 int max_blksz = zfsvfs->z_max_blksz; 580 int error; 581 582 /* 583 * Fasttrack empty write 584 */ 585 n = start_resid; 586 if (n == 0) 587 return (0); 588 589 if (limit == RLIM64_INFINITY || limit > MAXOFFSET_T) 590 limit = MAXOFFSET_T; 591 |
588 ZFS_ENTER(zfsvfs); | 592 ZFS_ENTER_VERIFY_ZP(zfsvfs, zp); 593 zilog = zfsvfs->z_log; |
589 590 /* 591 * Pre-fault the pages to ensure slow (eg NFS) pages 592 * don't hold up txg. 593 */ 594 zfs_prefault_write(n, uio); 595 596 /* --- 304 unchanged lines hidden (view full) --- 901/*ARGSUSED*/ 902static int 903zfs_access(vnode_t *vp, int mode, int flags, cred_t *cr) 904{ 905 znode_t *zp = VTOZ(vp); 906 zfsvfs_t *zfsvfs = zp->z_zfsvfs; 907 int error; 908 | 594 595 /* 596 * Pre-fault the pages to ensure slow (eg NFS) pages 597 * don't hold up txg. 598 */ 599 zfs_prefault_write(n, uio); 600 601 /* --- 304 unchanged lines hidden (view full) --- 906/*ARGSUSED*/ 907static int 908zfs_access(vnode_t *vp, int mode, int flags, cred_t *cr) 909{ 910 znode_t *zp = VTOZ(vp); 911 zfsvfs_t *zfsvfs = zp->z_zfsvfs; 912 int error; 913 |
909 ZFS_ENTER(zfsvfs); | 914 ZFS_ENTER_VERIFY_ZP(zfsvfs, zp); |
910 error = zfs_zaccess_rwx(zp, mode, cr); 911 ZFS_EXIT(zfsvfs); 912 return (error); 913} 914 915/* 916 * Lookup an entry in a directory, or an extended attribute directory. 917 * If it exists, return a held vnode reference for it. --- 18 unchanged lines hidden (view full) --- 936zfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, struct pathname *pnp, 937 int flags, vnode_t *rdir, cred_t *cr) 938{ 939 940 znode_t *zdp = VTOZ(dvp); 941 zfsvfs_t *zfsvfs = zdp->z_zfsvfs; 942 int error; 943 | 915 error = zfs_zaccess_rwx(zp, mode, cr); 916 ZFS_EXIT(zfsvfs); 917 return (error); 918} 919 920/* 921 * Lookup an entry in a directory, or an extended attribute directory. 922 * If it exists, return a held vnode reference for it. --- 18 unchanged lines hidden (view full) --- 941zfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, struct pathname *pnp, 942 int flags, vnode_t *rdir, cred_t *cr) 943{ 944 945 znode_t *zdp = VTOZ(dvp); 946 zfsvfs_t *zfsvfs = zdp->z_zfsvfs; 947 int error; 948 |
944 ZFS_ENTER(zfsvfs); | 949 ZFS_ENTER_VERIFY_ZP(zfsvfs, zdp); |
945 946 *vpp = NULL; 947 948 if (flags & LOOKUP_XATTR) { 949 /* 950 * If the xattr property is off, refuse the lookup request. 951 */ 952 if (!(zfsvfs->z_vfs->vfs_flag & VFS_XATTR)) { --- 86 unchanged lines hidden (view full) --- 1039 */ 1040/* ARGSUSED */ 1041static int 1042zfs_create(vnode_t *dvp, char *name, vattr_t *vap, vcexcl_t excl, 1043 int mode, vnode_t **vpp, cred_t *cr, int flag) 1044{ 1045 znode_t *zp, *dzp = VTOZ(dvp); 1046 zfsvfs_t *zfsvfs = dzp->z_zfsvfs; | 950 951 *vpp = NULL; 952 953 if (flags & LOOKUP_XATTR) { 954 /* 955 * If the xattr property is off, refuse the lookup request. 956 */ 957 if (!(zfsvfs->z_vfs->vfs_flag & VFS_XATTR)) { --- 86 unchanged lines hidden (view full) --- 1044 */ 1045/* ARGSUSED */ 1046static int 1047zfs_create(vnode_t *dvp, char *name, vattr_t *vap, vcexcl_t excl, 1048 int mode, vnode_t **vpp, cred_t *cr, int flag) 1049{ 1050 znode_t *zp, *dzp = VTOZ(dvp); 1051 zfsvfs_t *zfsvfs = dzp->z_zfsvfs; |
1047 zilog_t *zilog = zfsvfs->z_log; 1048 objset_t *os = zfsvfs->z_os; | 1052 zilog_t *zilog; 1053 objset_t *os; |
1049 zfs_dirlock_t *dl; 1050 dmu_tx_t *tx; 1051 int error; 1052 uint64_t zoid; 1053 | 1054 zfs_dirlock_t *dl; 1055 dmu_tx_t *tx; 1056 int error; 1057 uint64_t zoid; 1058 |
1054 ZFS_ENTER(zfsvfs); | 1059 ZFS_ENTER_VERIFY_ZP(zfsvfs, dzp); 1060 os = zfsvfs->z_os; 1061 zilog = zfsvfs->z_log; |
1055 1056top: 1057 *vpp = NULL; 1058 1059 if ((vap->va_mode & VSVTX) && secpolicy_vnode_stky_modify(cr)) 1060 vap->va_mode &= ~VSVTX; 1061 1062 if (*name == '\0') { --- 153 unchanged lines hidden (view full) --- 1216 */ 1217static int 1218zfs_remove(vnode_t *dvp, char *name, cred_t *cr) 1219{ 1220 znode_t *zp, *dzp = VTOZ(dvp); 1221 znode_t *xzp = NULL; 1222 vnode_t *vp; 1223 zfsvfs_t *zfsvfs = dzp->z_zfsvfs; | 1062 1063top: 1064 *vpp = NULL; 1065 1066 if ((vap->va_mode & VSVTX) && secpolicy_vnode_stky_modify(cr)) 1067 vap->va_mode &= ~VSVTX; 1068 1069 if (*name == '\0') { --- 153 unchanged lines hidden (view full) --- 1223 */ 1224static int 1225zfs_remove(vnode_t *dvp, char *name, cred_t *cr) 1226{ 1227 znode_t *zp, *dzp = VTOZ(dvp); 1228 znode_t *xzp = NULL; 1229 vnode_t *vp; 1230 zfsvfs_t *zfsvfs = dzp->z_zfsvfs; |
1224 zilog_t *zilog = zfsvfs->z_log; | 1231 zilog_t *zilog; |
1225 uint64_t acl_obj, xattr_obj; 1226 zfs_dirlock_t *dl; 1227 dmu_tx_t *tx; 1228 boolean_t may_delete_now, delete_now = FALSE; 1229 boolean_t unlinked; 1230 int error; 1231 | 1232 uint64_t acl_obj, xattr_obj; 1233 zfs_dirlock_t *dl; 1234 dmu_tx_t *tx; 1235 boolean_t may_delete_now, delete_now = FALSE; 1236 boolean_t unlinked; 1237 int error; 1238 |
1232 ZFS_ENTER(zfsvfs); | 1239 ZFS_ENTER_VERIFY_ZP(zfsvfs, dzp); 1240 zilog = zfsvfs->z_log; |
1233 1234top: 1235 /* 1236 * Attempt to lock directory; fail if entry doesn't exist. 1237 */ 1238 if (error = zfs_dirent_lock(&dl, dzp, name, &zp, ZEXISTS)) { 1239 ZFS_EXIT(zfsvfs); 1240 return (error); --- 140 unchanged lines hidden (view full) --- 1381 * dvp - ctime|mtime updated 1382 * vp - ctime|mtime|atime updated 1383 */ 1384static int 1385zfs_mkdir(vnode_t *dvp, char *dirname, vattr_t *vap, vnode_t **vpp, cred_t *cr) 1386{ 1387 znode_t *zp, *dzp = VTOZ(dvp); 1388 zfsvfs_t *zfsvfs = dzp->z_zfsvfs; | 1241 1242top: 1243 /* 1244 * Attempt to lock directory; fail if entry doesn't exist. 1245 */ 1246 if (error = zfs_dirent_lock(&dl, dzp, name, &zp, ZEXISTS)) { 1247 ZFS_EXIT(zfsvfs); 1248 return (error); --- 140 unchanged lines hidden (view full) --- 1389 * dvp - ctime|mtime updated 1390 * vp - ctime|mtime|atime updated 1391 */ 1392static int 1393zfs_mkdir(vnode_t *dvp, char *dirname, vattr_t *vap, vnode_t **vpp, cred_t *cr) 1394{ 1395 znode_t *zp, *dzp = VTOZ(dvp); 1396 zfsvfs_t *zfsvfs = dzp->z_zfsvfs; |
1389 zilog_t *zilog = zfsvfs->z_log; | 1397 zilog_t *zilog; |
1390 zfs_dirlock_t *dl; 1391 uint64_t zoid = 0; 1392 dmu_tx_t *tx; 1393 int error; 1394 1395 ASSERT(vap->va_type == VDIR); 1396 | 1398 zfs_dirlock_t *dl; 1399 uint64_t zoid = 0; 1400 dmu_tx_t *tx; 1401 int error; 1402 1403 ASSERT(vap->va_type == VDIR); 1404 |
1397 ZFS_ENTER(zfsvfs); | 1405 ZFS_ENTER_VERIFY_ZP(zfsvfs, dzp); 1406 zilog = zfsvfs->z_log; |
1398 1399 if (dzp->z_phys->zp_flags & ZFS_XATTR) { 1400 ZFS_EXIT(zfsvfs); 1401 return (EINVAL); 1402 } 1403top: 1404 *vpp = NULL; 1405 --- 72 unchanged lines hidden (view full) --- 1478 */ 1479static int 1480zfs_rmdir(vnode_t *dvp, char *name, vnode_t *cwd, cred_t *cr) 1481{ 1482 znode_t *dzp = VTOZ(dvp); 1483 znode_t *zp; 1484 vnode_t *vp; 1485 zfsvfs_t *zfsvfs = dzp->z_zfsvfs; | 1407 1408 if (dzp->z_phys->zp_flags & ZFS_XATTR) { 1409 ZFS_EXIT(zfsvfs); 1410 return (EINVAL); 1411 } 1412top: 1413 *vpp = NULL; 1414 --- 72 unchanged lines hidden (view full) --- 1487 */ 1488static int 1489zfs_rmdir(vnode_t *dvp, char *name, vnode_t *cwd, cred_t *cr) 1490{ 1491 znode_t *dzp = VTOZ(dvp); 1492 znode_t *zp; 1493 vnode_t *vp; 1494 zfsvfs_t *zfsvfs = dzp->z_zfsvfs; |
1486 zilog_t *zilog = zfsvfs->z_log; | 1495 zilog_t *zilog; |
1487 zfs_dirlock_t *dl; 1488 dmu_tx_t *tx; 1489 int error; 1490 | 1496 zfs_dirlock_t *dl; 1497 dmu_tx_t *tx; 1498 int error; 1499 |
1491 ZFS_ENTER(zfsvfs); | 1500 ZFS_ENTER_VERIFY_ZP(zfsvfs, dzp); 1501 zilog = zfsvfs->z_log; |
1492 1493top: 1494 zp = NULL; 1495 1496 /* 1497 * Attempt to lock directory; fail if entry doesn't exist. 1498 */ 1499 if (error = zfs_dirent_lock(&dl, dzp, name, &zp, ZEXISTS)) { --- 108 unchanged lines hidden (view full) --- 1608 zap_attribute_t zap; 1609 uint_t bytes_wanted; 1610 uint64_t offset; /* must be unsigned; checks for < 1 */ 1611 int local_eof; 1612 int outcount; 1613 int error; 1614 uint8_t prefetch; 1615 | 1502 1503top: 1504 zp = NULL; 1505 1506 /* 1507 * Attempt to lock directory; fail if entry doesn't exist. 1508 */ 1509 if (error = zfs_dirent_lock(&dl, dzp, name, &zp, ZEXISTS)) { --- 108 unchanged lines hidden (view full) --- 1618 zap_attribute_t zap; 1619 uint_t bytes_wanted; 1620 uint64_t offset; /* must be unsigned; checks for < 1 */ 1621 int local_eof; 1622 int outcount; 1623 int error; 1624 uint8_t prefetch; 1625 |
1616 ZFS_ENTER(zfsvfs); | 1626 ZFS_ENTER_VERIFY_ZP(zfsvfs, zp); |
1617 1618 /* 1619 * If we are not given an eof variable, 1620 * use a local one. 1621 */ 1622 if (eofp == NULL) 1623 eofp = &local_eof; 1624 --- 182 unchanged lines hidden (view full) --- 1807 * going to be pushed out as part of the zil_commit(). 1808 */ 1809 if (vn_has_cached_data(vp) && !(syncflag & FNODSYNC) && 1810 (vp->v_type == VREG) && !(IS_SWAPVP(vp))) 1811 (void) VOP_PUTPAGE(vp, (offset_t)0, (size_t)0, B_ASYNC, cr); 1812 1813 (void) tsd_set(zfs_fsyncer_key, (void *)zfs_fsync_sync_cnt); 1814 | 1627 1628 /* 1629 * If we are not given an eof variable, 1630 * use a local one. 1631 */ 1632 if (eofp == NULL) 1633 eofp = &local_eof; 1634 --- 182 unchanged lines hidden (view full) --- 1817 * going to be pushed out as part of the zil_commit(). 1818 */ 1819 if (vn_has_cached_data(vp) && !(syncflag & FNODSYNC) && 1820 (vp->v_type == VREG) && !(IS_SWAPVP(vp))) 1821 (void) VOP_PUTPAGE(vp, (offset_t)0, (size_t)0, B_ASYNC, cr); 1822 1823 (void) tsd_set(zfs_fsyncer_key, (void *)zfs_fsync_sync_cnt); 1824 |
1815 ZFS_ENTER(zfsvfs); | 1825 ZFS_ENTER_VERIFY_ZP(zfsvfs, zp); |
1816 zil_commit(zfsvfs->z_log, zp->z_last_itx, zp->z_id); 1817 ZFS_EXIT(zfsvfs); 1818 return (0); 1819} 1820 1821/* 1822 * Get the requested file attributes and place them in the provided 1823 * vattr structure. --- 8 unchanged lines hidden (view full) --- 1832 * RETURN: 0 (always succeeds) 1833 */ 1834/* ARGSUSED */ 1835static int 1836zfs_getattr(vnode_t *vp, vattr_t *vap, int flags, cred_t *cr) 1837{ 1838 znode_t *zp = VTOZ(vp); 1839 zfsvfs_t *zfsvfs = zp->z_zfsvfs; | 1826 zil_commit(zfsvfs->z_log, zp->z_last_itx, zp->z_id); 1827 ZFS_EXIT(zfsvfs); 1828 return (0); 1829} 1830 1831/* 1832 * Get the requested file attributes and place them in the provided 1833 * vattr structure. --- 8 unchanged lines hidden (view full) --- 1842 * RETURN: 0 (always succeeds) 1843 */ 1844/* ARGSUSED */ 1845static int 1846zfs_getattr(vnode_t *vp, vattr_t *vap, int flags, cred_t *cr) 1847{ 1848 znode_t *zp = VTOZ(vp); 1849 zfsvfs_t *zfsvfs = zp->z_zfsvfs; |
1840 znode_phys_t *pzp = zp->z_phys; | 1850 znode_phys_t *pzp; |
1841 int error; 1842 uint64_t links; 1843 | 1851 int error; 1852 uint64_t links; 1853 |
1844 ZFS_ENTER(zfsvfs); | 1854 ZFS_ENTER_VERIFY_ZP(zfsvfs, zp); 1855 pzp = zp->z_phys; |
1845 1846 /* 1847 * Return all attributes. It's cheaper to provide the answer 1848 * than to determine whether we were asked the question. 1849 */ 1850 mutex_enter(&zp->z_lock); 1851 1852 vap->va_type = vp->v_type; --- 59 unchanged lines hidden (view full) --- 1912 * Timestamps: 1913 * vp - ctime updated, mtime updated if size changed. 1914 */ 1915/* ARGSUSED */ 1916static int 1917zfs_setattr(vnode_t *vp, vattr_t *vap, int flags, cred_t *cr, 1918 caller_context_t *ct) 1919{ | 1856 1857 /* 1858 * Return all attributes. It's cheaper to provide the answer 1859 * than to determine whether we were asked the question. 1860 */ 1861 mutex_enter(&zp->z_lock); 1862 1863 vap->va_type = vp->v_type; --- 59 unchanged lines hidden (view full) --- 1923 * Timestamps: 1924 * vp - ctime updated, mtime updated if size changed. 1925 */ 1926/* ARGSUSED */ 1927static int 1928zfs_setattr(vnode_t *vp, vattr_t *vap, int flags, cred_t *cr, 1929 caller_context_t *ct) 1930{ |
1920 struct znode *zp = VTOZ(vp); 1921 znode_phys_t *pzp = zp->z_phys; | 1931 znode_t *zp = VTOZ(vp); 1932 znode_phys_t *pzp; |
1922 zfsvfs_t *zfsvfs = zp->z_zfsvfs; | 1933 zfsvfs_t *zfsvfs = zp->z_zfsvfs; |
1923 zilog_t *zilog = zfsvfs->z_log; | 1934 zilog_t *zilog; |
1924 dmu_tx_t *tx; 1925 vattr_t oldva; 1926 uint_t mask = vap->va_mask; 1927 uint_t saved_mask; 1928 int trim_mask = 0; 1929 uint64_t new_mode; 1930 znode_t *attrzp; 1931 int need_policy = FALSE; --- 6 unchanged lines hidden (view full) --- 1938 return (EINVAL); 1939 1940 if (mask & AT_SIZE && vp->v_type == VDIR) 1941 return (EISDIR); 1942 1943 if (mask & AT_SIZE && vp->v_type != VREG && vp->v_type != VFIFO) 1944 return (EINVAL); 1945 | 1935 dmu_tx_t *tx; 1936 vattr_t oldva; 1937 uint_t mask = vap->va_mask; 1938 uint_t saved_mask; 1939 int trim_mask = 0; 1940 uint64_t new_mode; 1941 znode_t *attrzp; 1942 int need_policy = FALSE; --- 6 unchanged lines hidden (view full) --- 1949 return (EINVAL); 1950 1951 if (mask & AT_SIZE && vp->v_type == VDIR) 1952 return (EISDIR); 1953 1954 if (mask & AT_SIZE && vp->v_type != VREG && vp->v_type != VFIFO) 1955 return (EINVAL); 1956 |
1946 ZFS_ENTER(zfsvfs); | 1957 ZFS_ENTER_VERIFY_ZP(zfsvfs, zp); 1958 pzp = zp->z_phys; 1959 zilog = zfsvfs->z_log; |
1947 1948top: 1949 attrzp = NULL; 1950 1951 if (zfsvfs->z_vfs->vfs_flag & VFS_RDONLY) { 1952 ZFS_EXIT(zfsvfs); 1953 return (EROFS); 1954 } --- 338 unchanged lines hidden (view full) --- 2293 * sdvp,tdvp - ctime|mtime updated 2294 */ 2295static int 2296zfs_rename(vnode_t *sdvp, char *snm, vnode_t *tdvp, char *tnm, cred_t *cr) 2297{ 2298 znode_t *tdzp, *szp, *tzp; 2299 znode_t *sdzp = VTOZ(sdvp); 2300 zfsvfs_t *zfsvfs = sdzp->z_zfsvfs; | 1960 1961top: 1962 attrzp = NULL; 1963 1964 if (zfsvfs->z_vfs->vfs_flag & VFS_RDONLY) { 1965 ZFS_EXIT(zfsvfs); 1966 return (EROFS); 1967 } --- 338 unchanged lines hidden (view full) --- 2306 * sdvp,tdvp - ctime|mtime updated 2307 */ 2308static int 2309zfs_rename(vnode_t *sdvp, char *snm, vnode_t *tdvp, char *tnm, cred_t *cr) 2310{ 2311 znode_t *tdzp, *szp, *tzp; 2312 znode_t *sdzp = VTOZ(sdvp); 2313 zfsvfs_t *zfsvfs = sdzp->z_zfsvfs; |
2301 zilog_t *zilog = zfsvfs->z_log; | 2314 zilog_t *zilog; |
2302 vnode_t *realvp; 2303 zfs_dirlock_t *sdl, *tdl; 2304 dmu_tx_t *tx; 2305 zfs_zlock_t *zl; 2306 int cmp, serr, terr, error; 2307 | 2315 vnode_t *realvp; 2316 zfs_dirlock_t *sdl, *tdl; 2317 dmu_tx_t *tx; 2318 zfs_zlock_t *zl; 2319 int cmp, serr, terr, error; 2320 |
2308 ZFS_ENTER(zfsvfs); | 2321 ZFS_ENTER_VERIFY_ZP(zfsvfs, sdzp); 2322 zilog = zfsvfs->z_log; |
2309 2310 /* 2311 * Make sure we have the real vp for the target directory. 2312 */ 2313 if (VOP_REALVP(tdvp, &realvp) == 0) 2314 tdvp = realvp; 2315 2316 if (tdvp->v_vfsp != sdvp->v_vfsp) { 2317 ZFS_EXIT(zfsvfs); 2318 return (EXDEV); 2319 } 2320 2321 tdzp = VTOZ(tdvp); | 2323 2324 /* 2325 * Make sure we have the real vp for the target directory. 2326 */ 2327 if (VOP_REALVP(tdvp, &realvp) == 0) 2328 tdvp = realvp; 2329 2330 if (tdvp->v_vfsp != sdvp->v_vfsp) { 2331 ZFS_EXIT(zfsvfs); 2332 return (EXDEV); 2333 } 2334 2335 tdzp = VTOZ(tdvp); |
2336 if (!tdzp->z_dbuf_held) { 2337 ZFS_EXIT(zfsvfs); 2338 return (EIO); 2339 } |
|
2322top: 2323 szp = NULL; 2324 tzp = NULL; 2325 zl = NULL; 2326 2327 /* 2328 * This is to prevent the creation of links into attribute space 2329 * by renaming a linked file into/outof an attribute directory. --- 194 unchanged lines hidden (view full) --- 2524 */ 2525static int 2526zfs_symlink(vnode_t *dvp, char *name, vattr_t *vap, char *link, cred_t *cr) 2527{ 2528 znode_t *zp, *dzp = VTOZ(dvp); 2529 zfs_dirlock_t *dl; 2530 dmu_tx_t *tx; 2531 zfsvfs_t *zfsvfs = dzp->z_zfsvfs; | 2340top: 2341 szp = NULL; 2342 tzp = NULL; 2343 zl = NULL; 2344 2345 /* 2346 * This is to prevent the creation of links into attribute space 2347 * by renaming a linked file into/outof an attribute directory. --- 194 unchanged lines hidden (view full) --- 2542 */ 2543static int 2544zfs_symlink(vnode_t *dvp, char *name, vattr_t *vap, char *link, cred_t *cr) 2545{ 2546 znode_t *zp, *dzp = VTOZ(dvp); 2547 zfs_dirlock_t *dl; 2548 dmu_tx_t *tx; 2549 zfsvfs_t *zfsvfs = dzp->z_zfsvfs; |
2532 zilog_t *zilog = zfsvfs->z_log; | 2550 zilog_t *zilog; |
2533 uint64_t zoid; 2534 int len = strlen(link); 2535 int error; 2536 2537 ASSERT(vap->va_type == VLNK); 2538 | 2551 uint64_t zoid; 2552 int len = strlen(link); 2553 int error; 2554 2555 ASSERT(vap->va_type == VLNK); 2556 |
2539 ZFS_ENTER(zfsvfs); | 2557 ZFS_ENTER_VERIFY_ZP(zfsvfs, dzp); 2558 zilog = zfsvfs->z_log; |
2540top: 2541 if (error = zfs_zaccess(dzp, ACE_ADD_FILE, cr)) { 2542 ZFS_EXIT(zfsvfs); 2543 return (error); 2544 } 2545 2546 if (len > MAXPATHLEN) { 2547 ZFS_EXIT(zfsvfs); --- 97 unchanged lines hidden (view full) --- 2645static int 2646zfs_readlink(vnode_t *vp, uio_t *uio, cred_t *cr) 2647{ 2648 znode_t *zp = VTOZ(vp); 2649 zfsvfs_t *zfsvfs = zp->z_zfsvfs; 2650 size_t bufsz; 2651 int error; 2652 | 2559top: 2560 if (error = zfs_zaccess(dzp, ACE_ADD_FILE, cr)) { 2561 ZFS_EXIT(zfsvfs); 2562 return (error); 2563 } 2564 2565 if (len > MAXPATHLEN) { 2566 ZFS_EXIT(zfsvfs); --- 97 unchanged lines hidden (view full) --- 2664static int 2665zfs_readlink(vnode_t *vp, uio_t *uio, cred_t *cr) 2666{ 2667 znode_t *zp = VTOZ(vp); 2668 zfsvfs_t *zfsvfs = zp->z_zfsvfs; 2669 size_t bufsz; 2670 int error; 2671 |
2653 ZFS_ENTER(zfsvfs); | 2672 ZFS_ENTER_VERIFY_ZP(zfsvfs, zp); |
2654 2655 bufsz = (size_t)zp->z_phys->zp_size; 2656 if (bufsz + sizeof (znode_phys_t) <= zp->z_dbuf->db_size) { 2657 error = uiomove(zp->z_phys + 1, 2658 MIN((size_t)bufsz, uio->uio_resid), UIO_READ, uio); 2659 } else { 2660 dmu_buf_t *dbp; 2661 error = dmu_buf_hold(zfsvfs->z_os, zp->z_id, 0, FTAG, &dbp); --- 28 unchanged lines hidden (view full) --- 2690 */ 2691/* ARGSUSED */ 2692static int 2693zfs_link(vnode_t *tdvp, vnode_t *svp, char *name, cred_t *cr) 2694{ 2695 znode_t *dzp = VTOZ(tdvp); 2696 znode_t *tzp, *szp; 2697 zfsvfs_t *zfsvfs = dzp->z_zfsvfs; | 2673 2674 bufsz = (size_t)zp->z_phys->zp_size; 2675 if (bufsz + sizeof (znode_phys_t) <= zp->z_dbuf->db_size) { 2676 error = uiomove(zp->z_phys + 1, 2677 MIN((size_t)bufsz, uio->uio_resid), UIO_READ, uio); 2678 } else { 2679 dmu_buf_t *dbp; 2680 error = dmu_buf_hold(zfsvfs->z_os, zp->z_id, 0, FTAG, &dbp); --- 28 unchanged lines hidden (view full) --- 2709 */ 2710/* ARGSUSED */ 2711static int 2712zfs_link(vnode_t *tdvp, vnode_t *svp, char *name, cred_t *cr) 2713{ 2714 znode_t *dzp = VTOZ(tdvp); 2715 znode_t *tzp, *szp; 2716 zfsvfs_t *zfsvfs = dzp->z_zfsvfs; |
2698 zilog_t *zilog = zfsvfs->z_log; | 2717 zilog_t *zilog; |
2699 zfs_dirlock_t *dl; 2700 dmu_tx_t *tx; 2701 vnode_t *realvp; 2702 int error; 2703 2704 ASSERT(tdvp->v_type == VDIR); 2705 | 2718 zfs_dirlock_t *dl; 2719 dmu_tx_t *tx; 2720 vnode_t *realvp; 2721 int error; 2722 2723 ASSERT(tdvp->v_type == VDIR); 2724 |
2706 ZFS_ENTER(zfsvfs); | 2725 ZFS_ENTER_VERIFY_ZP(zfsvfs, dzp); 2726 zilog = zfsvfs->z_log; |
2707 2708 if (VOP_REALVP(svp, &realvp) == 0) 2709 svp = realvp; 2710 2711 if (svp->v_vfsp != tdvp->v_vfsp) { 2712 ZFS_EXIT(zfsvfs); 2713 return (EXDEV); 2714 } 2715 2716 szp = VTOZ(svp); | 2727 2728 if (VOP_REALVP(svp, &realvp) == 0) 2729 svp = realvp; 2730 2731 if (svp->v_vfsp != tdvp->v_vfsp) { 2732 ZFS_EXIT(zfsvfs); 2733 return (EXDEV); 2734 } 2735 2736 szp = VTOZ(svp); |
2737 if (!szp->z_dbuf_held) { 2738 ZFS_EXIT(zfsvfs); 2739 return (EIO); 2740 } |
|
2717top: 2718 /* 2719 * We do not support links between attributes and non-attributes 2720 * because of the potential security risk of creating links 2721 * into "normal" file space in order to circumvent restrictions 2722 * imposed in attribute space. 2723 */ 2724 if ((szp->z_phys->zp_flags & ZFS_XATTR) != --- 217 unchanged lines hidden (view full) --- 2942 znode_t *zp = VTOZ(vp); 2943 zfsvfs_t *zfsvfs = zp->z_zfsvfs; 2944 page_t *pp; 2945 size_t io_len; 2946 u_offset_t io_off; 2947 uint64_t filesz; 2948 int error = 0; 2949 | 2741top: 2742 /* 2743 * We do not support links between attributes and non-attributes 2744 * because of the potential security risk of creating links 2745 * into "normal" file space in order to circumvent restrictions 2746 * imposed in attribute space. 2747 */ 2748 if ((szp->z_phys->zp_flags & ZFS_XATTR) != --- 217 unchanged lines hidden (view full) --- 2966 znode_t *zp = VTOZ(vp); 2967 zfsvfs_t *zfsvfs = zp->z_zfsvfs; 2968 page_t *pp; 2969 size_t io_len; 2970 u_offset_t io_off; 2971 uint64_t filesz; 2972 int error = 0; 2973 |
2950 ZFS_ENTER(zfsvfs); | 2974 ZFS_ENTER_VERIFY_ZP(zfsvfs, zp); |
2951 2952 ASSERT(zp->z_dbuf_held && zp->z_phys); 2953 2954 if (len == 0) { 2955 /* 2956 * Search the entire vp list for pages >= off. 2957 */ 2958 error = pvn_vplist_dirty(vp, (u_offset_t)off, zfs_putapage, --- 41 unchanged lines hidden (view full) --- 3000 3001void 3002zfs_inactive(vnode_t *vp, cred_t *cr) 3003{ 3004 znode_t *zp = VTOZ(vp); 3005 zfsvfs_t *zfsvfs = zp->z_zfsvfs; 3006 int error; 3007 | 2975 2976 ASSERT(zp->z_dbuf_held && zp->z_phys); 2977 2978 if (len == 0) { 2979 /* 2980 * Search the entire vp list for pages >= off. 2981 */ 2982 error = pvn_vplist_dirty(vp, (u_offset_t)off, zfs_putapage, --- 41 unchanged lines hidden (view full) --- 3024 3025void 3026zfs_inactive(vnode_t *vp, cred_t *cr) 3027{ 3028 znode_t *zp = VTOZ(vp); 3029 zfsvfs_t *zfsvfs = zp->z_zfsvfs; 3030 int error; 3031 |
3008 rw_enter(&zfsvfs->z_unmount_inactive_lock, RW_READER); 3009 if (zfsvfs->z_unmounted) { 3010 ASSERT(zp->z_dbuf_held == 0); 3011 | 3032 rw_enter(&zfsvfs->z_teardown_inactive_lock, RW_READER); 3033 if (zp->z_dbuf_held == 0) { |
3012 if (vn_has_cached_data(vp)) { 3013 (void) pvn_vplist_dirty(vp, 0, zfs_null_putapage, 3014 B_INVAL, cr); 3015 } 3016 3017 mutex_enter(&zp->z_lock); 3018 vp->v_count = 0; /* count arrives as 1 */ 3019 if (zp->z_dbuf == NULL) { 3020 mutex_exit(&zp->z_lock); 3021 zfs_znode_free(zp); 3022 } else { 3023 mutex_exit(&zp->z_lock); 3024 } | 3034 if (vn_has_cached_data(vp)) { 3035 (void) pvn_vplist_dirty(vp, 0, zfs_null_putapage, 3036 B_INVAL, cr); 3037 } 3038 3039 mutex_enter(&zp->z_lock); 3040 vp->v_count = 0; /* count arrives as 1 */ 3041 if (zp->z_dbuf == NULL) { 3042 mutex_exit(&zp->z_lock); 3043 zfs_znode_free(zp); 3044 } else { 3045 mutex_exit(&zp->z_lock); 3046 } |
3025 rw_exit(&zfsvfs->z_unmount_inactive_lock); | 3047 rw_exit(&zfsvfs->z_teardown_inactive_lock); |
3026 VFS_RELE(zfsvfs->z_vfs); 3027 return; 3028 } 3029 3030 /* 3031 * Attempt to push any data in the page cache. If this fails 3032 * we will get kicked out later in zfs_zinactive(). 3033 */ --- 14 unchanged lines hidden (view full) --- 3048 mutex_enter(&zp->z_lock); 3049 zp->z_atime_dirty = 0; 3050 mutex_exit(&zp->z_lock); 3051 dmu_tx_commit(tx); 3052 } 3053 } 3054 3055 zfs_zinactive(zp); | 3048 VFS_RELE(zfsvfs->z_vfs); 3049 return; 3050 } 3051 3052 /* 3053 * Attempt to push any data in the page cache. If this fails 3054 * we will get kicked out later in zfs_zinactive(). 3055 */ --- 14 unchanged lines hidden (view full) --- 3070 mutex_enter(&zp->z_lock); 3071 zp->z_atime_dirty = 0; 3072 mutex_exit(&zp->z_lock); 3073 dmu_tx_commit(tx); 3074 } 3075 } 3076 3077 zfs_zinactive(zp); |
3056 rw_exit(&zfsvfs->z_unmount_inactive_lock); | 3078 rw_exit(&zfsvfs->z_teardown_inactive_lock); |
3057} 3058 3059/* 3060 * Bounds-check the seek operation. 3061 * 3062 * IN: vp - vnode seeking within 3063 * ooff - old file offset 3064 * noffp - pointer to new file offset --- 17 unchanged lines hidden (view full) --- 3082static int 3083zfs_frlock(vnode_t *vp, int cmd, flock64_t *bfp, int flag, offset_t offset, 3084 flk_callback_t *flk_cbp, cred_t *cr) 3085{ 3086 znode_t *zp = VTOZ(vp); 3087 zfsvfs_t *zfsvfs = zp->z_zfsvfs; 3088 int error; 3089 | 3079} 3080 3081/* 3082 * Bounds-check the seek operation. 3083 * 3084 * IN: vp - vnode seeking within 3085 * ooff - old file offset 3086 * noffp - pointer to new file offset --- 17 unchanged lines hidden (view full) --- 3104static int 3105zfs_frlock(vnode_t *vp, int cmd, flock64_t *bfp, int flag, offset_t offset, 3106 flk_callback_t *flk_cbp, cred_t *cr) 3107{ 3108 znode_t *zp = VTOZ(vp); 3109 zfsvfs_t *zfsvfs = zp->z_zfsvfs; 3110 int error; 3111 |
3090 ZFS_ENTER(zfsvfs); | 3112 ZFS_ENTER_VERIFY_ZP(zfsvfs, zp); |
3091 3092 /* 3093 * We are following the UFS semantics with respect to mapcnt 3094 * here: If we see that the file is mapped already, then we will 3095 * return an error, but we don't worry about races between this 3096 * function and zfs_map(). 3097 */ 3098 if (zp->z_mapcnt > 0 && MANDMODE((mode_t)zp->z_phys->zp_mode)) { --- 135 unchanged lines hidden (view full) --- 3234 enum seg_rw rw, cred_t *cr) 3235{ 3236 znode_t *zp = VTOZ(vp); 3237 zfsvfs_t *zfsvfs = zp->z_zfsvfs; 3238 page_t *pp, **pl0 = pl; 3239 int need_unlock = 0, err = 0; 3240 offset_t orig_off; 3241 | 3113 3114 /* 3115 * We are following the UFS semantics with respect to mapcnt 3116 * here: If we see that the file is mapped already, then we will 3117 * return an error, but we don't worry about races between this 3118 * function and zfs_map(). 3119 */ 3120 if (zp->z_mapcnt > 0 && MANDMODE((mode_t)zp->z_phys->zp_mode)) { --- 135 unchanged lines hidden (view full) --- 3256 enum seg_rw rw, cred_t *cr) 3257{ 3258 znode_t *zp = VTOZ(vp); 3259 zfsvfs_t *zfsvfs = zp->z_zfsvfs; 3260 page_t *pp, **pl0 = pl; 3261 int need_unlock = 0, err = 0; 3262 offset_t orig_off; 3263 |
3242 ZFS_ENTER(zfsvfs); | 3264 ZFS_ENTER_VERIFY_ZP(zfsvfs, zp); |
3243 3244 if (protp) 3245 *protp = PROT_ALL; 3246 3247 ASSERT(zp->z_dbuf_held && zp->z_phys); 3248 3249 /* no faultahead (for now) */ 3250 if (pl == NULL) { --- 115 unchanged lines hidden (view full) --- 3366zfs_map(vnode_t *vp, offset_t off, struct as *as, caddr_t *addrp, 3367 size_t len, uchar_t prot, uchar_t maxprot, uint_t flags, cred_t *cr) 3368{ 3369 znode_t *zp = VTOZ(vp); 3370 zfsvfs_t *zfsvfs = zp->z_zfsvfs; 3371 segvn_crargs_t vn_a; 3372 int error; 3373 | 3265 3266 if (protp) 3267 *protp = PROT_ALL; 3268 3269 ASSERT(zp->z_dbuf_held && zp->z_phys); 3270 3271 /* no faultahead (for now) */ 3272 if (pl == NULL) { --- 115 unchanged lines hidden (view full) --- 3388zfs_map(vnode_t *vp, offset_t off, struct as *as, caddr_t *addrp, 3389 size_t len, uchar_t prot, uchar_t maxprot, uint_t flags, cred_t *cr) 3390{ 3391 znode_t *zp = VTOZ(vp); 3392 zfsvfs_t *zfsvfs = zp->z_zfsvfs; 3393 segvn_crargs_t vn_a; 3394 int error; 3395 |
3374 ZFS_ENTER(zfsvfs); | 3396 ZFS_ENTER_VERIFY_ZP(zfsvfs, zp); |
3375 3376 if (vp->v_flag & VNOMAP) { 3377 ZFS_EXIT(zfsvfs); 3378 return (ENOSYS); 3379 } 3380 3381 if (off < 0 || len > MAXOFFSET_T - off) { 3382 ZFS_EXIT(zfsvfs); --- 119 unchanged lines hidden (view full) --- 3502zfs_space(vnode_t *vp, int cmd, flock64_t *bfp, int flag, 3503 offset_t offset, cred_t *cr, caller_context_t *ct) 3504{ 3505 znode_t *zp = VTOZ(vp); 3506 zfsvfs_t *zfsvfs = zp->z_zfsvfs; 3507 uint64_t off, len; 3508 int error; 3509 | 3397 3398 if (vp->v_flag & VNOMAP) { 3399 ZFS_EXIT(zfsvfs); 3400 return (ENOSYS); 3401 } 3402 3403 if (off < 0 || len > MAXOFFSET_T - off) { 3404 ZFS_EXIT(zfsvfs); --- 119 unchanged lines hidden (view full) --- 3524zfs_space(vnode_t *vp, int cmd, flock64_t *bfp, int flag, 3525 offset_t offset, cred_t *cr, caller_context_t *ct) 3526{ 3527 znode_t *zp = VTOZ(vp); 3528 zfsvfs_t *zfsvfs = zp->z_zfsvfs; 3529 uint64_t off, len; 3530 int error; 3531 |
3510 ZFS_ENTER(zfsvfs); | 3532 ZFS_ENTER_VERIFY_ZP(zfsvfs, zp); |
3511 3512top: 3513 if (cmd != F_FREESP) { 3514 ZFS_EXIT(zfsvfs); 3515 return (EINVAL); 3516 } 3517 3518 if (error = convoff(vp, bfp, 0, offset)) { --- 18 unchanged lines hidden (view full) --- 3537 return (error); 3538} 3539 3540static int 3541zfs_fid(vnode_t *vp, fid_t *fidp) 3542{ 3543 znode_t *zp = VTOZ(vp); 3544 zfsvfs_t *zfsvfs = zp->z_zfsvfs; | 3533 3534top: 3535 if (cmd != F_FREESP) { 3536 ZFS_EXIT(zfsvfs); 3537 return (EINVAL); 3538 } 3539 3540 if (error = convoff(vp, bfp, 0, offset)) { --- 18 unchanged lines hidden (view full) --- 3559 return (error); 3560} 3561 3562static int 3563zfs_fid(vnode_t *vp, fid_t *fidp) 3564{ 3565 znode_t *zp = VTOZ(vp); 3566 zfsvfs_t *zfsvfs = zp->z_zfsvfs; |
3545 uint32_t gen = (uint32_t)zp->z_phys->zp_gen; | 3567 uint32_t gen; |
3546 uint64_t object = zp->z_id; 3547 zfid_short_t *zfid; 3548 int size, i; 3549 | 3568 uint64_t object = zp->z_id; 3569 zfid_short_t *zfid; 3570 int size, i; 3571 |
3550 ZFS_ENTER(zfsvfs); | 3572 ZFS_ENTER_VERIFY_ZP(zfsvfs, zp); 3573 gen = (uint32_t)zp->z_gen; |
3551 3552 size = (zfsvfs->z_parent != zfsvfs) ? LONG_FID_LEN : SHORT_FID_LEN; 3553 if (fidp->fid_len < size) { 3554 fidp->fid_len = size; 3555 ZFS_EXIT(zfsvfs); 3556 return (ENOSPC); 3557 } 3558 --- 43 unchanged lines hidden (view full) --- 3602 3603 case _PC_FILESIZEBITS: 3604 *valp = 64; 3605 return (0); 3606 3607 case _PC_XATTR_EXISTS: 3608 zp = VTOZ(vp); 3609 zfsvfs = zp->z_zfsvfs; | 3574 3575 size = (zfsvfs->z_parent != zfsvfs) ? LONG_FID_LEN : SHORT_FID_LEN; 3576 if (fidp->fid_len < size) { 3577 fidp->fid_len = size; 3578 ZFS_EXIT(zfsvfs); 3579 return (ENOSPC); 3580 } 3581 --- 43 unchanged lines hidden (view full) --- 3625 3626 case _PC_FILESIZEBITS: 3627 *valp = 64; 3628 return (0); 3629 3630 case _PC_XATTR_EXISTS: 3631 zp = VTOZ(vp); 3632 zfsvfs = zp->z_zfsvfs; |
3610 ZFS_ENTER(zfsvfs); | 3633 ZFS_ENTER_VERIFY_ZP(zfsvfs, zp); |
3611 *valp = 0; 3612 error = zfs_dirent_lock(&dl, zp, "", &xzp, 3613 ZXATTR | ZEXISTS | ZSHARED); 3614 if (error == 0) { 3615 zfs_dirent_unlock(dl); 3616 if (!zfs_dirempty(xzp)) 3617 *valp = 1; 3618 VN_RELE(ZTOV(xzp)); --- 23 unchanged lines hidden (view full) --- 3642/*ARGSUSED*/ 3643static int 3644zfs_getsecattr(vnode_t *vp, vsecattr_t *vsecp, int flag, cred_t *cr) 3645{ 3646 znode_t *zp = VTOZ(vp); 3647 zfsvfs_t *zfsvfs = zp->z_zfsvfs; 3648 int error; 3649 | 3634 *valp = 0; 3635 error = zfs_dirent_lock(&dl, zp, "", &xzp, 3636 ZXATTR | ZEXISTS | ZSHARED); 3637 if (error == 0) { 3638 zfs_dirent_unlock(dl); 3639 if (!zfs_dirempty(xzp)) 3640 *valp = 1; 3641 VN_RELE(ZTOV(xzp)); --- 23 unchanged lines hidden (view full) --- 3665/*ARGSUSED*/ 3666static int 3667zfs_getsecattr(vnode_t *vp, vsecattr_t *vsecp, int flag, cred_t *cr) 3668{ 3669 znode_t *zp = VTOZ(vp); 3670 zfsvfs_t *zfsvfs = zp->z_zfsvfs; 3671 int error; 3672 |
3650 ZFS_ENTER(zfsvfs); | 3673 ZFS_ENTER_VERIFY_ZP(zfsvfs, zp); |
3651 error = zfs_getacl(zp, vsecp, cr); 3652 ZFS_EXIT(zfsvfs); 3653 3654 return (error); 3655} 3656 3657/*ARGSUSED*/ 3658static int 3659zfs_setsecattr(vnode_t *vp, vsecattr_t *vsecp, int flag, cred_t *cr) 3660{ 3661 znode_t *zp = VTOZ(vp); 3662 zfsvfs_t *zfsvfs = zp->z_zfsvfs; 3663 int error; 3664 | 3674 error = zfs_getacl(zp, vsecp, cr); 3675 ZFS_EXIT(zfsvfs); 3676 3677 return (error); 3678} 3679 3680/*ARGSUSED*/ 3681static int 3682zfs_setsecattr(vnode_t *vp, vsecattr_t *vsecp, int flag, cred_t *cr) 3683{ 3684 znode_t *zp = VTOZ(vp); 3685 zfsvfs_t *zfsvfs = zp->z_zfsvfs; 3686 int error; 3687 |
3665 ZFS_ENTER(zfsvfs); | 3688 ZFS_ENTER_VERIFY_ZP(zfsvfs, zp); |
3666 error = zfs_setacl(zp, vsecp, cr); 3667 ZFS_EXIT(zfsvfs); 3668 return (error); 3669} 3670 3671/* 3672 * Predeclare these here so that the compiler assumes that 3673 * this is an "old style" function declaration that does --- 148 unchanged lines hidden --- | 3689 error = zfs_setacl(zp, vsecp, cr); 3690 ZFS_EXIT(zfsvfs); 3691 return (error); 3692} 3693 3694/* 3695 * Predeclare these here so that the compiler assumes that 3696 * this is an "old style" function declaration that does --- 148 unchanged lines hidden --- |