diff options
Diffstat (limited to 'fs/xfs/xfs_vnodeops.c')
-rw-r--r-- | fs/xfs/xfs_vnodeops.c | 293 |
1 files changed, 55 insertions, 238 deletions
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index c1646838898f..3ac137dd531b 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -26,19 +26,14 @@ | |||
26 | #include "xfs_sb.h" | 26 | #include "xfs_sb.h" |
27 | #include "xfs_ag.h" | 27 | #include "xfs_ag.h" |
28 | #include "xfs_dir2.h" | 28 | #include "xfs_dir2.h" |
29 | #include "xfs_dmapi.h" | ||
30 | #include "xfs_mount.h" | 29 | #include "xfs_mount.h" |
31 | #include "xfs_da_btree.h" | 30 | #include "xfs_da_btree.h" |
32 | #include "xfs_bmap_btree.h" | 31 | #include "xfs_bmap_btree.h" |
33 | #include "xfs_alloc_btree.h" | ||
34 | #include "xfs_ialloc_btree.h" | 32 | #include "xfs_ialloc_btree.h" |
35 | #include "xfs_dir2_sf.h" | ||
36 | #include "xfs_attr_sf.h" | ||
37 | #include "xfs_dinode.h" | 33 | #include "xfs_dinode.h" |
38 | #include "xfs_inode.h" | 34 | #include "xfs_inode.h" |
39 | #include "xfs_inode_item.h" | 35 | #include "xfs_inode_item.h" |
40 | #include "xfs_itable.h" | 36 | #include "xfs_itable.h" |
41 | #include "xfs_btree.h" | ||
42 | #include "xfs_ialloc.h" | 37 | #include "xfs_ialloc.h" |
43 | #include "xfs_alloc.h" | 38 | #include "xfs_alloc.h" |
44 | #include "xfs_bmap.h" | 39 | #include "xfs_bmap.h" |
@@ -73,7 +68,7 @@ xfs_setattr( | |||
73 | struct xfs_dquot *udqp, *gdqp, *olddquot1, *olddquot2; | 68 | struct xfs_dquot *udqp, *gdqp, *olddquot1, *olddquot2; |
74 | int need_iolock = 1; | 69 | int need_iolock = 1; |
75 | 70 | ||
76 | xfs_itrace_entry(ip); | 71 | trace_xfs_setattr(ip); |
77 | 72 | ||
78 | if (mp->m_flags & XFS_MOUNT_RDONLY) | 73 | if (mp->m_flags & XFS_MOUNT_RDONLY) |
79 | return XFS_ERROR(EROFS); | 74 | return XFS_ERROR(EROFS); |
@@ -143,16 +138,6 @@ xfs_setattr( | |||
143 | goto error_return; | 138 | goto error_return; |
144 | } | 139 | } |
145 | } else { | 140 | } else { |
146 | if (DM_EVENT_ENABLED(ip, DM_EVENT_TRUNCATE) && | ||
147 | !(flags & XFS_ATTR_DMI)) { | ||
148 | int dmflags = AT_DELAY_FLAG(flags) | DM_SEM_FLAG_WR; | ||
149 | code = XFS_SEND_DATA(mp, DM_EVENT_TRUNCATE, ip, | ||
150 | iattr->ia_size, 0, dmflags, NULL); | ||
151 | if (code) { | ||
152 | lock_flags = 0; | ||
153 | goto error_return; | ||
154 | } | ||
155 | } | ||
156 | if (need_iolock) | 141 | if (need_iolock) |
157 | lock_flags |= XFS_IOLOCK_EXCL; | 142 | lock_flags |= XFS_IOLOCK_EXCL; |
158 | } | 143 | } |
@@ -283,8 +268,7 @@ xfs_setattr( | |||
283 | commit_flags = XFS_TRANS_RELEASE_LOG_RES; | 268 | commit_flags = XFS_TRANS_RELEASE_LOG_RES; |
284 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 269 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
285 | 270 | ||
286 | xfs_trans_ijoin(tp, ip, lock_flags); | 271 | xfs_trans_ijoin(tp, ip); |
287 | xfs_trans_ihold(tp, ip); | ||
288 | 272 | ||
289 | /* | 273 | /* |
290 | * Only change the c/mtime if we are changing the size | 274 | * Only change the c/mtime if we are changing the size |
@@ -334,8 +318,7 @@ xfs_setattr( | |||
334 | xfs_iflags_set(ip, XFS_ITRUNCATED); | 318 | xfs_iflags_set(ip, XFS_ITRUNCATED); |
335 | } | 319 | } |
336 | } else if (tp) { | 320 | } else if (tp) { |
337 | xfs_trans_ijoin(tp, ip, lock_flags); | 321 | xfs_trans_ijoin(tp, ip); |
338 | xfs_trans_ihold(tp, ip); | ||
339 | } | 322 | } |
340 | 323 | ||
341 | /* | 324 | /* |
@@ -470,17 +453,10 @@ xfs_setattr( | |||
470 | return XFS_ERROR(code); | 453 | return XFS_ERROR(code); |
471 | } | 454 | } |
472 | 455 | ||
473 | if (DM_EVENT_ENABLED(ip, DM_EVENT_ATTRIBUTE) && | ||
474 | !(flags & XFS_ATTR_DMI)) { | ||
475 | (void) XFS_SEND_NAMESP(mp, DM_EVENT_ATTRIBUTE, ip, DM_RIGHT_NULL, | ||
476 | NULL, DM_RIGHT_NULL, NULL, NULL, | ||
477 | 0, 0, AT_DELAY_FLAG(flags)); | ||
478 | } | ||
479 | return 0; | 456 | return 0; |
480 | 457 | ||
481 | abort_return: | 458 | abort_return: |
482 | commit_flags |= XFS_TRANS_ABORT; | 459 | commit_flags |= XFS_TRANS_ABORT; |
483 | /* FALLTHROUGH */ | ||
484 | error_return: | 460 | error_return: |
485 | xfs_qm_dqrele(udqp); | 461 | xfs_qm_dqrele(udqp); |
486 | xfs_qm_dqrele(gdqp); | 462 | xfs_qm_dqrele(gdqp); |
@@ -516,7 +492,7 @@ xfs_readlink_bmap( | |||
516 | int error = 0; | 492 | int error = 0; |
517 | 493 | ||
518 | error = xfs_bmapi(NULL, ip, 0, XFS_B_TO_FSB(mp, pathlen), 0, NULL, 0, | 494 | error = xfs_bmapi(NULL, ip, 0, XFS_B_TO_FSB(mp, pathlen), 0, NULL, 0, |
519 | mval, &nmaps, NULL, NULL); | 495 | mval, &nmaps, NULL); |
520 | if (error) | 496 | if (error) |
521 | goto out; | 497 | goto out; |
522 | 498 | ||
@@ -557,7 +533,7 @@ xfs_readlink( | |||
557 | int pathlen; | 533 | int pathlen; |
558 | int error = 0; | 534 | int error = 0; |
559 | 535 | ||
560 | xfs_itrace_entry(ip); | 536 | trace_xfs_readlink(ip); |
561 | 537 | ||
562 | if (XFS_FORCED_SHUTDOWN(mp)) | 538 | if (XFS_FORCED_SHUTDOWN(mp)) |
563 | return XFS_ERROR(EIO); | 539 | return XFS_ERROR(EIO); |
@@ -613,14 +589,14 @@ xfs_free_eofblocks( | |||
613 | */ | 589 | */ |
614 | end_fsb = XFS_B_TO_FSB(mp, ((xfs_ufsize_t)ip->i_size)); | 590 | end_fsb = XFS_B_TO_FSB(mp, ((xfs_ufsize_t)ip->i_size)); |
615 | last_fsb = XFS_B_TO_FSB(mp, (xfs_ufsize_t)XFS_MAXIOFFSET(mp)); | 591 | last_fsb = XFS_B_TO_FSB(mp, (xfs_ufsize_t)XFS_MAXIOFFSET(mp)); |
616 | map_len = last_fsb - end_fsb; | 592 | if (last_fsb <= end_fsb) |
617 | if (map_len <= 0) | ||
618 | return 0; | 593 | return 0; |
594 | map_len = last_fsb - end_fsb; | ||
619 | 595 | ||
620 | nimaps = 1; | 596 | nimaps = 1; |
621 | xfs_ilock(ip, XFS_ILOCK_SHARED); | 597 | xfs_ilock(ip, XFS_ILOCK_SHARED); |
622 | error = xfs_bmapi(NULL, ip, end_fsb, map_len, 0, | 598 | error = xfs_bmapi(NULL, ip, end_fsb, map_len, 0, |
623 | NULL, 0, &imap, &nimaps, NULL, NULL); | 599 | NULL, 0, &imap, &nimaps, NULL); |
624 | xfs_iunlock(ip, XFS_ILOCK_SHARED); | 600 | xfs_iunlock(ip, XFS_ILOCK_SHARED); |
625 | 601 | ||
626 | if (!error && (nimaps != 0) && | 602 | if (!error && (nimaps != 0) && |
@@ -675,10 +651,7 @@ xfs_free_eofblocks( | |||
675 | } | 651 | } |
676 | 652 | ||
677 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 653 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
678 | xfs_trans_ijoin(tp, ip, | 654 | xfs_trans_ijoin(tp, ip); |
679 | XFS_IOLOCK_EXCL | | ||
680 | XFS_ILOCK_EXCL); | ||
681 | xfs_trans_ihold(tp, ip); | ||
682 | 655 | ||
683 | error = xfs_itruncate_finish(&tp, ip, | 656 | error = xfs_itruncate_finish(&tp, ip, |
684 | ip->i_size, | 657 | ip->i_size, |
@@ -750,8 +723,7 @@ xfs_inactive_symlink_rmt( | |||
750 | xfs_ilock(ip, XFS_IOLOCK_EXCL | XFS_ILOCK_EXCL); | 723 | xfs_ilock(ip, XFS_IOLOCK_EXCL | XFS_ILOCK_EXCL); |
751 | size = (int)ip->i_d.di_size; | 724 | size = (int)ip->i_d.di_size; |
752 | ip->i_d.di_size = 0; | 725 | ip->i_d.di_size = 0; |
753 | xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL); | 726 | xfs_trans_ijoin(tp, ip); |
754 | xfs_trans_ihold(tp, ip); | ||
755 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | 727 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); |
756 | /* | 728 | /* |
757 | * Find the block(s) so we can inval and unmap them. | 729 | * Find the block(s) so we can inval and unmap them. |
@@ -761,7 +733,7 @@ xfs_inactive_symlink_rmt( | |||
761 | nmaps = ARRAY_SIZE(mval); | 733 | nmaps = ARRAY_SIZE(mval); |
762 | if ((error = xfs_bmapi(tp, ip, 0, XFS_B_TO_FSB(mp, size), | 734 | if ((error = xfs_bmapi(tp, ip, 0, XFS_B_TO_FSB(mp, size), |
763 | XFS_BMAPI_METADATA, &first_block, 0, mval, &nmaps, | 735 | XFS_BMAPI_METADATA, &first_block, 0, mval, &nmaps, |
764 | &free_list, NULL))) | 736 | &free_list))) |
765 | goto error0; | 737 | goto error0; |
766 | /* | 738 | /* |
767 | * Invalidate the block(s). | 739 | * Invalidate the block(s). |
@@ -776,7 +748,7 @@ xfs_inactive_symlink_rmt( | |||
776 | * Unmap the dead block(s) to the free_list. | 748 | * Unmap the dead block(s) to the free_list. |
777 | */ | 749 | */ |
778 | if ((error = xfs_bunmapi(tp, ip, 0, size, XFS_BMAPI_METADATA, nmaps, | 750 | if ((error = xfs_bunmapi(tp, ip, 0, size, XFS_BMAPI_METADATA, nmaps, |
779 | &first_block, &free_list, NULL, &done))) | 751 | &first_block, &free_list, &done))) |
780 | goto error1; | 752 | goto error1; |
781 | ASSERT(done); | 753 | ASSERT(done); |
782 | /* | 754 | /* |
@@ -795,8 +767,7 @@ xfs_inactive_symlink_rmt( | |||
795 | * Mark it dirty so it will be logged and moved forward in the log as | 767 | * Mark it dirty so it will be logged and moved forward in the log as |
796 | * part of every commit. | 768 | * part of every commit. |
797 | */ | 769 | */ |
798 | xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL); | 770 | xfs_trans_ijoin(tp, ip); |
799 | xfs_trans_ihold(tp, ip); | ||
800 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | 771 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); |
801 | /* | 772 | /* |
802 | * Get a new, empty transaction to return to our caller. | 773 | * Get a new, empty transaction to return to our caller. |
@@ -929,8 +900,7 @@ xfs_inactive_attrs( | |||
929 | goto error_cancel; | 900 | goto error_cancel; |
930 | 901 | ||
931 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 902 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
932 | xfs_trans_ijoin(tp, ip, XFS_IOLOCK_EXCL | XFS_ILOCK_EXCL); | 903 | xfs_trans_ijoin(tp, ip); |
933 | xfs_trans_ihold(tp, ip); | ||
934 | xfs_idestroy_fork(ip, XFS_ATTR_FORK); | 904 | xfs_idestroy_fork(ip, XFS_ATTR_FORK); |
935 | 905 | ||
936 | ASSERT(ip->i_d.di_anextents == 0); | 906 | ASSERT(ip->i_d.di_anextents == 0); |
@@ -1035,8 +1005,6 @@ xfs_inactive( | |||
1035 | int error; | 1005 | int error; |
1036 | int truncate; | 1006 | int truncate; |
1037 | 1007 | ||
1038 | xfs_itrace_entry(ip); | ||
1039 | |||
1040 | /* | 1008 | /* |
1041 | * If the inode is already free, then there can be nothing | 1009 | * If the inode is already free, then there can be nothing |
1042 | * to clean up here. | 1010 | * to clean up here. |
@@ -1060,9 +1028,6 @@ xfs_inactive( | |||
1060 | 1028 | ||
1061 | mp = ip->i_mount; | 1029 | mp = ip->i_mount; |
1062 | 1030 | ||
1063 | if (ip->i_d.di_nlink == 0 && DM_EVENT_ENABLED(ip, DM_EVENT_DESTROY)) | ||
1064 | XFS_SEND_DESTROY(mp, ip, DM_RIGHT_NULL); | ||
1065 | |||
1066 | error = 0; | 1031 | error = 0; |
1067 | 1032 | ||
1068 | /* If this is a read-only mount, don't do this (would generate I/O) */ | 1033 | /* If this is a read-only mount, don't do this (would generate I/O) */ |
@@ -1120,8 +1085,7 @@ xfs_inactive( | |||
1120 | } | 1085 | } |
1121 | 1086 | ||
1122 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 1087 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
1123 | xfs_trans_ijoin(tp, ip, XFS_IOLOCK_EXCL | XFS_ILOCK_EXCL); | 1088 | xfs_trans_ijoin(tp, ip); |
1124 | xfs_trans_ihold(tp, ip); | ||
1125 | 1089 | ||
1126 | /* | 1090 | /* |
1127 | * normally, we have to run xfs_itruncate_finish sync. | 1091 | * normally, we have to run xfs_itruncate_finish sync. |
@@ -1154,8 +1118,7 @@ xfs_inactive( | |||
1154 | return VN_INACTIVE_CACHE; | 1118 | return VN_INACTIVE_CACHE; |
1155 | } | 1119 | } |
1156 | 1120 | ||
1157 | xfs_trans_ijoin(tp, ip, XFS_IOLOCK_EXCL | XFS_ILOCK_EXCL); | 1121 | xfs_trans_ijoin(tp, ip); |
1158 | xfs_trans_ihold(tp, ip); | ||
1159 | } else { | 1122 | } else { |
1160 | error = xfs_trans_reserve(tp, 0, | 1123 | error = xfs_trans_reserve(tp, 0, |
1161 | XFS_IFREE_LOG_RES(mp), | 1124 | XFS_IFREE_LOG_RES(mp), |
@@ -1168,8 +1131,7 @@ xfs_inactive( | |||
1168 | } | 1131 | } |
1169 | 1132 | ||
1170 | xfs_ilock(ip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL); | 1133 | xfs_ilock(ip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL); |
1171 | xfs_trans_ijoin(tp, ip, XFS_IOLOCK_EXCL | XFS_ILOCK_EXCL); | 1134 | xfs_trans_ijoin(tp, ip); |
1172 | xfs_trans_ihold(tp, ip); | ||
1173 | } | 1135 | } |
1174 | 1136 | ||
1175 | /* | 1137 | /* |
@@ -1257,7 +1219,7 @@ xfs_lookup( | |||
1257 | int error; | 1219 | int error; |
1258 | uint lock_mode; | 1220 | uint lock_mode; |
1259 | 1221 | ||
1260 | xfs_itrace_entry(dp); | 1222 | trace_xfs_lookup(dp, name); |
1261 | 1223 | ||
1262 | if (XFS_FORCED_SHUTDOWN(dp->i_mount)) | 1224 | if (XFS_FORCED_SHUTDOWN(dp->i_mount)) |
1263 | return XFS_ERROR(EIO); | 1225 | return XFS_ERROR(EIO); |
@@ -1309,21 +1271,11 @@ xfs_create( | |||
1309 | uint log_res; | 1271 | uint log_res; |
1310 | uint log_count; | 1272 | uint log_count; |
1311 | 1273 | ||
1312 | xfs_itrace_entry(dp); | 1274 | trace_xfs_create(dp, name); |
1313 | 1275 | ||
1314 | if (XFS_FORCED_SHUTDOWN(mp)) | 1276 | if (XFS_FORCED_SHUTDOWN(mp)) |
1315 | return XFS_ERROR(EIO); | 1277 | return XFS_ERROR(EIO); |
1316 | 1278 | ||
1317 | if (DM_EVENT_ENABLED(dp, DM_EVENT_CREATE)) { | ||
1318 | error = XFS_SEND_NAMESP(mp, DM_EVENT_CREATE, | ||
1319 | dp, DM_RIGHT_NULL, NULL, | ||
1320 | DM_RIGHT_NULL, name->name, NULL, | ||
1321 | mode, 0, 0); | ||
1322 | |||
1323 | if (error) | ||
1324 | return error; | ||
1325 | } | ||
1326 | |||
1327 | if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) | 1279 | if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) |
1328 | prid = dp->i_d.di_projid; | 1280 | prid = dp->i_d.di_projid; |
1329 | else | 1281 | else |
@@ -1427,8 +1379,7 @@ xfs_create( | |||
1427 | * the transaction cancel unlocking dp so don't do it explicitly in the | 1379 | * the transaction cancel unlocking dp so don't do it explicitly in the |
1428 | * error path. | 1380 | * error path. |
1429 | */ | 1381 | */ |
1430 | IHOLD(dp); | 1382 | xfs_trans_ijoin_ref(tp, dp, XFS_ILOCK_EXCL); |
1431 | xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL); | ||
1432 | unlock_dp_on_error = B_FALSE; | 1383 | unlock_dp_on_error = B_FALSE; |
1433 | 1384 | ||
1434 | error = xfs_dir_createname(tp, dp, name, ip->i_ino, | 1385 | error = xfs_dir_createname(tp, dp, name, ip->i_ino, |
@@ -1487,16 +1438,7 @@ xfs_create( | |||
1487 | xfs_qm_dqrele(gdqp); | 1438 | xfs_qm_dqrele(gdqp); |
1488 | 1439 | ||
1489 | *ipp = ip; | 1440 | *ipp = ip; |
1490 | 1441 | return 0; | |
1491 | /* Fallthrough to std_return with error = 0 */ | ||
1492 | std_return: | ||
1493 | if (DM_EVENT_ENABLED(dp, DM_EVENT_POSTCREATE)) { | ||
1494 | XFS_SEND_NAMESP(mp, DM_EVENT_POSTCREATE, dp, DM_RIGHT_NULL, | ||
1495 | ip, DM_RIGHT_NULL, name->name, NULL, mode, | ||
1496 | error, 0); | ||
1497 | } | ||
1498 | |||
1499 | return error; | ||
1500 | 1442 | ||
1501 | out_bmap_cancel: | 1443 | out_bmap_cancel: |
1502 | xfs_bmap_cancel(&free_list); | 1444 | xfs_bmap_cancel(&free_list); |
@@ -1510,8 +1452,8 @@ xfs_create( | |||
1510 | 1452 | ||
1511 | if (unlock_dp_on_error) | 1453 | if (unlock_dp_on_error) |
1512 | xfs_iunlock(dp, XFS_ILOCK_EXCL); | 1454 | xfs_iunlock(dp, XFS_ILOCK_EXCL); |
1513 | 1455 | std_return: | |
1514 | goto std_return; | 1456 | return error; |
1515 | 1457 | ||
1516 | out_abort_rele: | 1458 | out_abort_rele: |
1517 | /* | 1459 | /* |
@@ -1726,20 +1668,11 @@ xfs_remove( | |||
1726 | uint resblks; | 1668 | uint resblks; |
1727 | uint log_count; | 1669 | uint log_count; |
1728 | 1670 | ||
1729 | xfs_itrace_entry(dp); | 1671 | trace_xfs_remove(dp, name); |
1730 | xfs_itrace_entry(ip); | ||
1731 | 1672 | ||
1732 | if (XFS_FORCED_SHUTDOWN(mp)) | 1673 | if (XFS_FORCED_SHUTDOWN(mp)) |
1733 | return XFS_ERROR(EIO); | 1674 | return XFS_ERROR(EIO); |
1734 | 1675 | ||
1735 | if (DM_EVENT_ENABLED(dp, DM_EVENT_REMOVE)) { | ||
1736 | error = XFS_SEND_NAMESP(mp, DM_EVENT_REMOVE, dp, DM_RIGHT_NULL, | ||
1737 | NULL, DM_RIGHT_NULL, name->name, NULL, | ||
1738 | ip->i_d.di_mode, 0, 0); | ||
1739 | if (error) | ||
1740 | return error; | ||
1741 | } | ||
1742 | |||
1743 | error = xfs_qm_dqattach(dp, 0); | 1676 | error = xfs_qm_dqattach(dp, 0); |
1744 | if (error) | 1677 | if (error) |
1745 | goto std_return; | 1678 | goto std_return; |
@@ -1782,15 +1715,8 @@ xfs_remove( | |||
1782 | 1715 | ||
1783 | xfs_lock_two_inodes(dp, ip, XFS_ILOCK_EXCL); | 1716 | xfs_lock_two_inodes(dp, ip, XFS_ILOCK_EXCL); |
1784 | 1717 | ||
1785 | /* | 1718 | xfs_trans_ijoin_ref(tp, dp, XFS_ILOCK_EXCL); |
1786 | * At this point, we've gotten both the directory and the entry | 1719 | xfs_trans_ijoin_ref(tp, ip, XFS_ILOCK_EXCL); |
1787 | * inodes locked. | ||
1788 | */ | ||
1789 | IHOLD(ip); | ||
1790 | xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL); | ||
1791 | |||
1792 | IHOLD(dp); | ||
1793 | xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); | ||
1794 | 1720 | ||
1795 | /* | 1721 | /* |
1796 | * If we're removing a directory perform some additional validation. | 1722 | * If we're removing a directory perform some additional validation. |
@@ -1877,21 +1803,15 @@ xfs_remove( | |||
1877 | if (!is_dir && link_zero && xfs_inode_is_filestream(ip)) | 1803 | if (!is_dir && link_zero && xfs_inode_is_filestream(ip)) |
1878 | xfs_filestream_deassociate(ip); | 1804 | xfs_filestream_deassociate(ip); |
1879 | 1805 | ||
1880 | std_return: | 1806 | return 0; |
1881 | if (DM_EVENT_ENABLED(dp, DM_EVENT_POSTREMOVE)) { | ||
1882 | XFS_SEND_NAMESP(mp, DM_EVENT_POSTREMOVE, dp, DM_RIGHT_NULL, | ||
1883 | NULL, DM_RIGHT_NULL, name->name, NULL, | ||
1884 | ip->i_d.di_mode, error, 0); | ||
1885 | } | ||
1886 | |||
1887 | return error; | ||
1888 | 1807 | ||
1889 | out_bmap_cancel: | 1808 | out_bmap_cancel: |
1890 | xfs_bmap_cancel(&free_list); | 1809 | xfs_bmap_cancel(&free_list); |
1891 | cancel_flags |= XFS_TRANS_ABORT; | 1810 | cancel_flags |= XFS_TRANS_ABORT; |
1892 | out_trans_cancel: | 1811 | out_trans_cancel: |
1893 | xfs_trans_cancel(tp, cancel_flags); | 1812 | xfs_trans_cancel(tp, cancel_flags); |
1894 | goto std_return; | 1813 | std_return: |
1814 | return error; | ||
1895 | } | 1815 | } |
1896 | 1816 | ||
1897 | int | 1817 | int |
@@ -1909,25 +1829,13 @@ xfs_link( | |||
1909 | int committed; | 1829 | int committed; |
1910 | int resblks; | 1830 | int resblks; |
1911 | 1831 | ||
1912 | xfs_itrace_entry(tdp); | 1832 | trace_xfs_link(tdp, target_name); |
1913 | xfs_itrace_entry(sip); | ||
1914 | 1833 | ||
1915 | ASSERT(!S_ISDIR(sip->i_d.di_mode)); | 1834 | ASSERT(!S_ISDIR(sip->i_d.di_mode)); |
1916 | 1835 | ||
1917 | if (XFS_FORCED_SHUTDOWN(mp)) | 1836 | if (XFS_FORCED_SHUTDOWN(mp)) |
1918 | return XFS_ERROR(EIO); | 1837 | return XFS_ERROR(EIO); |
1919 | 1838 | ||
1920 | if (DM_EVENT_ENABLED(tdp, DM_EVENT_LINK)) { | ||
1921 | error = XFS_SEND_NAMESP(mp, DM_EVENT_LINK, | ||
1922 | tdp, DM_RIGHT_NULL, | ||
1923 | sip, DM_RIGHT_NULL, | ||
1924 | target_name->name, NULL, 0, 0, 0); | ||
1925 | if (error) | ||
1926 | return error; | ||
1927 | } | ||
1928 | |||
1929 | /* Return through std_return after this point. */ | ||
1930 | |||
1931 | error = xfs_qm_dqattach(sip, 0); | 1839 | error = xfs_qm_dqattach(sip, 0); |
1932 | if (error) | 1840 | if (error) |
1933 | goto std_return; | 1841 | goto std_return; |
@@ -1953,15 +1861,8 @@ xfs_link( | |||
1953 | 1861 | ||
1954 | xfs_lock_two_inodes(sip, tdp, XFS_ILOCK_EXCL); | 1862 | xfs_lock_two_inodes(sip, tdp, XFS_ILOCK_EXCL); |
1955 | 1863 | ||
1956 | /* | 1864 | xfs_trans_ijoin_ref(tp, sip, XFS_ILOCK_EXCL); |
1957 | * Increment vnode ref counts since xfs_trans_commit & | 1865 | xfs_trans_ijoin_ref(tp, tdp, XFS_ILOCK_EXCL); |
1958 | * xfs_trans_cancel will both unlock the inodes and | ||
1959 | * decrement the associated ref counts. | ||
1960 | */ | ||
1961 | IHOLD(sip); | ||
1962 | IHOLD(tdp); | ||
1963 | xfs_trans_ijoin(tp, sip, XFS_ILOCK_EXCL); | ||
1964 | xfs_trans_ijoin(tp, tdp, XFS_ILOCK_EXCL); | ||
1965 | 1866 | ||
1966 | /* | 1867 | /* |
1967 | * If the source has too many links, we can't make any more to it. | 1868 | * If the source has too many links, we can't make any more to it. |
@@ -2014,27 +1915,14 @@ xfs_link( | |||
2014 | goto abort_return; | 1915 | goto abort_return; |
2015 | } | 1916 | } |
2016 | 1917 | ||
2017 | error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); | 1918 | return xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); |
2018 | if (error) | ||
2019 | goto std_return; | ||
2020 | |||
2021 | /* Fall through to std_return with error = 0. */ | ||
2022 | std_return: | ||
2023 | if (DM_EVENT_ENABLED(sip, DM_EVENT_POSTLINK)) { | ||
2024 | (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTLINK, | ||
2025 | tdp, DM_RIGHT_NULL, | ||
2026 | sip, DM_RIGHT_NULL, | ||
2027 | target_name->name, NULL, 0, error, 0); | ||
2028 | } | ||
2029 | return error; | ||
2030 | 1919 | ||
2031 | abort_return: | 1920 | abort_return: |
2032 | cancel_flags |= XFS_TRANS_ABORT; | 1921 | cancel_flags |= XFS_TRANS_ABORT; |
2033 | /* FALLTHROUGH */ | ||
2034 | |||
2035 | error_return: | 1922 | error_return: |
2036 | xfs_trans_cancel(tp, cancel_flags); | 1923 | xfs_trans_cancel(tp, cancel_flags); |
2037 | goto std_return; | 1924 | std_return: |
1925 | return error; | ||
2038 | } | 1926 | } |
2039 | 1927 | ||
2040 | int | 1928 | int |
@@ -2074,7 +1962,7 @@ xfs_symlink( | |||
2074 | ip = NULL; | 1962 | ip = NULL; |
2075 | tp = NULL; | 1963 | tp = NULL; |
2076 | 1964 | ||
2077 | xfs_itrace_entry(dp); | 1965 | trace_xfs_symlink(dp, link_name); |
2078 | 1966 | ||
2079 | if (XFS_FORCED_SHUTDOWN(mp)) | 1967 | if (XFS_FORCED_SHUTDOWN(mp)) |
2080 | return XFS_ERROR(EIO); | 1968 | return XFS_ERROR(EIO); |
@@ -2086,17 +1974,6 @@ xfs_symlink( | |||
2086 | if (pathlen >= MAXPATHLEN) /* total string too long */ | 1974 | if (pathlen >= MAXPATHLEN) /* total string too long */ |
2087 | return XFS_ERROR(ENAMETOOLONG); | 1975 | return XFS_ERROR(ENAMETOOLONG); |
2088 | 1976 | ||
2089 | if (DM_EVENT_ENABLED(dp, DM_EVENT_SYMLINK)) { | ||
2090 | error = XFS_SEND_NAMESP(mp, DM_EVENT_SYMLINK, dp, | ||
2091 | DM_RIGHT_NULL, NULL, DM_RIGHT_NULL, | ||
2092 | link_name->name, | ||
2093 | (unsigned char *)target_path, 0, 0, 0); | ||
2094 | if (error) | ||
2095 | return error; | ||
2096 | } | ||
2097 | |||
2098 | /* Return through std_return after this point. */ | ||
2099 | |||
2100 | udqp = gdqp = NULL; | 1977 | udqp = gdqp = NULL; |
2101 | if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) | 1978 | if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) |
2102 | prid = dp->i_d.di_projid; | 1979 | prid = dp->i_d.di_projid; |
@@ -2180,8 +2057,7 @@ xfs_symlink( | |||
2180 | * transaction cancel unlocking dp so don't do it explicitly in the | 2057 | * transaction cancel unlocking dp so don't do it explicitly in the |
2181 | * error path. | 2058 | * error path. |
2182 | */ | 2059 | */ |
2183 | IHOLD(dp); | 2060 | xfs_trans_ijoin_ref(tp, dp, XFS_ILOCK_EXCL); |
2184 | xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL); | ||
2185 | unlock_dp_on_error = B_FALSE; | 2061 | unlock_dp_on_error = B_FALSE; |
2186 | 2062 | ||
2187 | /* | 2063 | /* |
@@ -2215,7 +2091,7 @@ xfs_symlink( | |||
2215 | error = xfs_bmapi(tp, ip, first_fsb, fs_blocks, | 2091 | error = xfs_bmapi(tp, ip, first_fsb, fs_blocks, |
2216 | XFS_BMAPI_WRITE | XFS_BMAPI_METADATA, | 2092 | XFS_BMAPI_WRITE | XFS_BMAPI_METADATA, |
2217 | &first_block, resblks, mval, &nmaps, | 2093 | &first_block, resblks, mval, &nmaps, |
2218 | &free_list, NULL); | 2094 | &free_list); |
2219 | if (error) { | 2095 | if (error) { |
2220 | goto error1; | 2096 | goto error1; |
2221 | } | 2097 | } |
@@ -2278,21 +2154,8 @@ xfs_symlink( | |||
2278 | xfs_qm_dqrele(udqp); | 2154 | xfs_qm_dqrele(udqp); |
2279 | xfs_qm_dqrele(gdqp); | 2155 | xfs_qm_dqrele(gdqp); |
2280 | 2156 | ||
2281 | /* Fall through to std_return with error = 0 or errno from | 2157 | *ipp = ip; |
2282 | * xfs_trans_commit */ | 2158 | return 0; |
2283 | std_return: | ||
2284 | if (DM_EVENT_ENABLED(dp, DM_EVENT_POSTSYMLINK)) { | ||
2285 | (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTSYMLINK, | ||
2286 | dp, DM_RIGHT_NULL, | ||
2287 | error ? NULL : ip, | ||
2288 | DM_RIGHT_NULL, link_name->name, | ||
2289 | (unsigned char *)target_path, | ||
2290 | 0, error, 0); | ||
2291 | } | ||
2292 | |||
2293 | if (!error) | ||
2294 | *ipp = ip; | ||
2295 | return error; | ||
2296 | 2159 | ||
2297 | error2: | 2160 | error2: |
2298 | IRELE(ip); | 2161 | IRELE(ip); |
@@ -2306,8 +2169,8 @@ std_return: | |||
2306 | 2169 | ||
2307 | if (unlock_dp_on_error) | 2170 | if (unlock_dp_on_error) |
2308 | xfs_iunlock(dp, XFS_ILOCK_EXCL); | 2171 | xfs_iunlock(dp, XFS_ILOCK_EXCL); |
2309 | 2172 | std_return: | |
2310 | goto std_return; | 2173 | return error; |
2311 | } | 2174 | } |
2312 | 2175 | ||
2313 | int | 2176 | int |
@@ -2333,13 +2196,12 @@ xfs_set_dmattrs( | |||
2333 | return error; | 2196 | return error; |
2334 | } | 2197 | } |
2335 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 2198 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
2336 | xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); | 2199 | xfs_trans_ijoin_ref(tp, ip, XFS_ILOCK_EXCL); |
2337 | 2200 | ||
2338 | ip->i_d.di_dmevmask = evmask; | 2201 | ip->i_d.di_dmevmask = evmask; |
2339 | ip->i_d.di_dmstate = state; | 2202 | ip->i_d.di_dmstate = state; |
2340 | 2203 | ||
2341 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | 2204 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); |
2342 | IHOLD(ip); | ||
2343 | error = xfs_trans_commit(tp, 0); | 2205 | error = xfs_trans_commit(tp, 0); |
2344 | 2206 | ||
2345 | return error; | 2207 | return error; |
@@ -2390,7 +2252,7 @@ xfs_alloc_file_space( | |||
2390 | int committed; | 2252 | int committed; |
2391 | int error; | 2253 | int error; |
2392 | 2254 | ||
2393 | xfs_itrace_entry(ip); | 2255 | trace_xfs_alloc_file_space(ip); |
2394 | 2256 | ||
2395 | if (XFS_FORCED_SHUTDOWN(mp)) | 2257 | if (XFS_FORCED_SHUTDOWN(mp)) |
2396 | return XFS_ERROR(EIO); | 2258 | return XFS_ERROR(EIO); |
@@ -2412,25 +2274,9 @@ xfs_alloc_file_space( | |||
2412 | startoffset_fsb = XFS_B_TO_FSBT(mp, offset); | 2274 | startoffset_fsb = XFS_B_TO_FSBT(mp, offset); |
2413 | allocatesize_fsb = XFS_B_TO_FSB(mp, count); | 2275 | allocatesize_fsb = XFS_B_TO_FSB(mp, count); |
2414 | 2276 | ||
2415 | /* Generate a DMAPI event if needed. */ | ||
2416 | if (alloc_type != 0 && offset < ip->i_size && | ||
2417 | (attr_flags & XFS_ATTR_DMI) == 0 && | ||
2418 | DM_EVENT_ENABLED(ip, DM_EVENT_WRITE)) { | ||
2419 | xfs_off_t end_dmi_offset; | ||
2420 | |||
2421 | end_dmi_offset = offset+len; | ||
2422 | if (end_dmi_offset > ip->i_size) | ||
2423 | end_dmi_offset = ip->i_size; | ||
2424 | error = XFS_SEND_DATA(mp, DM_EVENT_WRITE, ip, offset, | ||
2425 | end_dmi_offset - offset, 0, NULL); | ||
2426 | if (error) | ||
2427 | return error; | ||
2428 | } | ||
2429 | |||
2430 | /* | 2277 | /* |
2431 | * Allocate file space until done or until there is an error | 2278 | * Allocate file space until done or until there is an error |
2432 | */ | 2279 | */ |
2433 | retry: | ||
2434 | while (allocatesize_fsb && !error) { | 2280 | while (allocatesize_fsb && !error) { |
2435 | xfs_fileoff_t s, e; | 2281 | xfs_fileoff_t s, e; |
2436 | 2282 | ||
@@ -2488,8 +2334,7 @@ retry: | |||
2488 | if (error) | 2334 | if (error) |
2489 | goto error1; | 2335 | goto error1; |
2490 | 2336 | ||
2491 | xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); | 2337 | xfs_trans_ijoin(tp, ip); |
2492 | xfs_trans_ihold(tp, ip); | ||
2493 | 2338 | ||
2494 | /* | 2339 | /* |
2495 | * Issue the xfs_bmapi() call to allocate the blocks | 2340 | * Issue the xfs_bmapi() call to allocate the blocks |
@@ -2498,7 +2343,7 @@ retry: | |||
2498 | error = xfs_bmapi(tp, ip, startoffset_fsb, | 2343 | error = xfs_bmapi(tp, ip, startoffset_fsb, |
2499 | allocatesize_fsb, bmapi_flag, | 2344 | allocatesize_fsb, bmapi_flag, |
2500 | &firstfsb, 0, imapp, &nimaps, | 2345 | &firstfsb, 0, imapp, &nimaps, |
2501 | &free_list, NULL); | 2346 | &free_list); |
2502 | if (error) { | 2347 | if (error) { |
2503 | goto error0; | 2348 | goto error0; |
2504 | } | 2349 | } |
@@ -2527,17 +2372,6 @@ retry: | |||
2527 | startoffset_fsb += allocated_fsb; | 2372 | startoffset_fsb += allocated_fsb; |
2528 | allocatesize_fsb -= allocated_fsb; | 2373 | allocatesize_fsb -= allocated_fsb; |
2529 | } | 2374 | } |
2530 | dmapi_enospc_check: | ||
2531 | if (error == ENOSPC && (attr_flags & XFS_ATTR_DMI) == 0 && | ||
2532 | DM_EVENT_ENABLED(ip, DM_EVENT_NOSPACE)) { | ||
2533 | error = XFS_SEND_NAMESP(mp, DM_EVENT_NOSPACE, | ||
2534 | ip, DM_RIGHT_NULL, | ||
2535 | ip, DM_RIGHT_NULL, | ||
2536 | NULL, NULL, 0, 0, 0); /* Delay flag intentionally unused */ | ||
2537 | if (error == 0) | ||
2538 | goto retry; /* Maybe DMAPI app. has made space */ | ||
2539 | /* else fall through with error from XFS_SEND_DATA */ | ||
2540 | } | ||
2541 | 2375 | ||
2542 | return error; | 2376 | return error; |
2543 | 2377 | ||
@@ -2548,7 +2382,7 @@ error0: /* Cancel bmap, unlock inode, unreserve quota blocks, cancel trans */ | |||
2548 | error1: /* Just cancel transaction */ | 2382 | error1: /* Just cancel transaction */ |
2549 | xfs_trans_cancel(tp, XFS_TRANS_RELEASE_LOG_RES | XFS_TRANS_ABORT); | 2383 | xfs_trans_cancel(tp, XFS_TRANS_RELEASE_LOG_RES | XFS_TRANS_ABORT); |
2550 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | 2384 | xfs_iunlock(ip, XFS_ILOCK_EXCL); |
2551 | goto dmapi_enospc_check; | 2385 | return error; |
2552 | } | 2386 | } |
2553 | 2387 | ||
2554 | /* | 2388 | /* |
@@ -2598,7 +2432,7 @@ xfs_zero_remaining_bytes( | |||
2598 | offset_fsb = XFS_B_TO_FSBT(mp, offset); | 2432 | offset_fsb = XFS_B_TO_FSBT(mp, offset); |
2599 | nimap = 1; | 2433 | nimap = 1; |
2600 | error = xfs_bmapi(NULL, ip, offset_fsb, 1, 0, | 2434 | error = xfs_bmapi(NULL, ip, offset_fsb, 1, 0, |
2601 | NULL, 0, &imap, &nimap, NULL, NULL); | 2435 | NULL, 0, &imap, &nimap, NULL); |
2602 | if (error || nimap < 1) | 2436 | if (error || nimap < 1) |
2603 | break; | 2437 | break; |
2604 | ASSERT(imap.br_blockcount >= 1); | 2438 | ASSERT(imap.br_blockcount >= 1); |
@@ -2661,7 +2495,6 @@ xfs_free_file_space( | |||
2661 | { | 2495 | { |
2662 | int committed; | 2496 | int committed; |
2663 | int done; | 2497 | int done; |
2664 | xfs_off_t end_dmi_offset; | ||
2665 | xfs_fileoff_t endoffset_fsb; | 2498 | xfs_fileoff_t endoffset_fsb; |
2666 | int error; | 2499 | int error; |
2667 | xfs_fsblock_t firstfsb; | 2500 | xfs_fsblock_t firstfsb; |
@@ -2680,7 +2513,7 @@ xfs_free_file_space( | |||
2680 | 2513 | ||
2681 | mp = ip->i_mount; | 2514 | mp = ip->i_mount; |
2682 | 2515 | ||
2683 | xfs_itrace_entry(ip); | 2516 | trace_xfs_free_file_space(ip); |
2684 | 2517 | ||
2685 | error = xfs_qm_dqattach(ip, 0); | 2518 | error = xfs_qm_dqattach(ip, 0); |
2686 | if (error) | 2519 | if (error) |
@@ -2691,19 +2524,7 @@ xfs_free_file_space( | |||
2691 | return error; | 2524 | return error; |
2692 | rt = XFS_IS_REALTIME_INODE(ip); | 2525 | rt = XFS_IS_REALTIME_INODE(ip); |
2693 | startoffset_fsb = XFS_B_TO_FSB(mp, offset); | 2526 | startoffset_fsb = XFS_B_TO_FSB(mp, offset); |
2694 | end_dmi_offset = offset + len; | 2527 | endoffset_fsb = XFS_B_TO_FSBT(mp, offset + len); |
2695 | endoffset_fsb = XFS_B_TO_FSBT(mp, end_dmi_offset); | ||
2696 | |||
2697 | if (offset < ip->i_size && (attr_flags & XFS_ATTR_DMI) == 0 && | ||
2698 | DM_EVENT_ENABLED(ip, DM_EVENT_WRITE)) { | ||
2699 | if (end_dmi_offset > ip->i_size) | ||
2700 | end_dmi_offset = ip->i_size; | ||
2701 | error = XFS_SEND_DATA(mp, DM_EVENT_WRITE, ip, | ||
2702 | offset, end_dmi_offset - offset, | ||
2703 | AT_DELAY_FLAG(attr_flags), NULL); | ||
2704 | if (error) | ||
2705 | return error; | ||
2706 | } | ||
2707 | 2528 | ||
2708 | if (attr_flags & XFS_ATTR_NOLOCK) | 2529 | if (attr_flags & XFS_ATTR_NOLOCK) |
2709 | need_iolock = 0; | 2530 | need_iolock = 0; |
@@ -2731,7 +2552,7 @@ xfs_free_file_space( | |||
2731 | if (rt && !xfs_sb_version_hasextflgbit(&mp->m_sb)) { | 2552 | if (rt && !xfs_sb_version_hasextflgbit(&mp->m_sb)) { |
2732 | nimap = 1; | 2553 | nimap = 1; |
2733 | error = xfs_bmapi(NULL, ip, startoffset_fsb, | 2554 | error = xfs_bmapi(NULL, ip, startoffset_fsb, |
2734 | 1, 0, NULL, 0, &imap, &nimap, NULL, NULL); | 2555 | 1, 0, NULL, 0, &imap, &nimap, NULL); |
2735 | if (error) | 2556 | if (error) |
2736 | goto out_unlock_iolock; | 2557 | goto out_unlock_iolock; |
2737 | ASSERT(nimap == 0 || nimap == 1); | 2558 | ASSERT(nimap == 0 || nimap == 1); |
@@ -2746,7 +2567,7 @@ xfs_free_file_space( | |||
2746 | } | 2567 | } |
2747 | nimap = 1; | 2568 | nimap = 1; |
2748 | error = xfs_bmapi(NULL, ip, endoffset_fsb - 1, | 2569 | error = xfs_bmapi(NULL, ip, endoffset_fsb - 1, |
2749 | 1, 0, NULL, 0, &imap, &nimap, NULL, NULL); | 2570 | 1, 0, NULL, 0, &imap, &nimap, NULL); |
2750 | if (error) | 2571 | if (error) |
2751 | goto out_unlock_iolock; | 2572 | goto out_unlock_iolock; |
2752 | ASSERT(nimap == 0 || nimap == 1); | 2573 | ASSERT(nimap == 0 || nimap == 1); |
@@ -2814,8 +2635,7 @@ xfs_free_file_space( | |||
2814 | if (error) | 2635 | if (error) |
2815 | goto error1; | 2636 | goto error1; |
2816 | 2637 | ||
2817 | xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); | 2638 | xfs_trans_ijoin(tp, ip); |
2818 | xfs_trans_ihold(tp, ip); | ||
2819 | 2639 | ||
2820 | /* | 2640 | /* |
2821 | * issue the bunmapi() call to free the blocks | 2641 | * issue the bunmapi() call to free the blocks |
@@ -2823,7 +2643,7 @@ xfs_free_file_space( | |||
2823 | xfs_bmap_init(&free_list, &firstfsb); | 2643 | xfs_bmap_init(&free_list, &firstfsb); |
2824 | error = xfs_bunmapi(tp, ip, startoffset_fsb, | 2644 | error = xfs_bunmapi(tp, ip, startoffset_fsb, |
2825 | endoffset_fsb - startoffset_fsb, | 2645 | endoffset_fsb - startoffset_fsb, |
2826 | 0, 2, &firstfsb, &free_list, NULL, &done); | 2646 | 0, 2, &firstfsb, &free_list, &done); |
2827 | if (error) { | 2647 | if (error) { |
2828 | goto error0; | 2648 | goto error0; |
2829 | } | 2649 | } |
@@ -2883,8 +2703,6 @@ xfs_change_file_space( | |||
2883 | xfs_trans_t *tp; | 2703 | xfs_trans_t *tp; |
2884 | struct iattr iattr; | 2704 | struct iattr iattr; |
2885 | 2705 | ||
2886 | xfs_itrace_entry(ip); | ||
2887 | |||
2888 | if (!S_ISREG(ip->i_d.di_mode)) | 2706 | if (!S_ISREG(ip->i_d.di_mode)) |
2889 | return XFS_ERROR(EINVAL); | 2707 | return XFS_ERROR(EINVAL); |
2890 | 2708 | ||
@@ -2985,8 +2803,7 @@ xfs_change_file_space( | |||
2985 | 2803 | ||
2986 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 2804 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
2987 | 2805 | ||
2988 | xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); | 2806 | xfs_trans_ijoin(tp, ip); |
2989 | xfs_trans_ihold(tp, ip); | ||
2990 | 2807 | ||
2991 | if ((attr_flags & XFS_ATTR_DMI) == 0) { | 2808 | if ((attr_flags & XFS_ATTR_DMI) == 0) { |
2992 | ip->i_d.di_mode &= ~S_ISUID; | 2809 | ip->i_d.di_mode &= ~S_ISUID; |