diff options
Diffstat (limited to 'fs/xfs/xfs_vnodeops.c')
-rw-r--r-- | fs/xfs/xfs_vnodeops.c | 125 |
1 files changed, 72 insertions, 53 deletions
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index 52c41714ec54..de17aed578f0 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -133,7 +133,7 @@ xfs_getattr( | |||
133 | if (!(flags & ATTR_LAZY)) | 133 | if (!(flags & ATTR_LAZY)) |
134 | xfs_ilock(ip, XFS_ILOCK_SHARED); | 134 | xfs_ilock(ip, XFS_ILOCK_SHARED); |
135 | 135 | ||
136 | vap->va_size = ip->i_d.di_size; | 136 | vap->va_size = XFS_ISIZE(ip); |
137 | if (vap->va_mask == XFS_AT_SIZE) | 137 | if (vap->va_mask == XFS_AT_SIZE) |
138 | goto all_done; | 138 | goto all_done; |
139 | 139 | ||
@@ -496,7 +496,7 @@ xfs_setattr( | |||
496 | if (mask & XFS_AT_SIZE) { | 496 | if (mask & XFS_AT_SIZE) { |
497 | /* Short circuit the truncate case for zero length files */ | 497 | /* Short circuit the truncate case for zero length files */ |
498 | if ((vap->va_size == 0) && | 498 | if ((vap->va_size == 0) && |
499 | (ip->i_d.di_size == 0) && (ip->i_d.di_nextents == 0)) { | 499 | (ip->i_size == 0) && (ip->i_d.di_nextents == 0)) { |
500 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | 500 | xfs_iunlock(ip, XFS_ILOCK_EXCL); |
501 | lock_flags &= ~XFS_ILOCK_EXCL; | 501 | lock_flags &= ~XFS_ILOCK_EXCL; |
502 | if (mask & XFS_AT_CTIME) | 502 | if (mask & XFS_AT_CTIME) |
@@ -614,7 +614,7 @@ xfs_setattr( | |||
614 | */ | 614 | */ |
615 | if (mask & XFS_AT_SIZE) { | 615 | if (mask & XFS_AT_SIZE) { |
616 | code = 0; | 616 | code = 0; |
617 | if ((vap->va_size > ip->i_d.di_size) && | 617 | if ((vap->va_size > ip->i_size) && |
618 | (flags & ATTR_NOSIZETOK) == 0) { | 618 | (flags & ATTR_NOSIZETOK) == 0) { |
619 | code = xfs_igrow_start(ip, vap->va_size, credp); | 619 | code = xfs_igrow_start(ip, vap->va_size, credp); |
620 | } | 620 | } |
@@ -654,10 +654,10 @@ xfs_setattr( | |||
654 | * Truncate file. Must have write permission and not be a directory. | 654 | * Truncate file. Must have write permission and not be a directory. |
655 | */ | 655 | */ |
656 | if (mask & XFS_AT_SIZE) { | 656 | if (mask & XFS_AT_SIZE) { |
657 | if (vap->va_size > ip->i_d.di_size) { | 657 | if (vap->va_size > ip->i_size) { |
658 | xfs_igrow_finish(tp, ip, vap->va_size, | 658 | xfs_igrow_finish(tp, ip, vap->va_size, |
659 | !(flags & ATTR_DMI)); | 659 | !(flags & ATTR_DMI)); |
660 | } else if ((vap->va_size <= ip->i_d.di_size) || | 660 | } else if ((vap->va_size <= ip->i_size) || |
661 | ((vap->va_size == 0) && ip->i_d.di_nextents)) { | 661 | ((vap->va_size == 0) && ip->i_d.di_nextents)) { |
662 | /* | 662 | /* |
663 | * signal a sync transaction unless | 663 | * signal a sync transaction unless |
@@ -873,7 +873,7 @@ xfs_setattr( | |||
873 | if (mp->m_flags & XFS_MOUNT_WSYNC) | 873 | if (mp->m_flags & XFS_MOUNT_WSYNC) |
874 | xfs_trans_set_sync(tp); | 874 | xfs_trans_set_sync(tp); |
875 | 875 | ||
876 | code = xfs_trans_commit(tp, commit_flags, NULL); | 876 | code = xfs_trans_commit(tp, commit_flags); |
877 | } | 877 | } |
878 | 878 | ||
879 | /* | 879 | /* |
@@ -1176,7 +1176,7 @@ xfs_fsync( | |||
1176 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | 1176 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); |
1177 | if (flag & FSYNC_WAIT) | 1177 | if (flag & FSYNC_WAIT) |
1178 | xfs_trans_set_sync(tp); | 1178 | xfs_trans_set_sync(tp); |
1179 | error = _xfs_trans_commit(tp, 0, NULL, &log_flushed); | 1179 | error = _xfs_trans_commit(tp, 0, &log_flushed); |
1180 | 1180 | ||
1181 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | 1181 | xfs_iunlock(ip, XFS_ILOCK_EXCL); |
1182 | } | 1182 | } |
@@ -1221,7 +1221,7 @@ xfs_inactive_free_eofblocks( | |||
1221 | * Figure out if there are any blocks beyond the end | 1221 | * Figure out if there are any blocks beyond the end |
1222 | * of the file. If not, then there is nothing to do. | 1222 | * of the file. If not, then there is nothing to do. |
1223 | */ | 1223 | */ |
1224 | end_fsb = XFS_B_TO_FSB(mp, ((xfs_ufsize_t)ip->i_d.di_size)); | 1224 | end_fsb = XFS_B_TO_FSB(mp, ((xfs_ufsize_t)ip->i_size)); |
1225 | last_fsb = XFS_B_TO_FSB(mp, (xfs_ufsize_t)XFS_MAXIOFFSET(mp)); | 1225 | last_fsb = XFS_B_TO_FSB(mp, (xfs_ufsize_t)XFS_MAXIOFFSET(mp)); |
1226 | map_len = last_fsb - end_fsb; | 1226 | map_len = last_fsb - end_fsb; |
1227 | if (map_len <= 0) | 1227 | if (map_len <= 0) |
@@ -1257,8 +1257,12 @@ xfs_inactive_free_eofblocks( | |||
1257 | * do that within a transaction. | 1257 | * do that within a transaction. |
1258 | */ | 1258 | */ |
1259 | xfs_ilock(ip, XFS_IOLOCK_EXCL); | 1259 | xfs_ilock(ip, XFS_IOLOCK_EXCL); |
1260 | xfs_itruncate_start(ip, XFS_ITRUNC_DEFINITE, | 1260 | error = xfs_itruncate_start(ip, XFS_ITRUNC_DEFINITE, |
1261 | ip->i_d.di_size); | 1261 | ip->i_size); |
1262 | if (error) { | ||
1263 | xfs_iunlock(ip, XFS_IOLOCK_EXCL); | ||
1264 | return error; | ||
1265 | } | ||
1262 | 1266 | ||
1263 | error = xfs_trans_reserve(tp, 0, | 1267 | error = xfs_trans_reserve(tp, 0, |
1264 | XFS_ITRUNCATE_LOG_RES(mp), | 1268 | XFS_ITRUNCATE_LOG_RES(mp), |
@@ -1278,7 +1282,7 @@ xfs_inactive_free_eofblocks( | |||
1278 | xfs_trans_ihold(tp, ip); | 1282 | xfs_trans_ihold(tp, ip); |
1279 | 1283 | ||
1280 | error = xfs_itruncate_finish(&tp, ip, | 1284 | error = xfs_itruncate_finish(&tp, ip, |
1281 | ip->i_d.di_size, | 1285 | ip->i_size, |
1282 | XFS_DATA_FORK, | 1286 | XFS_DATA_FORK, |
1283 | 0); | 1287 | 0); |
1284 | /* | 1288 | /* |
@@ -1291,8 +1295,7 @@ xfs_inactive_free_eofblocks( | |||
1291 | XFS_TRANS_ABORT)); | 1295 | XFS_TRANS_ABORT)); |
1292 | } else { | 1296 | } else { |
1293 | error = xfs_trans_commit(tp, | 1297 | error = xfs_trans_commit(tp, |
1294 | XFS_TRANS_RELEASE_LOG_RES, | 1298 | XFS_TRANS_RELEASE_LOG_RES); |
1295 | NULL); | ||
1296 | } | 1299 | } |
1297 | xfs_iunlock(ip, XFS_IOLOCK_EXCL | XFS_ILOCK_EXCL); | 1300 | xfs_iunlock(ip, XFS_IOLOCK_EXCL | XFS_ILOCK_EXCL); |
1298 | } | 1301 | } |
@@ -1406,7 +1409,7 @@ xfs_inactive_symlink_rmt( | |||
1406 | * we need to unlock the inode since the new transaction doesn't | 1409 | * we need to unlock the inode since the new transaction doesn't |
1407 | * have the inode attached. | 1410 | * have the inode attached. |
1408 | */ | 1411 | */ |
1409 | error = xfs_trans_commit(tp, 0, NULL); | 1412 | error = xfs_trans_commit(tp, 0); |
1410 | tp = ntp; | 1413 | tp = ntp; |
1411 | if (error) { | 1414 | if (error) { |
1412 | ASSERT(XFS_FORCED_SHUTDOWN(mp)); | 1415 | ASSERT(XFS_FORCED_SHUTDOWN(mp)); |
@@ -1503,7 +1506,7 @@ xfs_inactive_attrs( | |||
1503 | tp = *tpp; | 1506 | tp = *tpp; |
1504 | mp = ip->i_mount; | 1507 | mp = ip->i_mount; |
1505 | ASSERT(ip->i_d.di_forkoff != 0); | 1508 | ASSERT(ip->i_d.di_forkoff != 0); |
1506 | xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES, NULL); | 1509 | xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); |
1507 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | 1510 | xfs_iunlock(ip, XFS_ILOCK_EXCL); |
1508 | 1511 | ||
1509 | error = xfs_attr_inactive(ip); | 1512 | error = xfs_attr_inactive(ip); |
@@ -1565,7 +1568,7 @@ xfs_release( | |||
1565 | 1568 | ||
1566 | if (ip->i_d.di_nlink != 0) { | 1569 | if (ip->i_d.di_nlink != 0) { |
1567 | if ((((ip->i_d.di_mode & S_IFMT) == S_IFREG) && | 1570 | if ((((ip->i_d.di_mode & S_IFMT) == S_IFREG) && |
1568 | ((ip->i_d.di_size > 0) || (VN_CACHED(vp) > 0 || | 1571 | ((ip->i_size > 0) || (VN_CACHED(vp) > 0 || |
1569 | ip->i_delayed_blks > 0)) && | 1572 | ip->i_delayed_blks > 0)) && |
1570 | (ip->i_df.if_flags & XFS_IFEXTENTS)) && | 1573 | (ip->i_df.if_flags & XFS_IFEXTENTS)) && |
1571 | (!(ip->i_d.di_flags & | 1574 | (!(ip->i_d.di_flags & |
@@ -1626,8 +1629,8 @@ xfs_inactive( | |||
1626 | * only one with a reference to the inode. | 1629 | * only one with a reference to the inode. |
1627 | */ | 1630 | */ |
1628 | truncate = ((ip->i_d.di_nlink == 0) && | 1631 | truncate = ((ip->i_d.di_nlink == 0) && |
1629 | ((ip->i_d.di_size != 0) || (ip->i_d.di_nextents > 0) || | 1632 | ((ip->i_d.di_size != 0) || (ip->i_size != 0) || |
1630 | (ip->i_delayed_blks > 0)) && | 1633 | (ip->i_d.di_nextents > 0) || (ip->i_delayed_blks > 0)) && |
1631 | ((ip->i_d.di_mode & S_IFMT) == S_IFREG)); | 1634 | ((ip->i_d.di_mode & S_IFMT) == S_IFREG)); |
1632 | 1635 | ||
1633 | mp = ip->i_mount; | 1636 | mp = ip->i_mount; |
@@ -1645,7 +1648,7 @@ xfs_inactive( | |||
1645 | 1648 | ||
1646 | if (ip->i_d.di_nlink != 0) { | 1649 | if (ip->i_d.di_nlink != 0) { |
1647 | if ((((ip->i_d.di_mode & S_IFMT) == S_IFREG) && | 1650 | if ((((ip->i_d.di_mode & S_IFMT) == S_IFREG) && |
1648 | ((ip->i_d.di_size > 0) || (VN_CACHED(vp) > 0 || | 1651 | ((ip->i_size > 0) || (VN_CACHED(vp) > 0 || |
1649 | ip->i_delayed_blks > 0)) && | 1652 | ip->i_delayed_blks > 0)) && |
1650 | (ip->i_df.if_flags & XFS_IFEXTENTS) && | 1653 | (ip->i_df.if_flags & XFS_IFEXTENTS) && |
1651 | (!(ip->i_d.di_flags & | 1654 | (!(ip->i_d.di_flags & |
@@ -1675,7 +1678,11 @@ xfs_inactive( | |||
1675 | */ | 1678 | */ |
1676 | xfs_ilock(ip, XFS_IOLOCK_EXCL); | 1679 | xfs_ilock(ip, XFS_IOLOCK_EXCL); |
1677 | 1680 | ||
1678 | xfs_itruncate_start(ip, XFS_ITRUNC_DEFINITE, 0); | 1681 | error = xfs_itruncate_start(ip, XFS_ITRUNC_DEFINITE, 0); |
1682 | if (error) { | ||
1683 | xfs_iunlock(ip, XFS_IOLOCK_EXCL); | ||
1684 | return VN_INACTIVE_CACHE; | ||
1685 | } | ||
1679 | 1686 | ||
1680 | error = xfs_trans_reserve(tp, 0, | 1687 | error = xfs_trans_reserve(tp, 0, |
1681 | XFS_ITRUNCATE_LOG_RES(mp), | 1688 | XFS_ITRUNCATE_LOG_RES(mp), |
@@ -1790,7 +1797,7 @@ xfs_inactive( | |||
1790 | * nothing we can do except to try to keep going. | 1797 | * nothing we can do except to try to keep going. |
1791 | */ | 1798 | */ |
1792 | (void) xfs_bmap_finish(&tp, &free_list, &committed); | 1799 | (void) xfs_bmap_finish(&tp, &free_list, &committed); |
1793 | (void) xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES, NULL); | 1800 | (void) xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); |
1794 | } | 1801 | } |
1795 | /* | 1802 | /* |
1796 | * Release the dquots held by inode, if any. | 1803 | * Release the dquots held by inode, if any. |
@@ -1940,7 +1947,7 @@ xfs_create( | |||
1940 | goto error_return; | 1947 | goto error_return; |
1941 | } | 1948 | } |
1942 | 1949 | ||
1943 | xfs_ilock(dp, XFS_ILOCK_EXCL); | 1950 | xfs_ilock(dp, XFS_ILOCK_EXCL | XFS_ILOCK_PARENT); |
1944 | 1951 | ||
1945 | XFS_BMAP_INIT(&free_list, &first_block); | 1952 | XFS_BMAP_INIT(&free_list, &first_block); |
1946 | 1953 | ||
@@ -2026,7 +2033,7 @@ xfs_create( | |||
2026 | goto abort_rele; | 2033 | goto abort_rele; |
2027 | } | 2034 | } |
2028 | 2035 | ||
2029 | error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES, NULL); | 2036 | error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); |
2030 | if (error) { | 2037 | if (error) { |
2031 | IRELE(ip); | 2038 | IRELE(ip); |
2032 | tp = NULL; | 2039 | tp = NULL; |
@@ -2121,7 +2128,6 @@ int xfs_rm_attempts; | |||
2121 | STATIC int | 2128 | STATIC int |
2122 | xfs_lock_dir_and_entry( | 2129 | xfs_lock_dir_and_entry( |
2123 | xfs_inode_t *dp, | 2130 | xfs_inode_t *dp, |
2124 | bhv_vname_t *dentry, | ||
2125 | xfs_inode_t *ip) /* inode of entry 'name' */ | 2131 | xfs_inode_t *ip) /* inode of entry 'name' */ |
2126 | { | 2132 | { |
2127 | int attempts; | 2133 | int attempts; |
@@ -2135,7 +2141,7 @@ xfs_lock_dir_and_entry( | |||
2135 | attempts = 0; | 2141 | attempts = 0; |
2136 | 2142 | ||
2137 | again: | 2143 | again: |
2138 | xfs_ilock(dp, XFS_ILOCK_EXCL); | 2144 | xfs_ilock(dp, XFS_ILOCK_EXCL | XFS_ILOCK_PARENT); |
2139 | 2145 | ||
2140 | e_inum = ip->i_ino; | 2146 | e_inum = ip->i_ino; |
2141 | 2147 | ||
@@ -2204,6 +2210,21 @@ int xfs_lock_delays; | |||
2204 | #endif | 2210 | #endif |
2205 | 2211 | ||
2206 | /* | 2212 | /* |
2213 | * Bump the subclass so xfs_lock_inodes() acquires each lock with | ||
2214 | * a different value | ||
2215 | */ | ||
2216 | static inline int | ||
2217 | xfs_lock_inumorder(int lock_mode, int subclass) | ||
2218 | { | ||
2219 | if (lock_mode & (XFS_IOLOCK_SHARED|XFS_IOLOCK_EXCL)) | ||
2220 | lock_mode |= (subclass + XFS_IOLOCK_INUMORDER) << XFS_IOLOCK_SHIFT; | ||
2221 | if (lock_mode & (XFS_ILOCK_SHARED|XFS_ILOCK_EXCL)) | ||
2222 | lock_mode |= (subclass + XFS_ILOCK_INUMORDER) << XFS_ILOCK_SHIFT; | ||
2223 | |||
2224 | return lock_mode; | ||
2225 | } | ||
2226 | |||
2227 | /* | ||
2207 | * The following routine will lock n inodes in exclusive mode. | 2228 | * The following routine will lock n inodes in exclusive mode. |
2208 | * We assume the caller calls us with the inodes in i_ino order. | 2229 | * We assume the caller calls us with the inodes in i_ino order. |
2209 | * | 2230 | * |
@@ -2270,7 +2291,7 @@ again: | |||
2270 | * that is in the AIL. | 2291 | * that is in the AIL. |
2271 | */ | 2292 | */ |
2272 | ASSERT(i != 0); | 2293 | ASSERT(i != 0); |
2273 | if (!xfs_ilock_nowait(ips[i], lock_mode)) { | 2294 | if (!xfs_ilock_nowait(ips[i], xfs_lock_inumorder(lock_mode, i))) { |
2274 | attempts++; | 2295 | attempts++; |
2275 | 2296 | ||
2276 | /* | 2297 | /* |
@@ -2305,7 +2326,7 @@ again: | |||
2305 | goto again; | 2326 | goto again; |
2306 | } | 2327 | } |
2307 | } else { | 2328 | } else { |
2308 | xfs_ilock(ips[i], lock_mode); | 2329 | xfs_ilock(ips[i], xfs_lock_inumorder(lock_mode, i)); |
2309 | } | 2330 | } |
2310 | } | 2331 | } |
2311 | 2332 | ||
@@ -2440,7 +2461,7 @@ xfs_remove( | |||
2440 | return error; | 2461 | return error; |
2441 | } | 2462 | } |
2442 | 2463 | ||
2443 | error = xfs_lock_dir_and_entry(dp, dentry, ip); | 2464 | error = xfs_lock_dir_and_entry(dp, ip); |
2444 | if (error) { | 2465 | if (error) { |
2445 | REMOVE_DEBUG_TRACE(__LINE__); | 2466 | REMOVE_DEBUG_TRACE(__LINE__); |
2446 | xfs_trans_cancel(tp, cancel_flags); | 2467 | xfs_trans_cancel(tp, cancel_flags); |
@@ -2511,7 +2532,7 @@ xfs_remove( | |||
2511 | goto error_rele; | 2532 | goto error_rele; |
2512 | } | 2533 | } |
2513 | 2534 | ||
2514 | error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES, NULL); | 2535 | error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); |
2515 | if (error) { | 2536 | if (error) { |
2516 | IRELE(ip); | 2537 | IRELE(ip); |
2517 | goto std_return; | 2538 | goto std_return; |
@@ -2719,7 +2740,7 @@ xfs_link( | |||
2719 | goto abort_return; | 2740 | goto abort_return; |
2720 | } | 2741 | } |
2721 | 2742 | ||
2722 | error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES, NULL); | 2743 | error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); |
2723 | if (error) | 2744 | if (error) |
2724 | goto std_return; | 2745 | goto std_return; |
2725 | 2746 | ||
@@ -2839,7 +2860,7 @@ xfs_mkdir( | |||
2839 | goto error_return; | 2860 | goto error_return; |
2840 | } | 2861 | } |
2841 | 2862 | ||
2842 | xfs_ilock(dp, XFS_ILOCK_EXCL); | 2863 | xfs_ilock(dp, XFS_ILOCK_EXCL | XFS_ILOCK_PARENT); |
2843 | 2864 | ||
2844 | /* | 2865 | /* |
2845 | * Check for directory link count overflow. | 2866 | * Check for directory link count overflow. |
@@ -2936,7 +2957,7 @@ xfs_mkdir( | |||
2936 | goto error2; | 2957 | goto error2; |
2937 | } | 2958 | } |
2938 | 2959 | ||
2939 | error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES, NULL); | 2960 | error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); |
2940 | XFS_QM_DQRELE(mp, udqp); | 2961 | XFS_QM_DQRELE(mp, udqp); |
2941 | XFS_QM_DQRELE(mp, gdqp); | 2962 | XFS_QM_DQRELE(mp, gdqp); |
2942 | if (error) { | 2963 | if (error) { |
@@ -3096,7 +3117,7 @@ xfs_rmdir( | |||
3096 | * that the directory entry for the child directory inode has | 3117 | * that the directory entry for the child directory inode has |
3097 | * not changed while we were obtaining a log reservation. | 3118 | * not changed while we were obtaining a log reservation. |
3098 | */ | 3119 | */ |
3099 | error = xfs_lock_dir_and_entry(dp, dentry, cdp); | 3120 | error = xfs_lock_dir_and_entry(dp, cdp); |
3100 | if (error) { | 3121 | if (error) { |
3101 | xfs_trans_cancel(tp, cancel_flags); | 3122 | xfs_trans_cancel(tp, cancel_flags); |
3102 | IRELE(cdp); | 3123 | IRELE(cdp); |
@@ -3190,7 +3211,7 @@ xfs_rmdir( | |||
3190 | goto std_return; | 3211 | goto std_return; |
3191 | } | 3212 | } |
3192 | 3213 | ||
3193 | error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES, NULL); | 3214 | error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); |
3194 | if (error) { | 3215 | if (error) { |
3195 | IRELE(cdp); | 3216 | IRELE(cdp); |
3196 | goto std_return; | 3217 | goto std_return; |
@@ -3393,7 +3414,7 @@ xfs_symlink( | |||
3393 | goto error_return; | 3414 | goto error_return; |
3394 | } | 3415 | } |
3395 | 3416 | ||
3396 | xfs_ilock(dp, XFS_ILOCK_EXCL); | 3417 | xfs_ilock(dp, XFS_ILOCK_EXCL | XFS_ILOCK_PARENT); |
3397 | 3418 | ||
3398 | /* | 3419 | /* |
3399 | * Check whether the directory allows new symlinks or not. | 3420 | * Check whether the directory allows new symlinks or not. |
@@ -3535,7 +3556,7 @@ xfs_symlink( | |||
3535 | if (error) { | 3556 | if (error) { |
3536 | goto error2; | 3557 | goto error2; |
3537 | } | 3558 | } |
3538 | error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES, NULL); | 3559 | error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); |
3539 | XFS_QM_DQRELE(mp, udqp); | 3560 | XFS_QM_DQRELE(mp, udqp); |
3540 | XFS_QM_DQRELE(mp, gdqp); | 3561 | XFS_QM_DQRELE(mp, gdqp); |
3541 | 3562 | ||
@@ -3790,7 +3811,7 @@ xfs_set_dmattrs ( | |||
3790 | 3811 | ||
3791 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | 3812 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); |
3792 | IHOLD(ip); | 3813 | IHOLD(ip); |
3793 | error = xfs_trans_commit(tp, 0, NULL); | 3814 | error = xfs_trans_commit(tp, 0); |
3794 | 3815 | ||
3795 | return error; | 3816 | return error; |
3796 | } | 3817 | } |
@@ -4049,14 +4070,14 @@ xfs_alloc_file_space( | |||
4049 | allocatesize_fsb = XFS_B_TO_FSB(mp, count); | 4070 | allocatesize_fsb = XFS_B_TO_FSB(mp, count); |
4050 | 4071 | ||
4051 | /* Generate a DMAPI event if needed. */ | 4072 | /* Generate a DMAPI event if needed. */ |
4052 | if (alloc_type != 0 && offset < ip->i_d.di_size && | 4073 | if (alloc_type != 0 && offset < ip->i_size && |
4053 | (attr_flags&ATTR_DMI) == 0 && | 4074 | (attr_flags&ATTR_DMI) == 0 && |
4054 | DM_EVENT_ENABLED(XFS_MTOVFS(mp), ip, DM_EVENT_WRITE)) { | 4075 | DM_EVENT_ENABLED(XFS_MTOVFS(mp), ip, DM_EVENT_WRITE)) { |
4055 | xfs_off_t end_dmi_offset; | 4076 | xfs_off_t end_dmi_offset; |
4056 | 4077 | ||
4057 | end_dmi_offset = offset+len; | 4078 | end_dmi_offset = offset+len; |
4058 | if (end_dmi_offset > ip->i_d.di_size) | 4079 | if (end_dmi_offset > ip->i_size) |
4059 | end_dmi_offset = ip->i_d.di_size; | 4080 | end_dmi_offset = ip->i_size; |
4060 | error = XFS_SEND_DATA(mp, DM_EVENT_WRITE, XFS_ITOV(ip), | 4081 | error = XFS_SEND_DATA(mp, DM_EVENT_WRITE, XFS_ITOV(ip), |
4061 | offset, end_dmi_offset - offset, | 4082 | offset, end_dmi_offset - offset, |
4062 | 0, NULL); | 4083 | 0, NULL); |
@@ -4148,7 +4169,7 @@ retry: | |||
4148 | goto error0; | 4169 | goto error0; |
4149 | } | 4170 | } |
4150 | 4171 | ||
4151 | error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES, NULL); | 4172 | error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); |
4152 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | 4173 | xfs_iunlock(ip, XFS_ILOCK_EXCL); |
4153 | if (error) { | 4174 | if (error) { |
4154 | break; | 4175 | break; |
@@ -4283,7 +4304,6 @@ xfs_free_file_space( | |||
4283 | int error; | 4304 | int error; |
4284 | xfs_fsblock_t firstfsb; | 4305 | xfs_fsblock_t firstfsb; |
4285 | xfs_bmap_free_t free_list; | 4306 | xfs_bmap_free_t free_list; |
4286 | xfs_off_t ilen; | ||
4287 | xfs_bmbt_irec_t imap; | 4307 | xfs_bmbt_irec_t imap; |
4288 | xfs_off_t ioffset; | 4308 | xfs_off_t ioffset; |
4289 | xfs_extlen_t mod=0; | 4309 | xfs_extlen_t mod=0; |
@@ -4312,11 +4332,11 @@ xfs_free_file_space( | |||
4312 | end_dmi_offset = offset + len; | 4332 | end_dmi_offset = offset + len; |
4313 | endoffset_fsb = XFS_B_TO_FSBT(mp, end_dmi_offset); | 4333 | endoffset_fsb = XFS_B_TO_FSBT(mp, end_dmi_offset); |
4314 | 4334 | ||
4315 | if (offset < ip->i_d.di_size && | 4335 | if (offset < ip->i_size && |
4316 | (attr_flags & ATTR_DMI) == 0 && | 4336 | (attr_flags & ATTR_DMI) == 0 && |
4317 | DM_EVENT_ENABLED(XFS_MTOVFS(mp), ip, DM_EVENT_WRITE)) { | 4337 | DM_EVENT_ENABLED(XFS_MTOVFS(mp), ip, DM_EVENT_WRITE)) { |
4318 | if (end_dmi_offset > ip->i_d.di_size) | 4338 | if (end_dmi_offset > ip->i_size) |
4319 | end_dmi_offset = ip->i_d.di_size; | 4339 | end_dmi_offset = ip->i_size; |
4320 | error = XFS_SEND_DATA(mp, DM_EVENT_WRITE, vp, | 4340 | error = XFS_SEND_DATA(mp, DM_EVENT_WRITE, vp, |
4321 | offset, end_dmi_offset - offset, | 4341 | offset, end_dmi_offset - offset, |
4322 | AT_DELAY_FLAG(attr_flags), NULL); | 4342 | AT_DELAY_FLAG(attr_flags), NULL); |
@@ -4332,16 +4352,15 @@ xfs_free_file_space( | |||
4332 | } | 4352 | } |
4333 | 4353 | ||
4334 | rounding = max_t(uint, 1 << mp->m_sb.sb_blocklog, NBPP); | 4354 | rounding = max_t(uint, 1 << mp->m_sb.sb_blocklog, NBPP); |
4335 | ilen = len + (offset & (rounding - 1)); | ||
4336 | ioffset = offset & ~(rounding - 1); | 4355 | ioffset = offset & ~(rounding - 1); |
4337 | if (ilen & (rounding - 1)) | ||
4338 | ilen = (ilen + rounding) & ~(rounding - 1); | ||
4339 | 4356 | ||
4340 | if (VN_CACHED(vp) != 0) { | 4357 | if (VN_CACHED(vp) != 0) { |
4341 | xfs_inval_cached_trace(&ip->i_iocore, ioffset, -1, | 4358 | xfs_inval_cached_trace(&ip->i_iocore, ioffset, -1, |
4342 | ctooff(offtoct(ioffset)), -1); | 4359 | ctooff(offtoct(ioffset)), -1); |
4343 | bhv_vop_flushinval_pages(vp, ctooff(offtoct(ioffset)), | 4360 | error = bhv_vop_flushinval_pages(vp, ctooff(offtoct(ioffset)), |
4344 | -1, FI_REMAPF_LOCKED); | 4361 | -1, FI_REMAPF_LOCKED); |
4362 | if (error) | ||
4363 | goto out_unlock_iolock; | ||
4345 | } | 4364 | } |
4346 | 4365 | ||
4347 | /* | 4366 | /* |
@@ -4455,7 +4474,7 @@ xfs_free_file_space( | |||
4455 | goto error0; | 4474 | goto error0; |
4456 | } | 4475 | } |
4457 | 4476 | ||
4458 | error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES, NULL); | 4477 | error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); |
4459 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | 4478 | xfs_iunlock(ip, XFS_ILOCK_EXCL); |
4460 | } | 4479 | } |
4461 | 4480 | ||
@@ -4533,7 +4552,7 @@ xfs_change_file_space( | |||
4533 | bf->l_start += offset; | 4552 | bf->l_start += offset; |
4534 | break; | 4553 | break; |
4535 | case 2: /*SEEK_END*/ | 4554 | case 2: /*SEEK_END*/ |
4536 | bf->l_start += ip->i_d.di_size; | 4555 | bf->l_start += ip->i_size; |
4537 | break; | 4556 | break; |
4538 | default: | 4557 | default: |
4539 | return XFS_ERROR(EINVAL); | 4558 | return XFS_ERROR(EINVAL); |
@@ -4550,7 +4569,7 @@ xfs_change_file_space( | |||
4550 | bf->l_whence = 0; | 4569 | bf->l_whence = 0; |
4551 | 4570 | ||
4552 | startoffset = bf->l_start; | 4571 | startoffset = bf->l_start; |
4553 | fsize = ip->i_d.di_size; | 4572 | fsize = ip->i_size; |
4554 | 4573 | ||
4555 | /* | 4574 | /* |
4556 | * XFS_IOC_RESVSP and XFS_IOC_UNRESVSP will reserve or unreserve | 4575 | * XFS_IOC_RESVSP and XFS_IOC_UNRESVSP will reserve or unreserve |
@@ -4649,7 +4668,7 @@ xfs_change_file_space( | |||
4649 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | 4668 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); |
4650 | xfs_trans_set_sync(tp); | 4669 | xfs_trans_set_sync(tp); |
4651 | 4670 | ||
4652 | error = xfs_trans_commit(tp, 0, NULL); | 4671 | error = xfs_trans_commit(tp, 0); |
4653 | 4672 | ||
4654 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | 4673 | xfs_iunlock(ip, XFS_ILOCK_EXCL); |
4655 | 4674 | ||