diff options
Diffstat (limited to 'fs/xfs/xfs_attr.c')
-rw-r--r-- | fs/xfs/xfs_attr.c | 91 |
1 files changed, 30 insertions, 61 deletions
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c index b9c196a53c42..c2568242a901 100644 --- a/fs/xfs/xfs_attr.c +++ b/fs/xfs/xfs_attr.c | |||
@@ -25,19 +25,13 @@ | |||
25 | #include "xfs_trans.h" | 25 | #include "xfs_trans.h" |
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" | ||
29 | #include "xfs_dmapi.h" | ||
30 | #include "xfs_mount.h" | 28 | #include "xfs_mount.h" |
31 | #include "xfs_da_btree.h" | 29 | #include "xfs_da_btree.h" |
32 | #include "xfs_bmap_btree.h" | 30 | #include "xfs_bmap_btree.h" |
33 | #include "xfs_alloc_btree.h" | ||
34 | #include "xfs_ialloc_btree.h" | ||
35 | #include "xfs_dir2_sf.h" | ||
36 | #include "xfs_attr_sf.h" | 31 | #include "xfs_attr_sf.h" |
37 | #include "xfs_dinode.h" | 32 | #include "xfs_dinode.h" |
38 | #include "xfs_inode.h" | 33 | #include "xfs_inode.h" |
39 | #include "xfs_alloc.h" | 34 | #include "xfs_alloc.h" |
40 | #include "xfs_btree.h" | ||
41 | #include "xfs_inode_item.h" | 35 | #include "xfs_inode_item.h" |
42 | #include "xfs_bmap.h" | 36 | #include "xfs_bmap.h" |
43 | #include "xfs_attr.h" | 37 | #include "xfs_attr.h" |
@@ -325,8 +319,7 @@ xfs_attr_set_int( | |||
325 | return (error); | 319 | return (error); |
326 | } | 320 | } |
327 | 321 | ||
328 | xfs_trans_ijoin(args.trans, dp, XFS_ILOCK_EXCL); | 322 | xfs_trans_ijoin(args.trans, dp); |
329 | xfs_trans_ihold(args.trans, dp); | ||
330 | 323 | ||
331 | /* | 324 | /* |
332 | * If the attribute list is non-existent or a shortform list, | 325 | * If the attribute list is non-existent or a shortform list, |
@@ -396,10 +389,8 @@ xfs_attr_set_int( | |||
396 | * bmap_finish() may have committed the last trans and started | 389 | * bmap_finish() may have committed the last trans and started |
397 | * a new one. We need the inode to be in all transactions. | 390 | * a new one. We need the inode to be in all transactions. |
398 | */ | 391 | */ |
399 | if (committed) { | 392 | if (committed) |
400 | xfs_trans_ijoin(args.trans, dp, XFS_ILOCK_EXCL); | 393 | xfs_trans_ijoin(args.trans, dp); |
401 | xfs_trans_ihold(args.trans, dp); | ||
402 | } | ||
403 | 394 | ||
404 | /* | 395 | /* |
405 | * Commit the leaf transformation. We'll need another (linked) | 396 | * Commit the leaf transformation. We'll need another (linked) |
@@ -544,8 +535,7 @@ xfs_attr_remove_int(xfs_inode_t *dp, struct xfs_name *name, int flags) | |||
544 | * No need to make quota reservations here. We expect to release some | 535 | * No need to make quota reservations here. We expect to release some |
545 | * blocks not allocate in the common case. | 536 | * blocks not allocate in the common case. |
546 | */ | 537 | */ |
547 | xfs_trans_ijoin(args.trans, dp, XFS_ILOCK_EXCL); | 538 | xfs_trans_ijoin(args.trans, dp); |
548 | xfs_trans_ihold(args.trans, dp); | ||
549 | 539 | ||
550 | /* | 540 | /* |
551 | * Decide on what work routines to call based on the inode size. | 541 | * Decide on what work routines to call based on the inode size. |
@@ -821,8 +811,7 @@ xfs_attr_inactive(xfs_inode_t *dp) | |||
821 | * No need to make quota reservations here. We expect to release some | 811 | * No need to make quota reservations here. We expect to release some |
822 | * blocks, not allocate, in the common case. | 812 | * blocks, not allocate, in the common case. |
823 | */ | 813 | */ |
824 | xfs_trans_ijoin(trans, dp, XFS_ILOCK_EXCL); | 814 | xfs_trans_ijoin(trans, dp); |
825 | xfs_trans_ihold(trans, dp); | ||
826 | 815 | ||
827 | /* | 816 | /* |
828 | * Decide on what work routines to call based on the inode size. | 817 | * Decide on what work routines to call based on the inode size. |
@@ -981,10 +970,8 @@ xfs_attr_leaf_addname(xfs_da_args_t *args) | |||
981 | * bmap_finish() may have committed the last trans and started | 970 | * bmap_finish() may have committed the last trans and started |
982 | * a new one. We need the inode to be in all transactions. | 971 | * a new one. We need the inode to be in all transactions. |
983 | */ | 972 | */ |
984 | if (committed) { | 973 | if (committed) |
985 | xfs_trans_ijoin(args->trans, dp, XFS_ILOCK_EXCL); | 974 | xfs_trans_ijoin(args->trans, dp); |
986 | xfs_trans_ihold(args->trans, dp); | ||
987 | } | ||
988 | 975 | ||
989 | /* | 976 | /* |
990 | * Commit the current trans (including the inode) and start | 977 | * Commit the current trans (including the inode) and start |
@@ -1085,10 +1072,8 @@ xfs_attr_leaf_addname(xfs_da_args_t *args) | |||
1085 | * and started a new one. We need the inode to be | 1072 | * and started a new one. We need the inode to be |
1086 | * in all transactions. | 1073 | * in all transactions. |
1087 | */ | 1074 | */ |
1088 | if (committed) { | 1075 | if (committed) |
1089 | xfs_trans_ijoin(args->trans, dp, XFS_ILOCK_EXCL); | 1076 | xfs_trans_ijoin(args->trans, dp); |
1090 | xfs_trans_ihold(args->trans, dp); | ||
1091 | } | ||
1092 | } else | 1077 | } else |
1093 | xfs_da_buf_done(bp); | 1078 | xfs_da_buf_done(bp); |
1094 | 1079 | ||
@@ -1161,10 +1146,8 @@ xfs_attr_leaf_removename(xfs_da_args_t *args) | |||
1161 | * bmap_finish() may have committed the last trans and started | 1146 | * bmap_finish() may have committed the last trans and started |
1162 | * a new one. We need the inode to be in all transactions. | 1147 | * a new one. We need the inode to be in all transactions. |
1163 | */ | 1148 | */ |
1164 | if (committed) { | 1149 | if (committed) |
1165 | xfs_trans_ijoin(args->trans, dp, XFS_ILOCK_EXCL); | 1150 | xfs_trans_ijoin(args->trans, dp); |
1166 | xfs_trans_ihold(args->trans, dp); | ||
1167 | } | ||
1168 | } else | 1151 | } else |
1169 | xfs_da_buf_done(bp); | 1152 | xfs_da_buf_done(bp); |
1170 | return(0); | 1153 | return(0); |
@@ -1317,10 +1300,8 @@ restart: | |||
1317 | * and started a new one. We need the inode to be | 1300 | * and started a new one. We need the inode to be |
1318 | * in all transactions. | 1301 | * in all transactions. |
1319 | */ | 1302 | */ |
1320 | if (committed) { | 1303 | if (committed) |
1321 | xfs_trans_ijoin(args->trans, dp, XFS_ILOCK_EXCL); | 1304 | xfs_trans_ijoin(args->trans, dp); |
1322 | xfs_trans_ihold(args->trans, dp); | ||
1323 | } | ||
1324 | 1305 | ||
1325 | /* | 1306 | /* |
1326 | * Commit the node conversion and start the next | 1307 | * Commit the node conversion and start the next |
@@ -1356,10 +1337,8 @@ restart: | |||
1356 | * bmap_finish() may have committed the last trans and started | 1337 | * bmap_finish() may have committed the last trans and started |
1357 | * a new one. We need the inode to be in all transactions. | 1338 | * a new one. We need the inode to be in all transactions. |
1358 | */ | 1339 | */ |
1359 | if (committed) { | 1340 | if (committed) |
1360 | xfs_trans_ijoin(args->trans, dp, XFS_ILOCK_EXCL); | 1341 | xfs_trans_ijoin(args->trans, dp); |
1361 | xfs_trans_ihold(args->trans, dp); | ||
1362 | } | ||
1363 | } else { | 1342 | } else { |
1364 | /* | 1343 | /* |
1365 | * Addition succeeded, update Btree hashvals. | 1344 | * Addition succeeded, update Btree hashvals. |
@@ -1470,10 +1449,8 @@ restart: | |||
1470 | * and started a new one. We need the inode to be | 1449 | * and started a new one. We need the inode to be |
1471 | * in all transactions. | 1450 | * in all transactions. |
1472 | */ | 1451 | */ |
1473 | if (committed) { | 1452 | if (committed) |
1474 | xfs_trans_ijoin(args->trans, dp, XFS_ILOCK_EXCL); | 1453 | xfs_trans_ijoin(args->trans, dp); |
1475 | xfs_trans_ihold(args->trans, dp); | ||
1476 | } | ||
1477 | } | 1454 | } |
1478 | 1455 | ||
1479 | /* | 1456 | /* |
@@ -1604,10 +1581,8 @@ xfs_attr_node_removename(xfs_da_args_t *args) | |||
1604 | * bmap_finish() may have committed the last trans and started | 1581 | * bmap_finish() may have committed the last trans and started |
1605 | * a new one. We need the inode to be in all transactions. | 1582 | * a new one. We need the inode to be in all transactions. |
1606 | */ | 1583 | */ |
1607 | if (committed) { | 1584 | if (committed) |
1608 | xfs_trans_ijoin(args->trans, dp, XFS_ILOCK_EXCL); | 1585 | xfs_trans_ijoin(args->trans, dp); |
1609 | xfs_trans_ihold(args->trans, dp); | ||
1610 | } | ||
1611 | 1586 | ||
1612 | /* | 1587 | /* |
1613 | * Commit the Btree join operation and start a new trans. | 1588 | * Commit the Btree join operation and start a new trans. |
@@ -1658,10 +1633,8 @@ xfs_attr_node_removename(xfs_da_args_t *args) | |||
1658 | * and started a new one. We need the inode to be | 1633 | * and started a new one. We need the inode to be |
1659 | * in all transactions. | 1634 | * in all transactions. |
1660 | */ | 1635 | */ |
1661 | if (committed) { | 1636 | if (committed) |
1662 | xfs_trans_ijoin(args->trans, dp, XFS_ILOCK_EXCL); | 1637 | xfs_trans_ijoin(args->trans, dp); |
1663 | xfs_trans_ihold(args->trans, dp); | ||
1664 | } | ||
1665 | } else | 1638 | } else |
1666 | xfs_da_brelse(args->trans, bp); | 1639 | xfs_da_brelse(args->trans, bp); |
1667 | } | 1640 | } |
@@ -2004,7 +1977,7 @@ xfs_attr_rmtval_get(xfs_da_args_t *args) | |||
2004 | error = xfs_bmapi(args->trans, args->dp, (xfs_fileoff_t)lblkno, | 1977 | error = xfs_bmapi(args->trans, args->dp, (xfs_fileoff_t)lblkno, |
2005 | args->rmtblkcnt, | 1978 | args->rmtblkcnt, |
2006 | XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA, | 1979 | XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA, |
2007 | NULL, 0, map, &nmap, NULL, NULL); | 1980 | NULL, 0, map, &nmap, NULL); |
2008 | if (error) | 1981 | if (error) |
2009 | return(error); | 1982 | return(error); |
2010 | ASSERT(nmap >= 1); | 1983 | ASSERT(nmap >= 1); |
@@ -2083,7 +2056,7 @@ xfs_attr_rmtval_set(xfs_da_args_t *args) | |||
2083 | XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA | | 2056 | XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA | |
2084 | XFS_BMAPI_WRITE, | 2057 | XFS_BMAPI_WRITE, |
2085 | args->firstblock, args->total, &map, &nmap, | 2058 | args->firstblock, args->total, &map, &nmap, |
2086 | args->flist, NULL); | 2059 | args->flist); |
2087 | if (!error) { | 2060 | if (!error) { |
2088 | error = xfs_bmap_finish(&args->trans, args->flist, | 2061 | error = xfs_bmap_finish(&args->trans, args->flist, |
2089 | &committed); | 2062 | &committed); |
@@ -2099,10 +2072,8 @@ xfs_attr_rmtval_set(xfs_da_args_t *args) | |||
2099 | * bmap_finish() may have committed the last trans and started | 2072 | * bmap_finish() may have committed the last trans and started |
2100 | * a new one. We need the inode to be in all transactions. | 2073 | * a new one. We need the inode to be in all transactions. |
2101 | */ | 2074 | */ |
2102 | if (committed) { | 2075 | if (committed) |
2103 | xfs_trans_ijoin(args->trans, dp, XFS_ILOCK_EXCL); | 2076 | xfs_trans_ijoin(args->trans, dp); |
2104 | xfs_trans_ihold(args->trans, dp); | ||
2105 | } | ||
2106 | 2077 | ||
2107 | ASSERT(nmap == 1); | 2078 | ASSERT(nmap == 1); |
2108 | ASSERT((map.br_startblock != DELAYSTARTBLOCK) && | 2079 | ASSERT((map.br_startblock != DELAYSTARTBLOCK) && |
@@ -2136,7 +2107,7 @@ xfs_attr_rmtval_set(xfs_da_args_t *args) | |||
2136 | args->rmtblkcnt, | 2107 | args->rmtblkcnt, |
2137 | XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA, | 2108 | XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA, |
2138 | args->firstblock, 0, &map, &nmap, | 2109 | args->firstblock, 0, &map, &nmap, |
2139 | NULL, NULL); | 2110 | NULL); |
2140 | if (error) { | 2111 | if (error) { |
2141 | return(error); | 2112 | return(error); |
2142 | } | 2113 | } |
@@ -2201,7 +2172,7 @@ xfs_attr_rmtval_remove(xfs_da_args_t *args) | |||
2201 | args->rmtblkcnt, | 2172 | args->rmtblkcnt, |
2202 | XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA, | 2173 | XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA, |
2203 | args->firstblock, 0, &map, &nmap, | 2174 | args->firstblock, 0, &map, &nmap, |
2204 | args->flist, NULL); | 2175 | args->flist); |
2205 | if (error) { | 2176 | if (error) { |
2206 | return(error); | 2177 | return(error); |
2207 | } | 2178 | } |
@@ -2239,7 +2210,7 @@ xfs_attr_rmtval_remove(xfs_da_args_t *args) | |||
2239 | error = xfs_bunmapi(args->trans, args->dp, lblkno, blkcnt, | 2210 | error = xfs_bunmapi(args->trans, args->dp, lblkno, blkcnt, |
2240 | XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA, | 2211 | XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA, |
2241 | 1, args->firstblock, args->flist, | 2212 | 1, args->firstblock, args->flist, |
2242 | NULL, &done); | 2213 | &done); |
2243 | if (!error) { | 2214 | if (!error) { |
2244 | error = xfs_bmap_finish(&args->trans, args->flist, | 2215 | error = xfs_bmap_finish(&args->trans, args->flist, |
2245 | &committed); | 2216 | &committed); |
@@ -2255,10 +2226,8 @@ xfs_attr_rmtval_remove(xfs_da_args_t *args) | |||
2255 | * bmap_finish() may have committed the last trans and started | 2226 | * bmap_finish() may have committed the last trans and started |
2256 | * a new one. We need the inode to be in all transactions. | 2227 | * a new one. We need the inode to be in all transactions. |
2257 | */ | 2228 | */ |
2258 | if (committed) { | 2229 | if (committed) |
2259 | xfs_trans_ijoin(args->trans, args->dp, XFS_ILOCK_EXCL); | 2230 | xfs_trans_ijoin(args->trans, args->dp); |
2260 | xfs_trans_ihold(args->trans, args->dp); | ||
2261 | } | ||
2262 | 2231 | ||
2263 | /* | 2232 | /* |
2264 | * Close out trans and start the next one in the chain. | 2233 | * Close out trans and start the next one in the chain. |