Commit cb4f0d1d authored by Dave Chinner's avatar Dave Chinner Committed by Lachlan McIlroy

[XFS] fix uninitialised variable bug in dquot release

gcc on ARM warns about an using an uninitialised variable
in xfs_qm_dqrele_all_inodes(). This is a real bug, but gcc
on x86_64 is not reporting this warning so it went unnoticed.

Fix the bug by bring the inode radix tree walk code up to
date with xfs_sync_inodes_ag().

SGI-PV: 987246
Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarLachlan McIlroy <lachlan@sgi.com>
parent d44dab8d
......@@ -1036,9 +1036,6 @@ xfs_qm_dqrele_inodes_ag(
int nr_found;
do {
boolean_t inode_refed;
struct inode *inode;
/*
* use a gang lookup to find the next inode in the tree
* as the tree is sparse and a gang lookup walks to find
......@@ -1053,27 +1050,37 @@ xfs_qm_dqrele_inodes_ag(
break;
}
/* update the index for the next lookup */
/*
* Update the index for the next lookup. Catch overflows
* into the next AG range which can occur if we have inodes
* in the last block of the AG and we are currently
* pointing to the last inode.
*/
first_index = XFS_INO_TO_AGINO(mp, ip->i_ino + 1);
if (first_index < XFS_INO_TO_AGINO(mp, ip->i_ino)) {
read_unlock(&pag->pag_ici_lock);
break;
}
/* skip quota inodes and those in reclaim */
inode = VFS_I(ip);
if (!inode || ip == XFS_QI_UQIP(mp) || ip == XFS_QI_GQIP(mp)) {
/* skip quota inodes */
if (ip == XFS_QI_UQIP(mp) || ip == XFS_QI_GQIP(mp)) {
ASSERT(ip->i_udquot == NULL);
ASSERT(ip->i_gdquot == NULL);
read_unlock(&pag->pag_ici_lock);
continue;
}
if (xfs_ilock_nowait(ip, XFS_ILOCK_EXCL) == 0) {
inode = igrab(inode);
/*
* If we can't get a reference on the inode, it must be
* in reclaim. Leave it for the reclaim code to flush.
*/
if (!igrab(VFS_I(ip))) {
read_unlock(&pag->pag_ici_lock);
if (!inode)
continue;
inode_refed = B_TRUE;
xfs_ilock(ip, XFS_ILOCK_EXCL);
} else {
read_unlock(&pag->pag_ici_lock);
}
read_unlock(&pag->pag_ici_lock);
xfs_ilock(ip, XFS_ILOCK_EXCL);
if ((flags & XFS_UQUOTA_ACCT) && ip->i_udquot) {
xfs_qm_dqrele(ip->i_udquot);
ip->i_udquot = NULL;
......@@ -1083,9 +1090,8 @@ xfs_qm_dqrele_inodes_ag(
xfs_qm_dqrele(ip->i_gdquot);
ip->i_gdquot = NULL;
}
xfs_iunlock(ip, XFS_ILOCK_EXCL);
if (inode_refed)
IRELE(ip);
xfs_iput(ip, XFS_ILOCK_EXCL);
} while (nr_found);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment