[XFS] This fix prevents bulkstat from spinning in an infinite loop.
Here 'agino' increments through the inodes in an allocation group. At the end of the innermost 'for' loop it will hold the value of the next inode to look at (ie the first inode in the next cluster/chunk). Assigning 'lastino' to 'agino' resets it to the last inode in the last inode cluster we just looked at. This causes us to look up the very same cluster and examine all the inodes all over again, and again, and again... We also want to set 'lastino' for the cases when we're not interested in the inode so that the next call to bulkstat won't re-examine the same uninteresting inodes. SGI-PV: 971064 SGI-Modid: xfs-linux-melb:xfs-kern:29840a Signed-off-by: Lachlan McIlroy <lachlan@sgi.com> Signed-off-by: David Chinner <dgc@sgi.com> Signed-off-by: Tim Shimmin <tes@sgi.com>
This commit is contained in:
parent
3e5daf05a0
commit
c2cba57e83
1 changed files with 9 additions and 6 deletions
|
@ -619,21 +619,25 @@ xfs_bulkstat(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ino = XFS_AGINO_TO_INO(mp, agno, agino);
|
||||||
|
bno = XFS_AGB_TO_DADDR(mp, agno, agbno);
|
||||||
/*
|
/*
|
||||||
* Skip if this inode is free.
|
* Skip if this inode is free.
|
||||||
*/
|
*/
|
||||||
if (XFS_INOBT_MASK(chunkidx) & irbp->ir_free)
|
if (XFS_INOBT_MASK(chunkidx) & irbp->ir_free) {
|
||||||
|
lastino = ino;
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* Count used inodes as free so we can tell
|
* Count used inodes as free so we can tell
|
||||||
* when the chunk is used up.
|
* when the chunk is used up.
|
||||||
*/
|
*/
|
||||||
irbp->ir_freecount++;
|
irbp->ir_freecount++;
|
||||||
ino = XFS_AGINO_TO_INO(mp, agno, agino);
|
|
||||||
bno = XFS_AGB_TO_DADDR(mp, agno, agbno);
|
|
||||||
if (!xfs_bulkstat_use_dinode(mp, flags, bp,
|
if (!xfs_bulkstat_use_dinode(mp, flags, bp,
|
||||||
clustidx, &dip))
|
clustidx, &dip)) {
|
||||||
|
lastino = ino;
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* If we need to do an iget, cannot hold bp.
|
* If we need to do an iget, cannot hold bp.
|
||||||
* Drop it, until starting the next cluster.
|
* Drop it, until starting the next cluster.
|
||||||
|
@ -694,8 +698,7 @@ xfs_bulkstat(
|
||||||
if (end_of_ag) {
|
if (end_of_ag) {
|
||||||
agno++;
|
agno++;
|
||||||
agino = 0;
|
agino = 0;
|
||||||
} else
|
}
|
||||||
agino = XFS_INO_TO_AGINO(mp, lastino);
|
|
||||||
} else
|
} else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue