aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/quota/xfs_qm_syscalls.c
diff options
context:
space:
mode:
authorDave Chinner <david@fromorbit.com>2008-11-10 01:11:18 -0500
committerLachlan McIlroy <lachlan@redback.melbourne.sgi.com>2008-11-10 01:11:18 -0500
commitcb4f0d1d4229f609f43c68acec69c7618ed72397 (patch)
treecc96ac86a126c2a2055183e3d42a5be38087abbb /fs/xfs/quota/xfs_qm_syscalls.c
parentd44dab8d1cde8aeba1faf44a7654f90800feb7fc (diff)
[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: Dave Chinner <david@fromorbit.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Diffstat (limited to 'fs/xfs/quota/xfs_qm_syscalls.c')
-rw-r--r--fs/xfs/quota/xfs_qm_syscalls.c42
1 files changed, 24 insertions, 18 deletions
diff --git a/fs/xfs/quota/xfs_qm_syscalls.c b/fs/xfs/quota/xfs_qm_syscalls.c
index 9ff28e6c5b8b..2c57a6eaff36 100644
--- a/fs/xfs/quota/xfs_qm_syscalls.c
+++ b/fs/xfs/quota/xfs_qm_syscalls.c
@@ -1036,9 +1036,6 @@ xfs_qm_dqrele_inodes_ag(
1036 int nr_found; 1036 int nr_found;
1037 1037
1038 do { 1038 do {
1039 boolean_t inode_refed;
1040 struct inode *inode;
1041
1042 /* 1039 /*
1043 * use a gang lookup to find the next inode in the tree 1040 * use a gang lookup to find the next inode in the tree
1044 * as the tree is sparse and a gang lookup walks to find 1041 * as the tree is sparse and a gang lookup walks to find
@@ -1053,27 +1050,37 @@ xfs_qm_dqrele_inodes_ag(
1053 break; 1050 break;
1054 } 1051 }
1055 1052
1056 /* update the index for the next lookup */ 1053 /*
1054 * Update the index for the next lookup. Catch overflows
1055 * into the next AG range which can occur if we have inodes
1056 * in the last block of the AG and we are currently
1057 * pointing to the last inode.
1058 */
1057 first_index = XFS_INO_TO_AGINO(mp, ip->i_ino + 1); 1059 first_index = XFS_INO_TO_AGINO(mp, ip->i_ino + 1);
1060 if (first_index < XFS_INO_TO_AGINO(mp, ip->i_ino)) {
1061 read_unlock(&pag->pag_ici_lock);
1062 break;
1063 }
1058 1064
1059 /* skip quota inodes and those in reclaim */ 1065 /* skip quota inodes */
1060 inode = VFS_I(ip); 1066 if (ip == XFS_QI_UQIP(mp) || ip == XFS_QI_GQIP(mp)) {
1061 if (!inode || ip == XFS_QI_UQIP(mp) || ip == XFS_QI_GQIP(mp)) {
1062 ASSERT(ip->i_udquot == NULL); 1067 ASSERT(ip->i_udquot == NULL);
1063 ASSERT(ip->i_gdquot == NULL); 1068 ASSERT(ip->i_gdquot == NULL);
1064 read_unlock(&pag->pag_ici_lock); 1069 read_unlock(&pag->pag_ici_lock);
1065 continue; 1070 continue;
1066 } 1071 }
1067 if (xfs_ilock_nowait(ip, XFS_ILOCK_EXCL) == 0) { 1072
1068 inode = igrab(inode); 1073 /*
1069 read_unlock(&pag->pag_ici_lock); 1074 * If we can't get a reference on the inode, it must be
1070 if (!inode) 1075 * in reclaim. Leave it for the reclaim code to flush.
1071 continue; 1076 */
1072 inode_refed = B_TRUE; 1077 if (!igrab(VFS_I(ip))) {
1073 xfs_ilock(ip, XFS_ILOCK_EXCL);
1074 } else {
1075 read_unlock(&pag->pag_ici_lock); 1078 read_unlock(&pag->pag_ici_lock);
1079 continue;
1076 } 1080 }
1081 read_unlock(&pag->pag_ici_lock);
1082
1083 xfs_ilock(ip, XFS_ILOCK_EXCL);
1077 if ((flags & XFS_UQUOTA_ACCT) && ip->i_udquot) { 1084 if ((flags & XFS_UQUOTA_ACCT) && ip->i_udquot) {
1078 xfs_qm_dqrele(ip->i_udquot); 1085 xfs_qm_dqrele(ip->i_udquot);
1079 ip->i_udquot = NULL; 1086 ip->i_udquot = NULL;
@@ -1083,9 +1090,8 @@ xfs_qm_dqrele_inodes_ag(
1083 xfs_qm_dqrele(ip->i_gdquot); 1090 xfs_qm_dqrele(ip->i_gdquot);
1084 ip->i_gdquot = NULL; 1091 ip->i_gdquot = NULL;
1085 } 1092 }
1086 xfs_iunlock(ip, XFS_ILOCK_EXCL); 1093 xfs_iput(ip, XFS_ILOCK_EXCL);
1087 if (inode_refed) 1094
1088 IRELE(ip);
1089 } while (nr_found); 1095 } while (nr_found);
1090} 1096}
1091 1097