diff options
Diffstat (limited to 'fs/xfs/xfs_vnodeops.c')
-rw-r--r-- | fs/xfs/xfs_vnodeops.c | 59 |
1 files changed, 29 insertions, 30 deletions
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index 8076cc981e11..eaab355f5a89 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -338,7 +338,7 @@ xfs_setattr( | |||
338 | code = XFS_QM_DQVOPALLOC(mp, ip, uid, gid, projid, qflags, | 338 | code = XFS_QM_DQVOPALLOC(mp, ip, uid, gid, projid, qflags, |
339 | &udqp, &gdqp); | 339 | &udqp, &gdqp); |
340 | if (code) | 340 | if (code) |
341 | return (code); | 341 | return code; |
342 | } | 342 | } |
343 | 343 | ||
344 | /* | 344 | /* |
@@ -1027,11 +1027,8 @@ xfs_readlink( | |||
1027 | 1027 | ||
1028 | } | 1028 | } |
1029 | 1029 | ||
1030 | |||
1031 | error_return: | 1030 | error_return: |
1032 | |||
1033 | xfs_iunlock(ip, XFS_ILOCK_SHARED); | 1031 | xfs_iunlock(ip, XFS_ILOCK_SHARED); |
1034 | |||
1035 | return error; | 1032 | return error; |
1036 | } | 1033 | } |
1037 | 1034 | ||
@@ -1206,7 +1203,7 @@ xfs_inactive_free_eofblocks( | |||
1206 | last_fsb = XFS_B_TO_FSB(mp, (xfs_ufsize_t)XFS_MAXIOFFSET(mp)); | 1203 | last_fsb = XFS_B_TO_FSB(mp, (xfs_ufsize_t)XFS_MAXIOFFSET(mp)); |
1207 | map_len = last_fsb - end_fsb; | 1204 | map_len = last_fsb - end_fsb; |
1208 | if (map_len <= 0) | 1205 | if (map_len <= 0) |
1209 | return (0); | 1206 | return 0; |
1210 | 1207 | ||
1211 | nimaps = 1; | 1208 | nimaps = 1; |
1212 | xfs_ilock(ip, XFS_ILOCK_SHARED); | 1209 | xfs_ilock(ip, XFS_ILOCK_SHARED); |
@@ -1221,7 +1218,7 @@ xfs_inactive_free_eofblocks( | |||
1221 | * Attach the dquots to the inode up front. | 1218 | * Attach the dquots to the inode up front. |
1222 | */ | 1219 | */ |
1223 | if ((error = XFS_QM_DQATTACH(mp, ip, 0))) | 1220 | if ((error = XFS_QM_DQATTACH(mp, ip, 0))) |
1224 | return (error); | 1221 | return error; |
1225 | 1222 | ||
1226 | /* | 1223 | /* |
1227 | * There are blocks after the end of file. | 1224 | * There are blocks after the end of file. |
@@ -1249,7 +1246,7 @@ xfs_inactive_free_eofblocks( | |||
1249 | ASSERT(XFS_FORCED_SHUTDOWN(mp)); | 1246 | ASSERT(XFS_FORCED_SHUTDOWN(mp)); |
1250 | xfs_trans_cancel(tp, 0); | 1247 | xfs_trans_cancel(tp, 0); |
1251 | xfs_iunlock(ip, XFS_IOLOCK_EXCL); | 1248 | xfs_iunlock(ip, XFS_IOLOCK_EXCL); |
1252 | return (error); | 1249 | return error; |
1253 | } | 1250 | } |
1254 | 1251 | ||
1255 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 1252 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
@@ -1277,7 +1274,7 @@ xfs_inactive_free_eofblocks( | |||
1277 | } | 1274 | } |
1278 | xfs_iunlock(ip, XFS_IOLOCK_EXCL | XFS_ILOCK_EXCL); | 1275 | xfs_iunlock(ip, XFS_IOLOCK_EXCL | XFS_ILOCK_EXCL); |
1279 | } | 1276 | } |
1280 | return (error); | 1277 | return error; |
1281 | } | 1278 | } |
1282 | 1279 | ||
1283 | /* | 1280 | /* |
@@ -1455,7 +1452,7 @@ xfs_inactive_symlink_local( | |||
1455 | if (error) { | 1452 | if (error) { |
1456 | xfs_trans_cancel(*tpp, 0); | 1453 | xfs_trans_cancel(*tpp, 0); |
1457 | *tpp = NULL; | 1454 | *tpp = NULL; |
1458 | return (error); | 1455 | return error; |
1459 | } | 1456 | } |
1460 | xfs_ilock(ip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL); | 1457 | xfs_ilock(ip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL); |
1461 | 1458 | ||
@@ -1468,7 +1465,7 @@ xfs_inactive_symlink_local( | |||
1468 | XFS_DATA_FORK); | 1465 | XFS_DATA_FORK); |
1469 | ASSERT(ip->i_df.if_bytes == 0); | 1466 | ASSERT(ip->i_df.if_bytes == 0); |
1470 | } | 1467 | } |
1471 | return (0); | 1468 | return 0; |
1472 | } | 1469 | } |
1473 | 1470 | ||
1474 | /* | 1471 | /* |
@@ -1494,7 +1491,7 @@ xfs_inactive_attrs( | |||
1494 | if (error) { | 1491 | if (error) { |
1495 | *tpp = NULL; | 1492 | *tpp = NULL; |
1496 | xfs_iunlock(ip, XFS_IOLOCK_EXCL); | 1493 | xfs_iunlock(ip, XFS_IOLOCK_EXCL); |
1497 | return (error); /* goto out*/ | 1494 | return error; /* goto out */ |
1498 | } | 1495 | } |
1499 | 1496 | ||
1500 | tp = xfs_trans_alloc(mp, XFS_TRANS_INACTIVE); | 1497 | tp = xfs_trans_alloc(mp, XFS_TRANS_INACTIVE); |
@@ -1507,7 +1504,7 @@ xfs_inactive_attrs( | |||
1507 | xfs_trans_cancel(tp, 0); | 1504 | xfs_trans_cancel(tp, 0); |
1508 | *tpp = NULL; | 1505 | *tpp = NULL; |
1509 | xfs_iunlock(ip, XFS_IOLOCK_EXCL); | 1506 | xfs_iunlock(ip, XFS_IOLOCK_EXCL); |
1510 | return (error); | 1507 | return error; |
1511 | } | 1508 | } |
1512 | 1509 | ||
1513 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 1510 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
@@ -1518,7 +1515,7 @@ xfs_inactive_attrs( | |||
1518 | ASSERT(ip->i_d.di_anextents == 0); | 1515 | ASSERT(ip->i_d.di_anextents == 0); |
1519 | 1516 | ||
1520 | *tpp = tp; | 1517 | *tpp = tp; |
1521 | return (0); | 1518 | return 0; |
1522 | } | 1519 | } |
1523 | 1520 | ||
1524 | STATIC int | 1521 | STATIC int |
@@ -1557,7 +1554,7 @@ xfs_release( | |||
1557 | (!(ip->i_d.di_flags & | 1554 | (!(ip->i_d.di_flags & |
1558 | (XFS_DIFLAG_PREALLOC | XFS_DIFLAG_APPEND)))) { | 1555 | (XFS_DIFLAG_PREALLOC | XFS_DIFLAG_APPEND)))) { |
1559 | if ((error = xfs_inactive_free_eofblocks(mp, ip))) | 1556 | if ((error = xfs_inactive_free_eofblocks(mp, ip))) |
1560 | return (error); | 1557 | return error; |
1561 | /* Update linux inode block count after free above */ | 1558 | /* Update linux inode block count after free above */ |
1562 | LINVFS_GET_IP(vp)->i_blocks = XFS_FSB_TO_BB(mp, | 1559 | LINVFS_GET_IP(vp)->i_blocks = XFS_FSB_TO_BB(mp, |
1563 | ip->i_d.di_nblocks + ip->i_delayed_blks); | 1560 | ip->i_d.di_nblocks + ip->i_delayed_blks); |
@@ -1638,7 +1635,7 @@ xfs_inactive( | |||
1638 | (XFS_DIFLAG_PREALLOC | XFS_DIFLAG_APPEND)) || | 1635 | (XFS_DIFLAG_PREALLOC | XFS_DIFLAG_APPEND)) || |
1639 | (ip->i_delayed_blks != 0)))) { | 1636 | (ip->i_delayed_blks != 0)))) { |
1640 | if ((error = xfs_inactive_free_eofblocks(mp, ip))) | 1637 | if ((error = xfs_inactive_free_eofblocks(mp, ip))) |
1641 | return (VN_INACTIVE_CACHE); | 1638 | return VN_INACTIVE_CACHE; |
1642 | /* Update linux inode block count after free above */ | 1639 | /* Update linux inode block count after free above */ |
1643 | LINVFS_GET_IP(vp)->i_blocks = XFS_FSB_TO_BB(mp, | 1640 | LINVFS_GET_IP(vp)->i_blocks = XFS_FSB_TO_BB(mp, |
1644 | ip->i_d.di_nblocks + ip->i_delayed_blks); | 1641 | ip->i_d.di_nblocks + ip->i_delayed_blks); |
@@ -1649,7 +1646,7 @@ xfs_inactive( | |||
1649 | ASSERT(ip->i_d.di_nlink == 0); | 1646 | ASSERT(ip->i_d.di_nlink == 0); |
1650 | 1647 | ||
1651 | if ((error = XFS_QM_DQATTACH(mp, ip, 0))) | 1648 | if ((error = XFS_QM_DQATTACH(mp, ip, 0))) |
1652 | return (VN_INACTIVE_CACHE); | 1649 | return VN_INACTIVE_CACHE; |
1653 | 1650 | ||
1654 | tp = xfs_trans_alloc(mp, XFS_TRANS_INACTIVE); | 1651 | tp = xfs_trans_alloc(mp, XFS_TRANS_INACTIVE); |
1655 | if (truncate) { | 1652 | if (truncate) { |
@@ -1672,7 +1669,7 @@ xfs_inactive( | |||
1672 | ASSERT(XFS_FORCED_SHUTDOWN(mp)); | 1669 | ASSERT(XFS_FORCED_SHUTDOWN(mp)); |
1673 | xfs_trans_cancel(tp, 0); | 1670 | xfs_trans_cancel(tp, 0); |
1674 | xfs_iunlock(ip, XFS_IOLOCK_EXCL); | 1671 | xfs_iunlock(ip, XFS_IOLOCK_EXCL); |
1675 | return (VN_INACTIVE_CACHE); | 1672 | return VN_INACTIVE_CACHE; |
1676 | } | 1673 | } |
1677 | 1674 | ||
1678 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 1675 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
@@ -1693,7 +1690,7 @@ xfs_inactive( | |||
1693 | xfs_trans_cancel(tp, | 1690 | xfs_trans_cancel(tp, |
1694 | XFS_TRANS_RELEASE_LOG_RES | XFS_TRANS_ABORT); | 1691 | XFS_TRANS_RELEASE_LOG_RES | XFS_TRANS_ABORT); |
1695 | xfs_iunlock(ip, XFS_IOLOCK_EXCL | XFS_ILOCK_EXCL); | 1692 | xfs_iunlock(ip, XFS_IOLOCK_EXCL | XFS_ILOCK_EXCL); |
1696 | return (VN_INACTIVE_CACHE); | 1693 | return VN_INACTIVE_CACHE; |
1697 | } | 1694 | } |
1698 | } else if ((ip->i_d.di_mode & S_IFMT) == S_IFLNK) { | 1695 | } else if ((ip->i_d.di_mode & S_IFMT) == S_IFLNK) { |
1699 | 1696 | ||
@@ -1707,7 +1704,7 @@ xfs_inactive( | |||
1707 | 1704 | ||
1708 | if (error) { | 1705 | if (error) { |
1709 | ASSERT(tp == NULL); | 1706 | ASSERT(tp == NULL); |
1710 | return (VN_INACTIVE_CACHE); | 1707 | return VN_INACTIVE_CACHE; |
1711 | } | 1708 | } |
1712 | 1709 | ||
1713 | xfs_trans_ijoin(tp, ip, XFS_IOLOCK_EXCL | XFS_ILOCK_EXCL); | 1710 | xfs_trans_ijoin(tp, ip, XFS_IOLOCK_EXCL | XFS_ILOCK_EXCL); |
@@ -1720,7 +1717,7 @@ xfs_inactive( | |||
1720 | if (error) { | 1717 | if (error) { |
1721 | ASSERT(XFS_FORCED_SHUTDOWN(mp)); | 1718 | ASSERT(XFS_FORCED_SHUTDOWN(mp)); |
1722 | xfs_trans_cancel(tp, 0); | 1719 | xfs_trans_cancel(tp, 0); |
1723 | return (VN_INACTIVE_CACHE); | 1720 | return VN_INACTIVE_CACHE; |
1724 | } | 1721 | } |
1725 | 1722 | ||
1726 | xfs_ilock(ip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL); | 1723 | xfs_ilock(ip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL); |
@@ -1742,7 +1739,7 @@ xfs_inactive( | |||
1742 | * cancelled, and the inode is unlocked. Just get out. | 1739 | * cancelled, and the inode is unlocked. Just get out. |
1743 | */ | 1740 | */ |
1744 | if (error) | 1741 | if (error) |
1745 | return (VN_INACTIVE_CACHE); | 1742 | return VN_INACTIVE_CACHE; |
1746 | } else if (ip->i_afp) { | 1743 | } else if (ip->i_afp) { |
1747 | xfs_idestroy_fork(ip, XFS_ATTR_FORK); | 1744 | xfs_idestroy_fork(ip, XFS_ATTR_FORK); |
1748 | } | 1745 | } |
@@ -2049,8 +2046,8 @@ std_return: | |||
2049 | abort_return: | 2046 | abort_return: |
2050 | cancel_flags |= XFS_TRANS_ABORT; | 2047 | cancel_flags |= XFS_TRANS_ABORT; |
2051 | /* FALLTHROUGH */ | 2048 | /* FALLTHROUGH */ |
2052 | error_return: | ||
2053 | 2049 | ||
2050 | error_return: | ||
2054 | if (tp != NULL) | 2051 | if (tp != NULL) |
2055 | xfs_trans_cancel(tp, cancel_flags); | 2052 | xfs_trans_cancel(tp, cancel_flags); |
2056 | 2053 | ||
@@ -2724,9 +2721,9 @@ std_return: | |||
2724 | abort_return: | 2721 | abort_return: |
2725 | cancel_flags |= XFS_TRANS_ABORT; | 2722 | cancel_flags |= XFS_TRANS_ABORT; |
2726 | /* FALLTHROUGH */ | 2723 | /* FALLTHROUGH */ |
2724 | |||
2727 | error_return: | 2725 | error_return: |
2728 | xfs_trans_cancel(tp, cancel_flags); | 2726 | xfs_trans_cancel(tp, cancel_flags); |
2729 | |||
2730 | goto std_return; | 2727 | goto std_return; |
2731 | } | 2728 | } |
2732 | /* | 2729 | /* |
@@ -3199,10 +3196,12 @@ std_return: | |||
3199 | } | 3196 | } |
3200 | return error; | 3197 | return error; |
3201 | 3198 | ||
3202 | error1: | 3199 | error1: |
3203 | xfs_bmap_cancel(&free_list); | 3200 | xfs_bmap_cancel(&free_list); |
3204 | cancel_flags |= XFS_TRANS_ABORT; | 3201 | cancel_flags |= XFS_TRANS_ABORT; |
3205 | error_return: | 3202 | /* FALLTHROUGH */ |
3203 | |||
3204 | error_return: | ||
3206 | xfs_trans_cancel(tp, cancel_flags); | 3205 | xfs_trans_cancel(tp, cancel_flags); |
3207 | goto std_return; | 3206 | goto std_return; |
3208 | } | 3207 | } |
@@ -3618,9 +3617,9 @@ xfs_rwlock( | |||
3618 | if (locktype == VRWLOCK_WRITE) { | 3617 | if (locktype == VRWLOCK_WRITE) { |
3619 | xfs_ilock(ip, XFS_IOLOCK_EXCL); | 3618 | xfs_ilock(ip, XFS_IOLOCK_EXCL); |
3620 | } else if (locktype == VRWLOCK_TRY_READ) { | 3619 | } else if (locktype == VRWLOCK_TRY_READ) { |
3621 | return (xfs_ilock_nowait(ip, XFS_IOLOCK_SHARED)); | 3620 | return xfs_ilock_nowait(ip, XFS_IOLOCK_SHARED); |
3622 | } else if (locktype == VRWLOCK_TRY_WRITE) { | 3621 | } else if (locktype == VRWLOCK_TRY_WRITE) { |
3623 | return (xfs_ilock_nowait(ip, XFS_IOLOCK_EXCL)); | 3622 | return xfs_ilock_nowait(ip, XFS_IOLOCK_EXCL); |
3624 | } else { | 3623 | } else { |
3625 | ASSERT((locktype == VRWLOCK_READ) || | 3624 | ASSERT((locktype == VRWLOCK_READ) || |
3626 | (locktype == VRWLOCK_WRITE_DIRECT)); | 3625 | (locktype == VRWLOCK_WRITE_DIRECT)); |
@@ -3868,7 +3867,7 @@ xfs_finish_reclaim( | |||
3868 | xfs_ifunlock(ip); | 3867 | xfs_ifunlock(ip); |
3869 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | 3868 | xfs_iunlock(ip, XFS_ILOCK_EXCL); |
3870 | } | 3869 | } |
3871 | return(1); | 3870 | return 1; |
3872 | } | 3871 | } |
3873 | ip->i_flags |= XFS_IRECLAIM; | 3872 | ip->i_flags |= XFS_IRECLAIM; |
3874 | write_unlock(&ih->ih_lock); | 3873 | write_unlock(&ih->ih_lock); |
@@ -4045,7 +4044,7 @@ xfs_alloc_file_space( | |||
4045 | offset, end_dmi_offset - offset, | 4044 | offset, end_dmi_offset - offset, |
4046 | 0, NULL); | 4045 | 0, NULL); |
4047 | if (error) | 4046 | if (error) |
4048 | return(error); | 4047 | return error; |
4049 | } | 4048 | } |
4050 | 4049 | ||
4051 | /* | 4050 | /* |
@@ -4305,7 +4304,7 @@ xfs_free_file_space( | |||
4305 | offset, end_dmi_offset - offset, | 4304 | offset, end_dmi_offset - offset, |
4306 | AT_DELAY_FLAG(attr_flags), NULL); | 4305 | AT_DELAY_FLAG(attr_flags), NULL); |
4307 | if (error) | 4306 | if (error) |
4308 | return(error); | 4307 | return error; |
4309 | } | 4308 | } |
4310 | 4309 | ||
4311 | ASSERT(attr_flags & ATTR_NOLOCK ? attr_flags & ATTR_DMI : 1); | 4310 | ASSERT(attr_flags & ATTR_NOLOCK ? attr_flags & ATTR_DMI : 1); |