aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorChandra Seetharaman <sekharan@us.ibm.com>2011-09-20 09:56:55 -0400
committerAlex Elder <aelder@sgi.com>2011-10-11 22:15:01 -0400
commit2a30f36d9069b0646dcdd73def5fd7ab674bffd6 (patch)
treed7be19830eaa3c85b9e06882ccec369630ce9ca2 /fs/xfs
parentb522950f0ab8551f2ef56c210ebd50e6c6396601 (diff)
xfs: Check the return value of xfs_trans_get_buf()
Check the return value of xfs_trans_get_buf() and fail appropriately. Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com> Signed-off-by: Alex Elder <aelder@sgi.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/xfs_attr_leaf.c2
-rw-r--r--fs/xfs/xfs_btree.c3
-rw-r--r--fs/xfs/xfs_dquot.c5
-rw-r--r--fs/xfs/xfs_ialloc.c13
-rw-r--r--fs/xfs/xfs_inode.c9
-rw-r--r--fs/xfs/xfs_vnodeops.c9
6 files changed, 30 insertions, 11 deletions
diff --git a/fs/xfs/xfs_attr_leaf.c b/fs/xfs/xfs_attr_leaf.c
index 8fad9602542b..58c3add07b65 100644
--- a/fs/xfs/xfs_attr_leaf.c
+++ b/fs/xfs/xfs_attr_leaf.c
@@ -2948,6 +2948,8 @@ xfs_attr_leaf_freextent(xfs_trans_t **trans, xfs_inode_t *dp,
2948 bp = xfs_trans_get_buf(*trans, 2948 bp = xfs_trans_get_buf(*trans,
2949 dp->i_mount->m_ddev_targp, 2949 dp->i_mount->m_ddev_targp,
2950 dblkno, dblkcnt, XBF_LOCK); 2950 dblkno, dblkcnt, XBF_LOCK);
2951 if (!bp)
2952 return ENOMEM;
2951 xfs_trans_binval(*trans, bp); 2953 xfs_trans_binval(*trans, bp);
2952 /* 2954 /*
2953 * Roll to next transaction. 2955 * Roll to next transaction.
diff --git a/fs/xfs/xfs_btree.c b/fs/xfs/xfs_btree.c
index 2b9fd385e27d..28cc0199dc1f 100644
--- a/fs/xfs/xfs_btree.c
+++ b/fs/xfs/xfs_btree.c
@@ -970,7 +970,8 @@ xfs_btree_get_buf_block(
970 *bpp = xfs_trans_get_buf(cur->bc_tp, mp->m_ddev_targp, d, 970 *bpp = xfs_trans_get_buf(cur->bc_tp, mp->m_ddev_targp, d,
971 mp->m_bsize, flags); 971 mp->m_bsize, flags);
972 972
973 ASSERT(!xfs_buf_geterror(*bpp)); 973 if (!*bpp)
974 return ENOMEM;
974 975
975 *block = XFS_BUF_TO_BLOCK(*bpp); 976 *block = XFS_BUF_TO_BLOCK(*bpp);
976 return 0; 977 return 0;
diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c
index 3e2ccaedc51e..0c5fe66ce92b 100644
--- a/fs/xfs/xfs_dquot.c
+++ b/fs/xfs/xfs_dquot.c
@@ -402,8 +402,11 @@ xfs_qm_dqalloc(
402 dqp->q_blkno, 402 dqp->q_blkno,
403 mp->m_quotainfo->qi_dqchunklen, 403 mp->m_quotainfo->qi_dqchunklen,
404 0); 404 0);
405 if (!bp || (error = xfs_buf_geterror(bp))) 405
406 error = xfs_buf_geterror(bp);
407 if (error)
406 goto error1; 408 goto error1;
409
407 /* 410 /*
408 * Make a chunk of dquots out of this buffer and log 411 * Make a chunk of dquots out of this buffer and log
409 * the entire thing. 412 * the entire thing.
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c
index 9f24ec28283b..207e0b0c0730 100644
--- a/fs/xfs/xfs_ialloc.c
+++ b/fs/xfs/xfs_ialloc.c
@@ -150,7 +150,7 @@ xfs_check_agi_freecount(
150/* 150/*
151 * Initialise a new set of inodes. 151 * Initialise a new set of inodes.
152 */ 152 */
153STATIC void 153STATIC int
154xfs_ialloc_inode_init( 154xfs_ialloc_inode_init(
155 struct xfs_mount *mp, 155 struct xfs_mount *mp,
156 struct xfs_trans *tp, 156 struct xfs_trans *tp,
@@ -202,8 +202,8 @@ xfs_ialloc_inode_init(
202 fbuf = xfs_trans_get_buf(tp, mp->m_ddev_targp, d, 202 fbuf = xfs_trans_get_buf(tp, mp->m_ddev_targp, d,
203 mp->m_bsize * blks_per_cluster, 203 mp->m_bsize * blks_per_cluster,
204 XBF_LOCK); 204 XBF_LOCK);
205 ASSERT(!xfs_buf_geterror(fbuf)); 205 if (!fbuf)
206 206 return ENOMEM;
207 /* 207 /*
208 * Initialize all inodes in this buffer and then log them. 208 * Initialize all inodes in this buffer and then log them.
209 * 209 *
@@ -225,6 +225,7 @@ xfs_ialloc_inode_init(
225 } 225 }
226 xfs_trans_inode_alloc_buf(tp, fbuf); 226 xfs_trans_inode_alloc_buf(tp, fbuf);
227 } 227 }
228 return 0;
228} 229}
229 230
230/* 231/*
@@ -369,9 +370,11 @@ xfs_ialloc_ag_alloc(
369 * rather than a linear progression to prevent the next generation 370 * rather than a linear progression to prevent the next generation
370 * number from being easily guessable. 371 * number from being easily guessable.
371 */ 372 */
372 xfs_ialloc_inode_init(args.mp, tp, agno, args.agbno, args.len, 373 error = xfs_ialloc_inode_init(args.mp, tp, agno, args.agbno,
373 random32()); 374 args.len, random32());
374 375
376 if (error)
377 return error;
375 /* 378 /*
376 * Convert the results. 379 * Convert the results.
377 */ 380 */
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 7f237ba3c292..d689253fdfda 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -1644,7 +1644,7 @@ xfs_iunlink_remove(
1644 * inodes that are in memory - they all must be marked stale and attached to 1644 * inodes that are in memory - they all must be marked stale and attached to
1645 * the cluster buffer. 1645 * the cluster buffer.
1646 */ 1646 */
1647STATIC void 1647STATIC int
1648xfs_ifree_cluster( 1648xfs_ifree_cluster(
1649 xfs_inode_t *free_ip, 1649 xfs_inode_t *free_ip,
1650 xfs_trans_t *tp, 1650 xfs_trans_t *tp,
@@ -1690,6 +1690,8 @@ xfs_ifree_cluster(
1690 mp->m_bsize * blks_per_cluster, 1690 mp->m_bsize * blks_per_cluster,
1691 XBF_LOCK); 1691 XBF_LOCK);
1692 1692
1693 if (!bp)
1694 return ENOMEM;
1693 /* 1695 /*
1694 * Walk the inodes already attached to the buffer and mark them 1696 * Walk the inodes already attached to the buffer and mark them
1695 * stale. These will all have the flush locks held, so an 1697 * stale. These will all have the flush locks held, so an
@@ -1799,6 +1801,7 @@ retry:
1799 } 1801 }
1800 1802
1801 xfs_perag_put(pag); 1803 xfs_perag_put(pag);
1804 return 0;
1802} 1805}
1803 1806
1804/* 1807/*
@@ -1878,10 +1881,10 @@ xfs_ifree(
1878 dip->di_mode = 0; 1881 dip->di_mode = 0;
1879 1882
1880 if (delete) { 1883 if (delete) {
1881 xfs_ifree_cluster(ip, tp, first_ino); 1884 error = xfs_ifree_cluster(ip, tp, first_ino);
1882 } 1885 }
1883 1886
1884 return 0; 1887 return error;
1885} 1888}
1886 1889
1887/* 1890/*
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index c2ff0fc86567..0d1caec873a1 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -308,6 +308,10 @@ xfs_inactive_symlink_rmt(
308 bp = xfs_trans_get_buf(tp, mp->m_ddev_targp, 308 bp = xfs_trans_get_buf(tp, mp->m_ddev_targp,
309 XFS_FSB_TO_DADDR(mp, mval[i].br_startblock), 309 XFS_FSB_TO_DADDR(mp, mval[i].br_startblock),
310 XFS_FSB_TO_BB(mp, mval[i].br_blockcount), 0); 310 XFS_FSB_TO_BB(mp, mval[i].br_blockcount), 0);
311 if (!bp) {
312 error = ENOMEM;
313 goto error1;
314 }
311 xfs_trans_binval(tp, bp); 315 xfs_trans_binval(tp, bp);
312 } 316 }
313 /* 317 /*
@@ -1648,7 +1652,10 @@ xfs_symlink(
1648 byte_cnt = XFS_FSB_TO_B(mp, mval[n].br_blockcount); 1652 byte_cnt = XFS_FSB_TO_B(mp, mval[n].br_blockcount);
1649 bp = xfs_trans_get_buf(tp, mp->m_ddev_targp, d, 1653 bp = xfs_trans_get_buf(tp, mp->m_ddev_targp, d,
1650 BTOBB(byte_cnt), 0); 1654 BTOBB(byte_cnt), 0);
1651 ASSERT(!xfs_buf_geterror(bp)); 1655 if (!bp) {
1656 error = ENOMEM;
1657 goto error2;
1658 }
1652 if (pathlen < byte_cnt) { 1659 if (pathlen < byte_cnt) {
1653 byte_cnt = pathlen; 1660 byte_cnt = pathlen;
1654 } 1661 }