diff options
-rw-r--r-- | fs/xfs/xfs_dquot.c | 12 | ||||
-rw-r--r-- | fs/xfs/xfs_icache.c | 3 | ||||
-rw-r--r-- | fs/xfs/xfs_qm.c | 152 | ||||
-rw-r--r-- | fs/xfs/xfs_qm.h | 37 | ||||
-rw-r--r-- | fs/xfs/xfs_qm_syscalls.c | 8 | ||||
-rw-r--r-- | fs/xfs/xfs_symlink.c | 3 | ||||
-rw-r--r-- | fs/xfs/xfs_trans_dquot.c | 46 |
7 files changed, 135 insertions, 126 deletions
diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c index 7d184dead99a..f01012de06d0 100644 --- a/fs/xfs/xfs_dquot.c +++ b/fs/xfs/xfs_dquot.c | |||
@@ -570,13 +570,13 @@ xfs_qm_dqtobp( | |||
570 | xfs_buf_t **O_bpp, | 570 | xfs_buf_t **O_bpp, |
571 | uint flags) | 571 | uint flags) |
572 | { | 572 | { |
573 | xfs_bmbt_irec_t map; | 573 | struct xfs_bmbt_irec map; |
574 | int nmaps = 1, error; | 574 | int nmaps = 1, error; |
575 | xfs_buf_t *bp; | 575 | struct xfs_buf *bp; |
576 | struct xfs_inode *quotip = xfs_dq_to_quota_inode(dqp); | 576 | struct xfs_inode *quotip = xfs_dq_to_quota_inode(dqp); |
577 | xfs_mount_t *mp = dqp->q_mount; | 577 | struct xfs_mount *mp = dqp->q_mount; |
578 | xfs_dqid_t id = be32_to_cpu(dqp->q_core.d_id); | 578 | xfs_dqid_t id = be32_to_cpu(dqp->q_core.d_id); |
579 | xfs_trans_t *tp = (tpp ? *tpp : NULL); | 579 | struct xfs_trans *tp = (tpp ? *tpp : NULL); |
580 | 580 | ||
581 | dqp->q_fileoffset = (xfs_fileoff_t)id / mp->m_quotainfo->qi_dqperchunk; | 581 | dqp->q_fileoffset = (xfs_fileoff_t)id / mp->m_quotainfo->qi_dqperchunk; |
582 | 582 | ||
diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c index 96e344e3e927..9560dc1f15a9 100644 --- a/fs/xfs/xfs_icache.c +++ b/fs/xfs/xfs_icache.c | |||
@@ -335,7 +335,8 @@ xfs_iget_cache_miss( | |||
335 | iflags = XFS_INEW; | 335 | iflags = XFS_INEW; |
336 | if (flags & XFS_IGET_DONTCACHE) | 336 | if (flags & XFS_IGET_DONTCACHE) |
337 | iflags |= XFS_IDONTCACHE; | 337 | iflags |= XFS_IDONTCACHE; |
338 | ip->i_udquot = ip->i_gdquot = NULL; | 338 | ip->i_udquot = NULL; |
339 | ip->i_gdquot = NULL; | ||
339 | xfs_iflags_set(ip, iflags); | 340 | xfs_iflags_set(ip, iflags); |
340 | 341 | ||
341 | /* insert the new inode */ | 342 | /* insert the new inode */ |
diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c index 8e707d33e106..cf09aa845d8c 100644 --- a/fs/xfs/xfs_qm.c +++ b/fs/xfs/xfs_qm.c | |||
@@ -1260,19 +1260,20 @@ int | |||
1260 | xfs_qm_quotacheck( | 1260 | xfs_qm_quotacheck( |
1261 | xfs_mount_t *mp) | 1261 | xfs_mount_t *mp) |
1262 | { | 1262 | { |
1263 | int done, count, error, error2; | 1263 | int done, count, error, error2; |
1264 | xfs_ino_t lastino; | 1264 | xfs_ino_t lastino; |
1265 | size_t structsz; | 1265 | size_t structsz; |
1266 | xfs_inode_t *uip, *gip; | 1266 | uint flags; |
1267 | uint flags; | 1267 | LIST_HEAD (buffer_list); |
1268 | LIST_HEAD (buffer_list); | 1268 | struct xfs_inode *uip = mp->m_quotainfo->qi_uquotaip; |
1269 | struct xfs_inode *gip = mp->m_quotainfo->qi_gquotaip; | ||
1269 | 1270 | ||
1270 | count = INT_MAX; | 1271 | count = INT_MAX; |
1271 | structsz = 1; | 1272 | structsz = 1; |
1272 | lastino = 0; | 1273 | lastino = 0; |
1273 | flags = 0; | 1274 | flags = 0; |
1274 | 1275 | ||
1275 | ASSERT(mp->m_quotainfo->qi_uquotaip || mp->m_quotainfo->qi_gquotaip); | 1276 | ASSERT(uip || gip); |
1276 | ASSERT(XFS_IS_QUOTA_RUNNING(mp)); | 1277 | ASSERT(XFS_IS_QUOTA_RUNNING(mp)); |
1277 | 1278 | ||
1278 | xfs_notice(mp, "Quotacheck needed: Please wait."); | 1279 | xfs_notice(mp, "Quotacheck needed: Please wait."); |
@@ -1282,7 +1283,6 @@ xfs_qm_quotacheck( | |||
1282 | * their counters to zero. We need a clean slate. | 1283 | * their counters to zero. We need a clean slate. |
1283 | * We don't log our changes till later. | 1284 | * We don't log our changes till later. |
1284 | */ | 1285 | */ |
1285 | uip = mp->m_quotainfo->qi_uquotaip; | ||
1286 | if (uip) { | 1286 | if (uip) { |
1287 | error = xfs_qm_dqiterate(mp, uip, XFS_QMOPT_UQUOTA, | 1287 | error = xfs_qm_dqiterate(mp, uip, XFS_QMOPT_UQUOTA, |
1288 | &buffer_list); | 1288 | &buffer_list); |
@@ -1291,7 +1291,6 @@ xfs_qm_quotacheck( | |||
1291 | flags |= XFS_UQUOTA_CHKD; | 1291 | flags |= XFS_UQUOTA_CHKD; |
1292 | } | 1292 | } |
1293 | 1293 | ||
1294 | gip = mp->m_quotainfo->qi_gquotaip; | ||
1295 | if (gip) { | 1294 | if (gip) { |
1296 | error = xfs_qm_dqiterate(mp, gip, XFS_IS_GQUOTA_ON(mp) ? | 1295 | error = xfs_qm_dqiterate(mp, gip, XFS_IS_GQUOTA_ON(mp) ? |
1297 | XFS_QMOPT_GQUOTA : XFS_QMOPT_PQUOTA, | 1296 | XFS_QMOPT_GQUOTA : XFS_QMOPT_PQUOTA, |
@@ -1393,15 +1392,13 @@ STATIC int | |||
1393 | xfs_qm_init_quotainos( | 1392 | xfs_qm_init_quotainos( |
1394 | xfs_mount_t *mp) | 1393 | xfs_mount_t *mp) |
1395 | { | 1394 | { |
1396 | xfs_inode_t *uip, *gip; | 1395 | struct xfs_inode *uip = NULL; |
1397 | int error; | 1396 | struct xfs_inode *gip = NULL; |
1398 | __int64_t sbflags; | 1397 | int error; |
1399 | uint flags; | 1398 | __int64_t sbflags = 0; |
1399 | uint flags = 0; | ||
1400 | 1400 | ||
1401 | ASSERT(mp->m_quotainfo); | 1401 | ASSERT(mp->m_quotainfo); |
1402 | uip = gip = NULL; | ||
1403 | sbflags = 0; | ||
1404 | flags = 0; | ||
1405 | 1402 | ||
1406 | /* | 1403 | /* |
1407 | * Get the uquota and gquota inodes | 1404 | * Get the uquota and gquota inodes |
@@ -1410,19 +1407,18 @@ xfs_qm_init_quotainos( | |||
1410 | if (XFS_IS_UQUOTA_ON(mp) && | 1407 | if (XFS_IS_UQUOTA_ON(mp) && |
1411 | mp->m_sb.sb_uquotino != NULLFSINO) { | 1408 | mp->m_sb.sb_uquotino != NULLFSINO) { |
1412 | ASSERT(mp->m_sb.sb_uquotino > 0); | 1409 | ASSERT(mp->m_sb.sb_uquotino > 0); |
1413 | if ((error = xfs_iget(mp, NULL, mp->m_sb.sb_uquotino, | 1410 | error = xfs_iget(mp, NULL, mp->m_sb.sb_uquotino, |
1414 | 0, 0, &uip))) | 1411 | 0, 0, &uip); |
1412 | if (error) | ||
1415 | return XFS_ERROR(error); | 1413 | return XFS_ERROR(error); |
1416 | } | 1414 | } |
1417 | if (XFS_IS_OQUOTA_ON(mp) && | 1415 | if (XFS_IS_OQUOTA_ON(mp) && |
1418 | mp->m_sb.sb_gquotino != NULLFSINO) { | 1416 | mp->m_sb.sb_gquotino != NULLFSINO) { |
1419 | ASSERT(mp->m_sb.sb_gquotino > 0); | 1417 | ASSERT(mp->m_sb.sb_gquotino > 0); |
1420 | if ((error = xfs_iget(mp, NULL, mp->m_sb.sb_gquotino, | 1418 | error = xfs_iget(mp, NULL, mp->m_sb.sb_gquotino, |
1421 | 0, 0, &gip))) { | 1419 | 0, 0, &gip); |
1422 | if (uip) | 1420 | if (error) |
1423 | IRELE(uip); | 1421 | goto error_rele; |
1424 | return XFS_ERROR(error); | ||
1425 | } | ||
1426 | } | 1422 | } |
1427 | } else { | 1423 | } else { |
1428 | flags |= XFS_QMOPT_SBVERSION; | 1424 | flags |= XFS_QMOPT_SBVERSION; |
@@ -1437,10 +1433,11 @@ xfs_qm_init_quotainos( | |||
1437 | * temporarily switch to read-write to do this. | 1433 | * temporarily switch to read-write to do this. |
1438 | */ | 1434 | */ |
1439 | if (XFS_IS_UQUOTA_ON(mp) && uip == NULL) { | 1435 | if (XFS_IS_UQUOTA_ON(mp) && uip == NULL) { |
1440 | if ((error = xfs_qm_qino_alloc(mp, &uip, | 1436 | error = xfs_qm_qino_alloc(mp, &uip, |
1441 | sbflags | XFS_SB_UQUOTINO, | 1437 | sbflags | XFS_SB_UQUOTINO, |
1442 | flags | XFS_QMOPT_UQUOTA))) | 1438 | flags | XFS_QMOPT_UQUOTA); |
1443 | return XFS_ERROR(error); | 1439 | if (error) |
1440 | goto error_rele; | ||
1444 | 1441 | ||
1445 | flags &= ~XFS_QMOPT_SBVERSION; | 1442 | flags &= ~XFS_QMOPT_SBVERSION; |
1446 | } | 1443 | } |
@@ -1449,18 +1446,21 @@ xfs_qm_init_quotainos( | |||
1449 | XFS_QMOPT_GQUOTA : XFS_QMOPT_PQUOTA); | 1446 | XFS_QMOPT_GQUOTA : XFS_QMOPT_PQUOTA); |
1450 | error = xfs_qm_qino_alloc(mp, &gip, | 1447 | error = xfs_qm_qino_alloc(mp, &gip, |
1451 | sbflags | XFS_SB_GQUOTINO, flags); | 1448 | sbflags | XFS_SB_GQUOTINO, flags); |
1452 | if (error) { | 1449 | if (error) |
1453 | if (uip) | 1450 | goto error_rele; |
1454 | IRELE(uip); | ||
1455 | |||
1456 | return XFS_ERROR(error); | ||
1457 | } | ||
1458 | } | 1451 | } |
1459 | 1452 | ||
1460 | mp->m_quotainfo->qi_uquotaip = uip; | 1453 | mp->m_quotainfo->qi_uquotaip = uip; |
1461 | mp->m_quotainfo->qi_gquotaip = gip; | 1454 | mp->m_quotainfo->qi_gquotaip = gip; |
1462 | 1455 | ||
1463 | return 0; | 1456 | return 0; |
1457 | |||
1458 | error_rele: | ||
1459 | if (uip) | ||
1460 | IRELE(uip); | ||
1461 | if (gip) | ||
1462 | IRELE(gip); | ||
1463 | return XFS_ERROR(error); | ||
1464 | } | 1464 | } |
1465 | 1465 | ||
1466 | STATIC void | 1466 | STATIC void |
@@ -1657,7 +1657,8 @@ xfs_qm_vop_dqalloc( | |||
1657 | struct xfs_dquot **O_gdqpp) | 1657 | struct xfs_dquot **O_gdqpp) |
1658 | { | 1658 | { |
1659 | struct xfs_mount *mp = ip->i_mount; | 1659 | struct xfs_mount *mp = ip->i_mount; |
1660 | struct xfs_dquot *uq, *gq; | 1660 | struct xfs_dquot *uq = NULL; |
1661 | struct xfs_dquot *gq = NULL; | ||
1661 | int error; | 1662 | int error; |
1662 | uint lockflags; | 1663 | uint lockflags; |
1663 | 1664 | ||
@@ -1682,7 +1683,6 @@ xfs_qm_vop_dqalloc( | |||
1682 | } | 1683 | } |
1683 | } | 1684 | } |
1684 | 1685 | ||
1685 | uq = gq = NULL; | ||
1686 | if ((flags & XFS_QMOPT_UQUOTA) && XFS_IS_UQUOTA_ON(mp)) { | 1686 | if ((flags & XFS_QMOPT_UQUOTA) && XFS_IS_UQUOTA_ON(mp)) { |
1687 | if (ip->i_d.di_uid != uid) { | 1687 | if (ip->i_d.di_uid != uid) { |
1688 | /* | 1688 | /* |
@@ -1695,11 +1695,12 @@ xfs_qm_vop_dqalloc( | |||
1695 | * holding ilock. | 1695 | * holding ilock. |
1696 | */ | 1696 | */ |
1697 | xfs_iunlock(ip, lockflags); | 1697 | xfs_iunlock(ip, lockflags); |
1698 | if ((error = xfs_qm_dqget(mp, NULL, (xfs_dqid_t) uid, | 1698 | error = xfs_qm_dqget(mp, NULL, (xfs_dqid_t) uid, |
1699 | XFS_DQ_USER, | 1699 | XFS_DQ_USER, |
1700 | XFS_QMOPT_DQALLOC | | 1700 | XFS_QMOPT_DQALLOC | |
1701 | XFS_QMOPT_DOWARN, | 1701 | XFS_QMOPT_DOWARN, |
1702 | &uq))) { | 1702 | &uq); |
1703 | if (error) { | ||
1703 | ASSERT(error != ENOENT); | 1704 | ASSERT(error != ENOENT); |
1704 | return error; | 1705 | return error; |
1705 | } | 1706 | } |
@@ -1721,15 +1722,14 @@ xfs_qm_vop_dqalloc( | |||
1721 | if ((flags & XFS_QMOPT_GQUOTA) && XFS_IS_GQUOTA_ON(mp)) { | 1722 | if ((flags & XFS_QMOPT_GQUOTA) && XFS_IS_GQUOTA_ON(mp)) { |
1722 | if (ip->i_d.di_gid != gid) { | 1723 | if (ip->i_d.di_gid != gid) { |
1723 | xfs_iunlock(ip, lockflags); | 1724 | xfs_iunlock(ip, lockflags); |
1724 | if ((error = xfs_qm_dqget(mp, NULL, (xfs_dqid_t)gid, | 1725 | error = xfs_qm_dqget(mp, NULL, (xfs_dqid_t)gid, |
1725 | XFS_DQ_GROUP, | 1726 | XFS_DQ_GROUP, |
1726 | XFS_QMOPT_DQALLOC | | 1727 | XFS_QMOPT_DQALLOC | |
1727 | XFS_QMOPT_DOWARN, | 1728 | XFS_QMOPT_DOWARN, |
1728 | &gq))) { | 1729 | &gq); |
1729 | if (uq) | 1730 | if (error) { |
1730 | xfs_qm_dqrele(uq); | ||
1731 | ASSERT(error != ENOENT); | 1731 | ASSERT(error != ENOENT); |
1732 | return error; | 1732 | goto error_rele; |
1733 | } | 1733 | } |
1734 | xfs_dqunlock(gq); | 1734 | xfs_dqunlock(gq); |
1735 | lockflags = XFS_ILOCK_SHARED; | 1735 | lockflags = XFS_ILOCK_SHARED; |
@@ -1741,15 +1741,14 @@ xfs_qm_vop_dqalloc( | |||
1741 | } else if ((flags & XFS_QMOPT_PQUOTA) && XFS_IS_PQUOTA_ON(mp)) { | 1741 | } else if ((flags & XFS_QMOPT_PQUOTA) && XFS_IS_PQUOTA_ON(mp)) { |
1742 | if (xfs_get_projid(ip) != prid) { | 1742 | if (xfs_get_projid(ip) != prid) { |
1743 | xfs_iunlock(ip, lockflags); | 1743 | xfs_iunlock(ip, lockflags); |
1744 | if ((error = xfs_qm_dqget(mp, NULL, (xfs_dqid_t)prid, | 1744 | error = xfs_qm_dqget(mp, NULL, (xfs_dqid_t)prid, |
1745 | XFS_DQ_PROJ, | 1745 | XFS_DQ_PROJ, |
1746 | XFS_QMOPT_DQALLOC | | 1746 | XFS_QMOPT_DQALLOC | |
1747 | XFS_QMOPT_DOWARN, | 1747 | XFS_QMOPT_DOWARN, |
1748 | &gq))) { | 1748 | &gq); |
1749 | if (uq) | 1749 | if (error) { |
1750 | xfs_qm_dqrele(uq); | ||
1751 | ASSERT(error != ENOENT); | 1750 | ASSERT(error != ENOENT); |
1752 | return (error); | 1751 | goto error_rele; |
1753 | } | 1752 | } |
1754 | xfs_dqunlock(gq); | 1753 | xfs_dqunlock(gq); |
1755 | lockflags = XFS_ILOCK_SHARED; | 1754 | lockflags = XFS_ILOCK_SHARED; |
@@ -1772,6 +1771,11 @@ xfs_qm_vop_dqalloc( | |||
1772 | else if (gq) | 1771 | else if (gq) |
1773 | xfs_qm_dqrele(gq); | 1772 | xfs_qm_dqrele(gq); |
1774 | return 0; | 1773 | return 0; |
1774 | |||
1775 | error_rele: | ||
1776 | if (uq) | ||
1777 | xfs_qm_dqrele(uq); | ||
1778 | return error; | ||
1775 | } | 1779 | } |
1776 | 1780 | ||
1777 | /* | 1781 | /* |
@@ -1819,29 +1823,31 @@ xfs_qm_vop_chown( | |||
1819 | */ | 1823 | */ |
1820 | int | 1824 | int |
1821 | xfs_qm_vop_chown_reserve( | 1825 | xfs_qm_vop_chown_reserve( |
1822 | xfs_trans_t *tp, | 1826 | struct xfs_trans *tp, |
1823 | xfs_inode_t *ip, | 1827 | struct xfs_inode *ip, |
1824 | xfs_dquot_t *udqp, | 1828 | struct xfs_dquot *udqp, |
1825 | xfs_dquot_t *gdqp, | 1829 | struct xfs_dquot *gdqp, |
1826 | uint flags) | 1830 | uint flags) |
1827 | { | 1831 | { |
1828 | xfs_mount_t *mp = ip->i_mount; | 1832 | struct xfs_mount *mp = ip->i_mount; |
1829 | uint delblks, blkflags, prjflags = 0; | 1833 | uint delblks, blkflags, prjflags = 0; |
1830 | xfs_dquot_t *unresudq, *unresgdq, *delblksudq, *delblksgdq; | 1834 | struct xfs_dquot *udq_unres = NULL; |
1831 | int error; | 1835 | struct xfs_dquot *gdq_unres = NULL; |
1836 | struct xfs_dquot *udq_delblks = NULL; | ||
1837 | struct xfs_dquot *gdq_delblks = NULL; | ||
1838 | int error; | ||
1832 | 1839 | ||
1833 | 1840 | ||
1834 | ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED)); | 1841 | ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED)); |
1835 | ASSERT(XFS_IS_QUOTA_RUNNING(mp)); | 1842 | ASSERT(XFS_IS_QUOTA_RUNNING(mp)); |
1836 | 1843 | ||
1837 | delblks = ip->i_delayed_blks; | 1844 | delblks = ip->i_delayed_blks; |
1838 | delblksudq = delblksgdq = unresudq = unresgdq = NULL; | ||
1839 | blkflags = XFS_IS_REALTIME_INODE(ip) ? | 1845 | blkflags = XFS_IS_REALTIME_INODE(ip) ? |
1840 | XFS_QMOPT_RES_RTBLKS : XFS_QMOPT_RES_REGBLKS; | 1846 | XFS_QMOPT_RES_RTBLKS : XFS_QMOPT_RES_REGBLKS; |
1841 | 1847 | ||
1842 | if (XFS_IS_UQUOTA_ON(mp) && udqp && | 1848 | if (XFS_IS_UQUOTA_ON(mp) && udqp && |
1843 | ip->i_d.di_uid != (uid_t)be32_to_cpu(udqp->q_core.d_id)) { | 1849 | ip->i_d.di_uid != (uid_t)be32_to_cpu(udqp->q_core.d_id)) { |
1844 | delblksudq = udqp; | 1850 | udq_delblks = udqp; |
1845 | /* | 1851 | /* |
1846 | * If there are delayed allocation blocks, then we have to | 1852 | * If there are delayed allocation blocks, then we have to |
1847 | * unreserve those from the old dquot, and add them to the | 1853 | * unreserve those from the old dquot, and add them to the |
@@ -1849,7 +1855,7 @@ xfs_qm_vop_chown_reserve( | |||
1849 | */ | 1855 | */ |
1850 | if (delblks) { | 1856 | if (delblks) { |
1851 | ASSERT(ip->i_udquot); | 1857 | ASSERT(ip->i_udquot); |
1852 | unresudq = ip->i_udquot; | 1858 | udq_unres = ip->i_udquot; |
1853 | } | 1859 | } |
1854 | } | 1860 | } |
1855 | if (XFS_IS_OQUOTA_ON(ip->i_mount) && gdqp) { | 1861 | if (XFS_IS_OQUOTA_ON(ip->i_mount) && gdqp) { |
@@ -1860,18 +1866,19 @@ xfs_qm_vop_chown_reserve( | |||
1860 | if (prjflags || | 1866 | if (prjflags || |
1861 | (XFS_IS_GQUOTA_ON(ip->i_mount) && | 1867 | (XFS_IS_GQUOTA_ON(ip->i_mount) && |
1862 | ip->i_d.di_gid != be32_to_cpu(gdqp->q_core.d_id))) { | 1868 | ip->i_d.di_gid != be32_to_cpu(gdqp->q_core.d_id))) { |
1863 | delblksgdq = gdqp; | 1869 | gdq_delblks = gdqp; |
1864 | if (delblks) { | 1870 | if (delblks) { |
1865 | ASSERT(ip->i_gdquot); | 1871 | ASSERT(ip->i_gdquot); |
1866 | unresgdq = ip->i_gdquot; | 1872 | gdq_unres = ip->i_gdquot; |
1867 | } | 1873 | } |
1868 | } | 1874 | } |
1869 | } | 1875 | } |
1870 | 1876 | ||
1871 | if ((error = xfs_trans_reserve_quota_bydquots(tp, ip->i_mount, | 1877 | error = xfs_trans_reserve_quota_bydquots(tp, ip->i_mount, |
1872 | delblksudq, delblksgdq, ip->i_d.di_nblocks, 1, | 1878 | udq_delblks, gdq_delblks, ip->i_d.di_nblocks, 1, |
1873 | flags | blkflags | prjflags))) | 1879 | flags | blkflags | prjflags); |
1874 | return (error); | 1880 | if (error) |
1881 | return error; | ||
1875 | 1882 | ||
1876 | /* | 1883 | /* |
1877 | * Do the delayed blks reservations/unreservations now. Since, these | 1884 | * Do the delayed blks reservations/unreservations now. Since, these |
@@ -1883,14 +1890,15 @@ xfs_qm_vop_chown_reserve( | |||
1883 | /* | 1890 | /* |
1884 | * Do the reservations first. Unreservation can't fail. | 1891 | * Do the reservations first. Unreservation can't fail. |
1885 | */ | 1892 | */ |
1886 | ASSERT(delblksudq || delblksgdq); | 1893 | ASSERT(udq_delblks || gdq_delblks); |
1887 | ASSERT(unresudq || unresgdq); | 1894 | ASSERT(udq_unres || gdq_unres); |
1888 | if ((error = xfs_trans_reserve_quota_bydquots(NULL, ip->i_mount, | 1895 | error = xfs_trans_reserve_quota_bydquots(NULL, ip->i_mount, |
1889 | delblksudq, delblksgdq, (xfs_qcnt_t)delblks, 0, | 1896 | udq_delblks, gdq_delblks, (xfs_qcnt_t)delblks, 0, |
1890 | flags | blkflags | prjflags))) | 1897 | flags | blkflags | prjflags); |
1891 | return (error); | 1898 | if (error) |
1899 | return error; | ||
1892 | xfs_trans_reserve_quota_bydquots(NULL, ip->i_mount, | 1900 | xfs_trans_reserve_quota_bydquots(NULL, ip->i_mount, |
1893 | unresudq, unresgdq, -((xfs_qcnt_t)delblks), 0, | 1901 | udq_unres, gdq_unres, -((xfs_qcnt_t)delblks), 0, |
1894 | blkflags); | 1902 | blkflags); |
1895 | } | 1903 | } |
1896 | 1904 | ||
diff --git a/fs/xfs/xfs_qm.h b/fs/xfs/xfs_qm.h index 051e43a5e20b..978bbb1a9e77 100644 --- a/fs/xfs/xfs_qm.h +++ b/fs/xfs/xfs_qm.h | |||
@@ -103,11 +103,13 @@ xfs_dq_to_quota_inode(struct xfs_dquot *dqp) | |||
103 | 103 | ||
104 | extern int xfs_qm_calc_dquots_per_chunk(struct xfs_mount *mp, | 104 | extern int xfs_qm_calc_dquots_per_chunk(struct xfs_mount *mp, |
105 | unsigned int nbblks); | 105 | unsigned int nbblks); |
106 | extern void xfs_trans_mod_dquot(xfs_trans_t *, xfs_dquot_t *, uint, long); | 106 | extern void xfs_trans_mod_dquot(struct xfs_trans *, |
107 | extern int xfs_trans_reserve_quota_bydquots(xfs_trans_t *, xfs_mount_t *, | 107 | struct xfs_dquot *, uint, long); |
108 | xfs_dquot_t *, xfs_dquot_t *, long, long, uint); | 108 | extern int xfs_trans_reserve_quota_bydquots(struct xfs_trans *, |
109 | extern void xfs_trans_dqjoin(xfs_trans_t *, xfs_dquot_t *); | 109 | struct xfs_mount *, struct xfs_dquot *, |
110 | extern void xfs_trans_log_dquot(xfs_trans_t *, xfs_dquot_t *); | 110 | struct xfs_dquot *, long, long, uint); |
111 | extern void xfs_trans_dqjoin(struct xfs_trans *, struct xfs_dquot *); | ||
112 | extern void xfs_trans_log_dquot(struct xfs_trans *, struct xfs_dquot *); | ||
111 | 113 | ||
112 | /* | 114 | /* |
113 | * We keep the usr and grp dquots separately so that locking will be easier | 115 | * We keep the usr and grp dquots separately so that locking will be easier |
@@ -132,22 +134,23 @@ typedef struct xfs_dquot_acct { | |||
132 | #define XFS_QM_IWARNLIMIT 5 | 134 | #define XFS_QM_IWARNLIMIT 5 |
133 | #define XFS_QM_RTBWARNLIMIT 5 | 135 | #define XFS_QM_RTBWARNLIMIT 5 |
134 | 136 | ||
135 | extern void xfs_qm_destroy_quotainfo(xfs_mount_t *); | 137 | extern void xfs_qm_destroy_quotainfo(struct xfs_mount *); |
136 | extern int xfs_qm_quotacheck(xfs_mount_t *); | 138 | extern int xfs_qm_quotacheck(struct xfs_mount *); |
137 | extern int xfs_qm_write_sb_changes(xfs_mount_t *, __int64_t); | 139 | extern int xfs_qm_write_sb_changes(struct xfs_mount *, __int64_t); |
138 | 140 | ||
139 | /* dquot stuff */ | 141 | /* dquot stuff */ |
140 | extern void xfs_qm_dqpurge_all(xfs_mount_t *, uint); | 142 | extern void xfs_qm_dqpurge_all(struct xfs_mount *, uint); |
141 | extern void xfs_qm_dqrele_all_inodes(xfs_mount_t *, uint); | 143 | extern void xfs_qm_dqrele_all_inodes(struct xfs_mount *, uint); |
142 | 144 | ||
143 | /* quota ops */ | 145 | /* quota ops */ |
144 | extern int xfs_qm_scall_trunc_qfiles(xfs_mount_t *, uint); | 146 | extern int xfs_qm_scall_trunc_qfiles(struct xfs_mount *, uint); |
145 | extern int xfs_qm_scall_getquota(xfs_mount_t *, xfs_dqid_t, uint, | 147 | extern int xfs_qm_scall_getquota(struct xfs_mount *, xfs_dqid_t, |
146 | fs_disk_quota_t *); | 148 | uint, struct fs_disk_quota *); |
147 | extern int xfs_qm_scall_setqlim(struct xfs_mount *, xfs_dqid_t, uint, | 149 | extern int xfs_qm_scall_setqlim(struct xfs_mount *, xfs_dqid_t, uint, |
148 | fs_disk_quota_t *); | 150 | struct fs_disk_quota *); |
149 | extern int xfs_qm_scall_getqstat(xfs_mount_t *, fs_quota_stat_t *); | 151 | extern int xfs_qm_scall_getqstat(struct xfs_mount *, |
150 | extern int xfs_qm_scall_quotaon(xfs_mount_t *, uint); | 152 | struct fs_quota_stat *); |
151 | extern int xfs_qm_scall_quotaoff(xfs_mount_t *, uint); | 153 | extern int xfs_qm_scall_quotaon(struct xfs_mount *, uint); |
154 | extern int xfs_qm_scall_quotaoff(struct xfs_mount *, uint); | ||
152 | 155 | ||
153 | #endif /* __XFS_QM_H__ */ | 156 | #endif /* __XFS_QM_H__ */ |
diff --git a/fs/xfs/xfs_qm_syscalls.c b/fs/xfs/xfs_qm_syscalls.c index 6cdf6ffc36a1..b03b2abd1e13 100644 --- a/fs/xfs/xfs_qm_syscalls.c +++ b/fs/xfs/xfs_qm_syscalls.c | |||
@@ -407,11 +407,11 @@ xfs_qm_scall_getqstat( | |||
407 | struct fs_quota_stat *out) | 407 | struct fs_quota_stat *out) |
408 | { | 408 | { |
409 | struct xfs_quotainfo *q = mp->m_quotainfo; | 409 | struct xfs_quotainfo *q = mp->m_quotainfo; |
410 | struct xfs_inode *uip, *gip; | 410 | struct xfs_inode *uip = NULL; |
411 | bool tempuqip, tempgqip; | 411 | struct xfs_inode *gip = NULL; |
412 | bool tempuqip = false; | ||
413 | bool tempgqip = false; | ||
412 | 414 | ||
413 | uip = gip = NULL; | ||
414 | tempuqip = tempgqip = false; | ||
415 | memset(out, 0, sizeof(fs_quota_stat_t)); | 415 | memset(out, 0, sizeof(fs_quota_stat_t)); |
416 | 416 | ||
417 | out->qs_version = FS_QSTAT_VERSION; | 417 | out->qs_version = FS_QSTAT_VERSION; |
diff --git a/fs/xfs/xfs_symlink.c b/fs/xfs/xfs_symlink.c index 738c04be2019..e830fb56e27f 100644 --- a/fs/xfs/xfs_symlink.c +++ b/fs/xfs/xfs_symlink.c | |||
@@ -358,7 +358,8 @@ xfs_symlink( | |||
358 | int n; | 358 | int n; |
359 | xfs_buf_t *bp; | 359 | xfs_buf_t *bp; |
360 | prid_t prid; | 360 | prid_t prid; |
361 | struct xfs_dquot *udqp, *gdqp; | 361 | struct xfs_dquot *udqp = NULL; |
362 | struct xfs_dquot *gdqp = NULL; | ||
362 | uint resblks; | 363 | uint resblks; |
363 | 364 | ||
364 | *ipp = NULL; | 365 | *ipp = NULL; |
diff --git a/fs/xfs/xfs_trans_dquot.c b/fs/xfs/xfs_trans_dquot.c index 3fa369c75a4d..45b3e2d0773a 100644 --- a/fs/xfs/xfs_trans_dquot.c +++ b/fs/xfs/xfs_trans_dquot.c | |||
@@ -169,13 +169,13 @@ xfs_trans_mod_dquot_byino( | |||
169 | (void) xfs_trans_mod_dquot(tp, ip->i_gdquot, field, delta); | 169 | (void) xfs_trans_mod_dquot(tp, ip->i_gdquot, field, delta); |
170 | } | 170 | } |
171 | 171 | ||
172 | STATIC xfs_dqtrx_t * | 172 | STATIC struct xfs_dqtrx * |
173 | xfs_trans_get_dqtrx( | 173 | xfs_trans_get_dqtrx( |
174 | xfs_trans_t *tp, | 174 | struct xfs_trans *tp, |
175 | xfs_dquot_t *dqp) | 175 | struct xfs_dquot *dqp) |
176 | { | 176 | { |
177 | int i; | 177 | int i; |
178 | xfs_dqtrx_t *qa; | 178 | struct xfs_dqtrx *qa; |
179 | 179 | ||
180 | qa = XFS_QM_ISUDQ(dqp) ? | 180 | qa = XFS_QM_ISUDQ(dqp) ? |
181 | tp->t_dqinfo->dqa_usrdquots : tp->t_dqinfo->dqa_grpdquots; | 181 | tp->t_dqinfo->dqa_usrdquots : tp->t_dqinfo->dqa_grpdquots; |
@@ -747,15 +747,15 @@ error_return: | |||
747 | */ | 747 | */ |
748 | int | 748 | int |
749 | xfs_trans_reserve_quota_bydquots( | 749 | xfs_trans_reserve_quota_bydquots( |
750 | xfs_trans_t *tp, | 750 | struct xfs_trans *tp, |
751 | xfs_mount_t *mp, | 751 | struct xfs_mount *mp, |
752 | xfs_dquot_t *udqp, | 752 | struct xfs_dquot *udqp, |
753 | xfs_dquot_t *gdqp, | 753 | struct xfs_dquot *gdqp, |
754 | long nblks, | 754 | long nblks, |
755 | long ninos, | 755 | long ninos, |
756 | uint flags) | 756 | uint flags) |
757 | { | 757 | { |
758 | int resvd = 0, error; | 758 | int error; |
759 | 759 | ||
760 | if (!XFS_IS_QUOTA_RUNNING(mp) || !XFS_IS_QUOTA_ON(mp)) | 760 | if (!XFS_IS_QUOTA_RUNNING(mp) || !XFS_IS_QUOTA_ON(mp)) |
761 | return 0; | 761 | return 0; |
@@ -770,28 +770,24 @@ xfs_trans_reserve_quota_bydquots( | |||
770 | (flags & ~XFS_QMOPT_ENOSPC)); | 770 | (flags & ~XFS_QMOPT_ENOSPC)); |
771 | if (error) | 771 | if (error) |
772 | return error; | 772 | return error; |
773 | resvd = 1; | ||
774 | } | 773 | } |
775 | 774 | ||
776 | if (gdqp) { | 775 | if (gdqp) { |
777 | error = xfs_trans_dqresv(tp, mp, gdqp, nblks, ninos, flags); | 776 | error = xfs_trans_dqresv(tp, mp, gdqp, nblks, ninos, flags); |
778 | if (error) { | 777 | if (error) |
779 | /* | 778 | goto unwind_usr; |
780 | * can't do it, so backout previous reservation | ||
781 | */ | ||
782 | if (resvd) { | ||
783 | flags |= XFS_QMOPT_FORCE_RES; | ||
784 | xfs_trans_dqresv(tp, mp, udqp, | ||
785 | -nblks, -ninos, flags); | ||
786 | } | ||
787 | return error; | ||
788 | } | ||
789 | } | 779 | } |
790 | 780 | ||
791 | /* | 781 | /* |
792 | * Didn't change anything critical, so, no need to log | 782 | * Didn't change anything critical, so, no need to log |
793 | */ | 783 | */ |
794 | return 0; | 784 | return 0; |
785 | |||
786 | unwind_usr: | ||
787 | flags |= XFS_QMOPT_FORCE_RES; | ||
788 | if (udqp) | ||
789 | xfs_trans_dqresv(tp, mp, udqp, -nblks, -ninos, flags); | ||
790 | return error; | ||
795 | } | 791 | } |
796 | 792 | ||
797 | 793 | ||