diff options
author | Nathan Scott <nathans@sgi.com> | 2006-03-17 01:26:04 -0500 |
---|---|---|
committer | Nathan Scott <nathans@sgi.com> | 2006-03-17 01:26:04 -0500 |
commit | b12dd34298cf0cff9f337f667045335140873039 (patch) | |
tree | 0f2ef353bc17f247e538a28137a0a3f8ad3b5e0e /fs/xfs/xfs_inode.c | |
parent | 2ddd5928d01ca8eb49f55166411b64a5844a8959 (diff) |
[XFS] Fix an infinite loop issue in bulkstat when a corrupt inode is
detected. Thanks to Roger Willcocks.
SGI-PV: 951054
SGI-Modid: xfs-linux-melb:xfs-kern:25477a
Signed-off-by: Nathan Scott <nathans@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_inode.c')
-rw-r--r-- | fs/xfs/xfs_inode.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 86a8451d10fc..b1e95707e7cf 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -253,7 +253,8 @@ xfs_itobp( | |||
253 | xfs_inode_t *ip, | 253 | xfs_inode_t *ip, |
254 | xfs_dinode_t **dipp, | 254 | xfs_dinode_t **dipp, |
255 | xfs_buf_t **bpp, | 255 | xfs_buf_t **bpp, |
256 | xfs_daddr_t bno) | 256 | xfs_daddr_t bno, |
257 | uint imap_flags) | ||
257 | { | 258 | { |
258 | xfs_buf_t *bp; | 259 | xfs_buf_t *bp; |
259 | int error; | 260 | int error; |
@@ -269,10 +270,9 @@ xfs_itobp( | |||
269 | * inode on disk. | 270 | * inode on disk. |
270 | */ | 271 | */ |
271 | imap.im_blkno = bno; | 272 | imap.im_blkno = bno; |
272 | error = xfs_imap(mp, tp, ip->i_ino, &imap, XFS_IMAP_LOOKUP); | 273 | if ((error = xfs_imap(mp, tp, ip->i_ino, &imap, |
273 | if (error != 0) { | 274 | XFS_IMAP_LOOKUP | imap_flags))) |
274 | return error; | 275 | return error; |
275 | } | ||
276 | 276 | ||
277 | /* | 277 | /* |
278 | * If the inode number maps to a block outside the bounds | 278 | * If the inode number maps to a block outside the bounds |
@@ -336,9 +336,10 @@ xfs_itobp( | |||
336 | * (if DEBUG kernel) or the first inode in the buffer, otherwise. | 336 | * (if DEBUG kernel) or the first inode in the buffer, otherwise. |
337 | */ | 337 | */ |
338 | #ifdef DEBUG | 338 | #ifdef DEBUG |
339 | ni = BBTOB(imap.im_len) >> mp->m_sb.sb_inodelog; | 339 | ni = (imap_flags & XFS_IMAP_BULKSTAT) ? 0 : |
340 | (BBTOB(imap.im_len) >> mp->m_sb.sb_inodelog); | ||
340 | #else | 341 | #else |
341 | ni = 1; | 342 | ni = (imap_flags & XFS_IMAP_BULKSTAT) ? 0 : 1; |
342 | #endif | 343 | #endif |
343 | for (i = 0; i < ni; i++) { | 344 | for (i = 0; i < ni; i++) { |
344 | int di_ok; | 345 | int di_ok; |
@@ -868,9 +869,8 @@ xfs_iread( | |||
868 | * return NULL as well. Set i_blkno to 0 so that xfs_itobp() will | 869 | * return NULL as well. Set i_blkno to 0 so that xfs_itobp() will |
869 | * know that this is a new incore inode. | 870 | * know that this is a new incore inode. |
870 | */ | 871 | */ |
871 | error = xfs_itobp(mp, tp, ip, &dip, &bp, bno); | 872 | error = xfs_itobp(mp, tp, ip, &dip, &bp, bno, 0); |
872 | 873 | if (error) { | |
873 | if (error != 0) { | ||
874 | kmem_zone_free(xfs_inode_zone, ip); | 874 | kmem_zone_free(xfs_inode_zone, ip); |
875 | return error; | 875 | return error; |
876 | } | 876 | } |
@@ -1895,7 +1895,7 @@ xfs_iunlink( | |||
1895 | * Here we put the head pointer into our next pointer, | 1895 | * Here we put the head pointer into our next pointer, |
1896 | * and then we fall through to point the head at us. | 1896 | * and then we fall through to point the head at us. |
1897 | */ | 1897 | */ |
1898 | error = xfs_itobp(mp, tp, ip, &dip, &ibp, 0); | 1898 | error = xfs_itobp(mp, tp, ip, &dip, &ibp, 0, 0); |
1899 | if (error) { | 1899 | if (error) { |
1900 | return error; | 1900 | return error; |
1901 | } | 1901 | } |
@@ -2004,7 +2004,7 @@ xfs_iunlink_remove( | |||
2004 | * of dealing with the buffer when there is no need to | 2004 | * of dealing with the buffer when there is no need to |
2005 | * change it. | 2005 | * change it. |
2006 | */ | 2006 | */ |
2007 | error = xfs_itobp(mp, tp, ip, &dip, &ibp, 0); | 2007 | error = xfs_itobp(mp, tp, ip, &dip, &ibp, 0, 0); |
2008 | if (error) { | 2008 | if (error) { |
2009 | cmn_err(CE_WARN, | 2009 | cmn_err(CE_WARN, |
2010 | "xfs_iunlink_remove: xfs_itobp() returned an error %d on %s. Returning error.", | 2010 | "xfs_iunlink_remove: xfs_itobp() returned an error %d on %s. Returning error.", |
@@ -2066,7 +2066,7 @@ xfs_iunlink_remove( | |||
2066 | * Now last_ibp points to the buffer previous to us on | 2066 | * Now last_ibp points to the buffer previous to us on |
2067 | * the unlinked list. Pull us from the list. | 2067 | * the unlinked list. Pull us from the list. |
2068 | */ | 2068 | */ |
2069 | error = xfs_itobp(mp, tp, ip, &dip, &ibp, 0); | 2069 | error = xfs_itobp(mp, tp, ip, &dip, &ibp, 0, 0); |
2070 | if (error) { | 2070 | if (error) { |
2071 | cmn_err(CE_WARN, | 2071 | cmn_err(CE_WARN, |
2072 | "xfs_iunlink_remove: xfs_itobp() returned an error %d on %s. Returning error.", | 2072 | "xfs_iunlink_remove: xfs_itobp() returned an error %d on %s. Returning error.", |
@@ -3023,8 +3023,8 @@ xfs_iflush( | |||
3023 | /* | 3023 | /* |
3024 | * Get the buffer containing the on-disk inode. | 3024 | * Get the buffer containing the on-disk inode. |
3025 | */ | 3025 | */ |
3026 | error = xfs_itobp(mp, NULL, ip, &dip, &bp, 0); | 3026 | error = xfs_itobp(mp, NULL, ip, &dip, &bp, 0, 0); |
3027 | if (error != 0) { | 3027 | if (error) { |
3028 | xfs_ifunlock(ip); | 3028 | xfs_ifunlock(ip); |
3029 | return error; | 3029 | return error; |
3030 | } | 3030 | } |