diff options
author | Christoph Hellwig <hch@infradead.org> | 2008-10-30 03:04:13 -0400 |
---|---|---|
committer | Lachlan McIlroy <lachlan@redback.melbourne.sgi.com> | 2008-10-30 03:04:13 -0400 |
commit | c679eef0520eb3c2c731fce505e61b8ef9469aac (patch) | |
tree | 6a3cdcb882282d10dac7bb45e194fc473dd3940d /fs/xfs/xfs_itable.c | |
parent | 455486b9ccdd0a1d7432a03302f549b1c917c181 (diff) |
[XFS] stop using xfs_itobp in xfs_bulkstat
xfs_bulkstat only wants the dinode, offset and buffer from a given inode
number. Instead of using xfs_itobp on a fake inode which is complicated
and currently leads to leaks of the security data just use xfs_inotobp
which is designed to do exactly the kind of lookup xfs_bulkstat wants. The
only thing that's missing in xfs_inotobp is a flags paramter that let's us
pass down XFS_IMAP_BULKSTAT, but that can easily added.
SGI-PV: 987246
SGI-Modid: xfs-linux-melb:xfs-kern:32397a
Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Signed-off-by: David Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/xfs_itable.c')
-rw-r--r-- | fs/xfs/xfs_itable.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/fs/xfs/xfs_itable.c b/fs/xfs/xfs_itable.c index 42a214b8df9e..35118032a5d6 100644 --- a/fs/xfs/xfs_itable.c +++ b/fs/xfs/xfs_itable.c | |||
@@ -359,7 +359,6 @@ xfs_bulkstat( | |||
359 | int ubused; /* bytes used by formatter */ | 359 | int ubused; /* bytes used by formatter */ |
360 | xfs_buf_t *bp; /* ptr to on-disk inode cluster buf */ | 360 | xfs_buf_t *bp; /* ptr to on-disk inode cluster buf */ |
361 | xfs_dinode_t *dip; /* ptr into bp for specific inode */ | 361 | xfs_dinode_t *dip; /* ptr into bp for specific inode */ |
362 | xfs_inode_t *ip; /* ptr to in-core inode struct */ | ||
363 | 362 | ||
364 | /* | 363 | /* |
365 | * Get the last inode value, see if there's nothing to do. | 364 | * Get the last inode value, see if there's nothing to do. |
@@ -585,6 +584,8 @@ xfs_bulkstat( | |||
585 | 584 | ||
586 | if (flags & (BULKSTAT_FG_QUICK | | 585 | if (flags & (BULKSTAT_FG_QUICK | |
587 | BULKSTAT_FG_INLINE)) { | 586 | BULKSTAT_FG_INLINE)) { |
587 | int offset; | ||
588 | |||
588 | ino = XFS_AGINO_TO_INO(mp, agno, | 589 | ino = XFS_AGINO_TO_INO(mp, agno, |
589 | agino); | 590 | agino); |
590 | bno = XFS_AGB_TO_DADDR(mp, agno, | 591 | bno = XFS_AGB_TO_DADDR(mp, agno, |
@@ -595,19 +596,13 @@ xfs_bulkstat( | |||
595 | */ | 596 | */ |
596 | if (bp) | 597 | if (bp) |
597 | xfs_buf_relse(bp); | 598 | xfs_buf_relse(bp); |
598 | ip = xfs_inode_alloc(mp, ino); | 599 | |
599 | if (!ip) { | 600 | error = xfs_inotobp(mp, NULL, ino, &dip, |
600 | bp = NULL; | 601 | &bp, &offset, |
601 | rval = ENOMEM; | 602 | XFS_IMAP_BULKSTAT); |
602 | break; | 603 | |
603 | } | ||
604 | error = xfs_itobp(mp, NULL, ip, | ||
605 | &dip, &bp, bno, | ||
606 | XFS_IMAP_BULKSTAT, | ||
607 | XFS_BUF_LOCK); | ||
608 | if (!error) | 604 | if (!error) |
609 | clustidx = ip->i_boffset / mp->m_sb.sb_inodesize; | 605 | clustidx = offset / mp->m_sb.sb_inodesize; |
610 | xfs_idestroy(ip); | ||
611 | if (XFS_TEST_ERROR(error != 0, | 606 | if (XFS_TEST_ERROR(error != 0, |
612 | mp, XFS_ERRTAG_BULKSTAT_READ_CHUNK, | 607 | mp, XFS_ERRTAG_BULKSTAT_READ_CHUNK, |
613 | XFS_RANDOM_BULKSTAT_READ_CHUNK)) { | 608 | XFS_RANDOM_BULKSTAT_READ_CHUNK)) { |