diff options
Diffstat (limited to 'fs/xfs/xfs_attr.c')
-rw-r--r-- | fs/xfs/xfs_attr.c | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c index 01d2072fb6d..160bcdc34a6 100644 --- a/fs/xfs/xfs_attr.c +++ b/fs/xfs/xfs_attr.c | |||
@@ -822,17 +822,21 @@ xfs_attr_inactive(xfs_inode_t *dp) | |||
822 | error = xfs_attr_root_inactive(&trans, dp); | 822 | error = xfs_attr_root_inactive(&trans, dp); |
823 | if (error) | 823 | if (error) |
824 | goto out; | 824 | goto out; |
825 | |||
825 | /* | 826 | /* |
826 | * signal synchronous inactive transactions unless this | 827 | * Signal synchronous inactive transactions unless this is a |
827 | * is a synchronous mount filesystem in which case we | 828 | * synchronous mount filesystem in which case we know that we're here |
828 | * know that we're here because we've been called out of | 829 | * because we've been called out of xfs_inactive which means that the |
829 | * xfs_inactive which means that the last reference is gone | 830 | * last reference is gone and the unlink transaction has already hit |
830 | * and the unlink transaction has already hit the disk so | 831 | * the disk so async inactive transactions are safe. |
831 | * async inactive transactions are safe. | ||
832 | */ | 832 | */ |
833 | if ((error = xfs_itruncate_finish(&trans, dp, 0LL, XFS_ATTR_FORK, | 833 | if (!(mp->m_flags & XFS_MOUNT_WSYNC)) { |
834 | (!(mp->m_flags & XFS_MOUNT_WSYNC) | 834 | if (dp->i_d.di_anextents > 0) |
835 | ? 1 : 0)))) | 835 | xfs_trans_set_sync(trans); |
836 | } | ||
837 | |||
838 | error = xfs_itruncate_extents(&trans, dp, XFS_ATTR_FORK, 0); | ||
839 | if (error) | ||
836 | goto out; | 840 | goto out; |
837 | 841 | ||
838 | /* | 842 | /* |
@@ -1199,7 +1203,7 @@ xfs_attr_leaf_list(xfs_attr_list_context_t *context) | |||
1199 | return XFS_ERROR(error); | 1203 | return XFS_ERROR(error); |
1200 | ASSERT(bp != NULL); | 1204 | ASSERT(bp != NULL); |
1201 | leaf = bp->data; | 1205 | leaf = bp->data; |
1202 | if (unlikely(be16_to_cpu(leaf->hdr.info.magic) != XFS_ATTR_LEAF_MAGIC)) { | 1206 | if (unlikely(leaf->hdr.info.magic != cpu_to_be16(XFS_ATTR_LEAF_MAGIC))) { |
1203 | XFS_CORRUPTION_ERROR("xfs_attr_leaf_list", XFS_ERRLEVEL_LOW, | 1207 | XFS_CORRUPTION_ERROR("xfs_attr_leaf_list", XFS_ERRLEVEL_LOW, |
1204 | context->dp->i_mount, leaf); | 1208 | context->dp->i_mount, leaf); |
1205 | xfs_da_brelse(NULL, bp); | 1209 | xfs_da_brelse(NULL, bp); |
@@ -1606,9 +1610,8 @@ xfs_attr_node_removename(xfs_da_args_t *args) | |||
1606 | XFS_ATTR_FORK); | 1610 | XFS_ATTR_FORK); |
1607 | if (error) | 1611 | if (error) |
1608 | goto out; | 1612 | goto out; |
1609 | ASSERT(be16_to_cpu(((xfs_attr_leafblock_t *) | 1613 | ASSERT((((xfs_attr_leafblock_t *)bp->data)->hdr.info.magic) == |
1610 | bp->data)->hdr.info.magic) | 1614 | cpu_to_be16(XFS_ATTR_LEAF_MAGIC)); |
1611 | == XFS_ATTR_LEAF_MAGIC); | ||
1612 | 1615 | ||
1613 | if ((forkoff = xfs_attr_shortform_allfit(bp, dp))) { | 1616 | if ((forkoff = xfs_attr_shortform_allfit(bp, dp))) { |
1614 | xfs_bmap_init(args->flist, args->firstblock); | 1617 | xfs_bmap_init(args->flist, args->firstblock); |
@@ -1873,11 +1876,11 @@ xfs_attr_node_list(xfs_attr_list_context_t *context) | |||
1873 | return(XFS_ERROR(EFSCORRUPTED)); | 1876 | return(XFS_ERROR(EFSCORRUPTED)); |
1874 | } | 1877 | } |
1875 | node = bp->data; | 1878 | node = bp->data; |
1876 | if (be16_to_cpu(node->hdr.info.magic) | 1879 | if (node->hdr.info.magic == |
1877 | == XFS_ATTR_LEAF_MAGIC) | 1880 | cpu_to_be16(XFS_ATTR_LEAF_MAGIC)) |
1878 | break; | 1881 | break; |
1879 | if (unlikely(be16_to_cpu(node->hdr.info.magic) | 1882 | if (unlikely(node->hdr.info.magic != |
1880 | != XFS_DA_NODE_MAGIC)) { | 1883 | cpu_to_be16(XFS_DA_NODE_MAGIC))) { |
1881 | XFS_CORRUPTION_ERROR("xfs_attr_node_list(3)", | 1884 | XFS_CORRUPTION_ERROR("xfs_attr_node_list(3)", |
1882 | XFS_ERRLEVEL_LOW, | 1885 | XFS_ERRLEVEL_LOW, |
1883 | context->dp->i_mount, | 1886 | context->dp->i_mount, |
@@ -1912,8 +1915,8 @@ xfs_attr_node_list(xfs_attr_list_context_t *context) | |||
1912 | */ | 1915 | */ |
1913 | for (;;) { | 1916 | for (;;) { |
1914 | leaf = bp->data; | 1917 | leaf = bp->data; |
1915 | if (unlikely(be16_to_cpu(leaf->hdr.info.magic) | 1918 | if (unlikely(leaf->hdr.info.magic != |
1916 | != XFS_ATTR_LEAF_MAGIC)) { | 1919 | cpu_to_be16(XFS_ATTR_LEAF_MAGIC))) { |
1917 | XFS_CORRUPTION_ERROR("xfs_attr_node_list(4)", | 1920 | XFS_CORRUPTION_ERROR("xfs_attr_node_list(4)", |
1918 | XFS_ERRLEVEL_LOW, | 1921 | XFS_ERRLEVEL_LOW, |
1919 | context->dp->i_mount, leaf); | 1922 | context->dp->i_mount, leaf); |
@@ -2118,8 +2121,7 @@ xfs_attr_rmtval_set(xfs_da_args_t *args) | |||
2118 | 2121 | ||
2119 | bp = xfs_buf_get(mp->m_ddev_targp, dblkno, blkcnt, | 2122 | bp = xfs_buf_get(mp->m_ddev_targp, dblkno, blkcnt, |
2120 | XBF_LOCK | XBF_DONT_BLOCK); | 2123 | XBF_LOCK | XBF_DONT_BLOCK); |
2121 | ASSERT(bp); | 2124 | ASSERT(!xfs_buf_geterror(bp)); |
2122 | ASSERT(!XFS_BUF_GETERROR(bp)); | ||
2123 | 2125 | ||
2124 | tmp = (valuelen < XFS_BUF_SIZE(bp)) ? valuelen : | 2126 | tmp = (valuelen < XFS_BUF_SIZE(bp)) ? valuelen : |
2125 | XFS_BUF_SIZE(bp); | 2127 | XFS_BUF_SIZE(bp); |