diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-02-23 18:38:57 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-02-23 18:38:57 -0500 |
| commit | bb4c7e9a9908548b458f34afb2fee74dc0d49f90 (patch) | |
| tree | 5f9c05a3d74215826ba0d43881269bd3f7339090 | |
| parent | 73c8e679aa8d123c1b05fa837daacd0aa0c4cb85 (diff) | |
| parent | c922bbc819324558e61402a7a76c10c550ca61bc (diff) | |
Merge branch 'for-linus' of git://oss.sgi.com/xfs/xfs
A fix from Jesper Juhl removes an assignment in an ASSERT when a compare
is intended. Two fixes from Mitsuo Hayasaka address off-by-ones in XFS
quota enforcement.
* 'for-linus' of git://oss.sgi.com/xfs/xfs:
xfs: make inode quota check more general
xfs: change available ranges of softlimit and hardlimit in quota check
XFS: xfs_trans_add_item() - don't assign in ASSERT() when compare is intended
| -rw-r--r-- | fs/xfs/xfs_dquot.c | 24 | ||||
| -rw-r--r-- | fs/xfs/xfs_log_recover.c | 6 | ||||
| -rw-r--r-- | fs/xfs/xfs_qm_syscalls.c | 4 | ||||
| -rw-r--r-- | fs/xfs/xfs_trans.c | 4 | ||||
| -rw-r--r-- | fs/xfs/xfs_trans_dquot.c | 10 |
5 files changed, 25 insertions, 23 deletions
diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c index cbcb7bea38e2..53db20ee3e77 100644 --- a/fs/xfs/xfs_dquot.c +++ b/fs/xfs/xfs_dquot.c | |||
| @@ -139,10 +139,10 @@ xfs_qm_adjust_dqtimers( | |||
| 139 | 139 | ||
| 140 | if (!d->d_btimer) { | 140 | if (!d->d_btimer) { |
| 141 | if ((d->d_blk_softlimit && | 141 | if ((d->d_blk_softlimit && |
| 142 | (be64_to_cpu(d->d_bcount) >= | 142 | (be64_to_cpu(d->d_bcount) > |
| 143 | be64_to_cpu(d->d_blk_softlimit))) || | 143 | be64_to_cpu(d->d_blk_softlimit))) || |
| 144 | (d->d_blk_hardlimit && | 144 | (d->d_blk_hardlimit && |
| 145 | (be64_to_cpu(d->d_bcount) >= | 145 | (be64_to_cpu(d->d_bcount) > |
| 146 | be64_to_cpu(d->d_blk_hardlimit)))) { | 146 | be64_to_cpu(d->d_blk_hardlimit)))) { |
| 147 | d->d_btimer = cpu_to_be32(get_seconds() + | 147 | d->d_btimer = cpu_to_be32(get_seconds() + |
| 148 | mp->m_quotainfo->qi_btimelimit); | 148 | mp->m_quotainfo->qi_btimelimit); |
| @@ -151,10 +151,10 @@ xfs_qm_adjust_dqtimers( | |||
| 151 | } | 151 | } |
| 152 | } else { | 152 | } else { |
| 153 | if ((!d->d_blk_softlimit || | 153 | if ((!d->d_blk_softlimit || |
| 154 | (be64_to_cpu(d->d_bcount) < | 154 | (be64_to_cpu(d->d_bcount) <= |
| 155 | be64_to_cpu(d->d_blk_softlimit))) && | 155 | be64_to_cpu(d->d_blk_softlimit))) && |
| 156 | (!d->d_blk_hardlimit || | 156 | (!d->d_blk_hardlimit || |
| 157 | (be64_to_cpu(d->d_bcount) < | 157 | (be64_to_cpu(d->d_bcount) <= |
| 158 | be64_to_cpu(d->d_blk_hardlimit)))) { | 158 | be64_to_cpu(d->d_blk_hardlimit)))) { |
| 159 | d->d_btimer = 0; | 159 | d->d_btimer = 0; |
| 160 | } | 160 | } |
| @@ -162,10 +162,10 @@ xfs_qm_adjust_dqtimers( | |||
| 162 | 162 | ||
| 163 | if (!d->d_itimer) { | 163 | if (!d->d_itimer) { |
| 164 | if ((d->d_ino_softlimit && | 164 | if ((d->d_ino_softlimit && |
| 165 | (be64_to_cpu(d->d_icount) >= | 165 | (be64_to_cpu(d->d_icount) > |
| 166 | be64_to_cpu(d->d_ino_softlimit))) || | 166 | be64_to_cpu(d->d_ino_softlimit))) || |
| 167 | (d->d_ino_hardlimit && | 167 | (d->d_ino_hardlimit && |
| 168 | (be64_to_cpu(d->d_icount) >= | 168 | (be64_to_cpu(d->d_icount) > |
| 169 | be64_to_cpu(d->d_ino_hardlimit)))) { | 169 | be64_to_cpu(d->d_ino_hardlimit)))) { |
| 170 | d->d_itimer = cpu_to_be32(get_seconds() + | 170 | d->d_itimer = cpu_to_be32(get_seconds() + |
| 171 | mp->m_quotainfo->qi_itimelimit); | 171 | mp->m_quotainfo->qi_itimelimit); |
| @@ -174,10 +174,10 @@ xfs_qm_adjust_dqtimers( | |||
| 174 | } | 174 | } |
| 175 | } else { | 175 | } else { |
| 176 | if ((!d->d_ino_softlimit || | 176 | if ((!d->d_ino_softlimit || |
| 177 | (be64_to_cpu(d->d_icount) < | 177 | (be64_to_cpu(d->d_icount) <= |
| 178 | be64_to_cpu(d->d_ino_softlimit))) && | 178 | be64_to_cpu(d->d_ino_softlimit))) && |
| 179 | (!d->d_ino_hardlimit || | 179 | (!d->d_ino_hardlimit || |
| 180 | (be64_to_cpu(d->d_icount) < | 180 | (be64_to_cpu(d->d_icount) <= |
| 181 | be64_to_cpu(d->d_ino_hardlimit)))) { | 181 | be64_to_cpu(d->d_ino_hardlimit)))) { |
| 182 | d->d_itimer = 0; | 182 | d->d_itimer = 0; |
| 183 | } | 183 | } |
| @@ -185,10 +185,10 @@ xfs_qm_adjust_dqtimers( | |||
| 185 | 185 | ||
| 186 | if (!d->d_rtbtimer) { | 186 | if (!d->d_rtbtimer) { |
| 187 | if ((d->d_rtb_softlimit && | 187 | if ((d->d_rtb_softlimit && |
| 188 | (be64_to_cpu(d->d_rtbcount) >= | 188 | (be64_to_cpu(d->d_rtbcount) > |
| 189 | be64_to_cpu(d->d_rtb_softlimit))) || | 189 | be64_to_cpu(d->d_rtb_softlimit))) || |
| 190 | (d->d_rtb_hardlimit && | 190 | (d->d_rtb_hardlimit && |
| 191 | (be64_to_cpu(d->d_rtbcount) >= | 191 | (be64_to_cpu(d->d_rtbcount) > |
| 192 | be64_to_cpu(d->d_rtb_hardlimit)))) { | 192 | be64_to_cpu(d->d_rtb_hardlimit)))) { |
| 193 | d->d_rtbtimer = cpu_to_be32(get_seconds() + | 193 | d->d_rtbtimer = cpu_to_be32(get_seconds() + |
| 194 | mp->m_quotainfo->qi_rtbtimelimit); | 194 | mp->m_quotainfo->qi_rtbtimelimit); |
| @@ -197,10 +197,10 @@ xfs_qm_adjust_dqtimers( | |||
| 197 | } | 197 | } |
| 198 | } else { | 198 | } else { |
| 199 | if ((!d->d_rtb_softlimit || | 199 | if ((!d->d_rtb_softlimit || |
| 200 | (be64_to_cpu(d->d_rtbcount) < | 200 | (be64_to_cpu(d->d_rtbcount) <= |
| 201 | be64_to_cpu(d->d_rtb_softlimit))) && | 201 | be64_to_cpu(d->d_rtb_softlimit))) && |
| 202 | (!d->d_rtb_hardlimit || | 202 | (!d->d_rtb_hardlimit || |
| 203 | (be64_to_cpu(d->d_rtbcount) < | 203 | (be64_to_cpu(d->d_rtbcount) <= |
| 204 | be64_to_cpu(d->d_rtb_hardlimit)))) { | 204 | be64_to_cpu(d->d_rtb_hardlimit)))) { |
| 205 | d->d_rtbtimer = 0; | 205 | d->d_rtbtimer = 0; |
| 206 | } | 206 | } |
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index 15ff5392fb65..0ed9ee77937c 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c | |||
| @@ -1981,7 +1981,7 @@ xfs_qm_dqcheck( | |||
| 1981 | 1981 | ||
| 1982 | if (!errs && ddq->d_id) { | 1982 | if (!errs && ddq->d_id) { |
| 1983 | if (ddq->d_blk_softlimit && | 1983 | if (ddq->d_blk_softlimit && |
| 1984 | be64_to_cpu(ddq->d_bcount) >= | 1984 | be64_to_cpu(ddq->d_bcount) > |
| 1985 | be64_to_cpu(ddq->d_blk_softlimit)) { | 1985 | be64_to_cpu(ddq->d_blk_softlimit)) { |
| 1986 | if (!ddq->d_btimer) { | 1986 | if (!ddq->d_btimer) { |
| 1987 | if (flags & XFS_QMOPT_DOWARN) | 1987 | if (flags & XFS_QMOPT_DOWARN) |
| @@ -1992,7 +1992,7 @@ xfs_qm_dqcheck( | |||
| 1992 | } | 1992 | } |
| 1993 | } | 1993 | } |
| 1994 | if (ddq->d_ino_softlimit && | 1994 | if (ddq->d_ino_softlimit && |
| 1995 | be64_to_cpu(ddq->d_icount) >= | 1995 | be64_to_cpu(ddq->d_icount) > |
| 1996 | be64_to_cpu(ddq->d_ino_softlimit)) { | 1996 | be64_to_cpu(ddq->d_ino_softlimit)) { |
| 1997 | if (!ddq->d_itimer) { | 1997 | if (!ddq->d_itimer) { |
| 1998 | if (flags & XFS_QMOPT_DOWARN) | 1998 | if (flags & XFS_QMOPT_DOWARN) |
| @@ -2003,7 +2003,7 @@ xfs_qm_dqcheck( | |||
| 2003 | } | 2003 | } |
| 2004 | } | 2004 | } |
| 2005 | if (ddq->d_rtb_softlimit && | 2005 | if (ddq->d_rtb_softlimit && |
| 2006 | be64_to_cpu(ddq->d_rtbcount) >= | 2006 | be64_to_cpu(ddq->d_rtbcount) > |
| 2007 | be64_to_cpu(ddq->d_rtb_softlimit)) { | 2007 | be64_to_cpu(ddq->d_rtb_softlimit)) { |
| 2008 | if (!ddq->d_rtbtimer) { | 2008 | if (!ddq->d_rtbtimer) { |
| 2009 | if (flags & XFS_QMOPT_DOWARN) | 2009 | if (flags & XFS_QMOPT_DOWARN) |
diff --git a/fs/xfs/xfs_qm_syscalls.c b/fs/xfs/xfs_qm_syscalls.c index eafbcff81f3a..711a86e39ff0 100644 --- a/fs/xfs/xfs_qm_syscalls.c +++ b/fs/xfs/xfs_qm_syscalls.c | |||
| @@ -813,11 +813,11 @@ xfs_qm_export_dquot( | |||
| 813 | (XFS_IS_OQUOTA_ENFORCED(mp) && | 813 | (XFS_IS_OQUOTA_ENFORCED(mp) && |
| 814 | (dst->d_flags & (FS_PROJ_QUOTA | FS_GROUP_QUOTA)))) && | 814 | (dst->d_flags & (FS_PROJ_QUOTA | FS_GROUP_QUOTA)))) && |
| 815 | dst->d_id != 0) { | 815 | dst->d_id != 0) { |
| 816 | if (((int) dst->d_bcount >= (int) dst->d_blk_softlimit) && | 816 | if (((int) dst->d_bcount > (int) dst->d_blk_softlimit) && |
| 817 | (dst->d_blk_softlimit > 0)) { | 817 | (dst->d_blk_softlimit > 0)) { |
| 818 | ASSERT(dst->d_btimer != 0); | 818 | ASSERT(dst->d_btimer != 0); |
| 819 | } | 819 | } |
| 820 | if (((int) dst->d_icount >= (int) dst->d_ino_softlimit) && | 820 | if (((int) dst->d_icount > (int) dst->d_ino_softlimit) && |
| 821 | (dst->d_ino_softlimit > 0)) { | 821 | (dst->d_ino_softlimit > 0)) { |
| 822 | ASSERT(dst->d_itimer != 0); | 822 | ASSERT(dst->d_itimer != 0); |
| 823 | } | 823 | } |
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c index 329b06aba1c2..7adcdf15ae0c 100644 --- a/fs/xfs/xfs_trans.c +++ b/fs/xfs/xfs_trans.c | |||
| @@ -1151,8 +1151,8 @@ xfs_trans_add_item( | |||
| 1151 | { | 1151 | { |
| 1152 | struct xfs_log_item_desc *lidp; | 1152 | struct xfs_log_item_desc *lidp; |
| 1153 | 1153 | ||
| 1154 | ASSERT(lip->li_mountp = tp->t_mountp); | 1154 | ASSERT(lip->li_mountp == tp->t_mountp); |
| 1155 | ASSERT(lip->li_ailp = tp->t_mountp->m_ail); | 1155 | ASSERT(lip->li_ailp == tp->t_mountp->m_ail); |
| 1156 | 1156 | ||
| 1157 | lidp = kmem_zone_zalloc(xfs_log_item_desc_zone, KM_SLEEP | KM_NOFS); | 1157 | lidp = kmem_zone_zalloc(xfs_log_item_desc_zone, KM_SLEEP | KM_NOFS); |
| 1158 | 1158 | ||
diff --git a/fs/xfs/xfs_trans_dquot.c b/fs/xfs/xfs_trans_dquot.c index 4d00ee67792d..c4ba366d24e6 100644 --- a/fs/xfs/xfs_trans_dquot.c +++ b/fs/xfs/xfs_trans_dquot.c | |||
| @@ -649,12 +649,12 @@ xfs_trans_dqresv( | |||
| 649 | * nblks. | 649 | * nblks. |
| 650 | */ | 650 | */ |
| 651 | if (hardlimit > 0ULL && | 651 | if (hardlimit > 0ULL && |
| 652 | hardlimit <= nblks + *resbcountp) { | 652 | hardlimit < nblks + *resbcountp) { |
| 653 | xfs_quota_warn(mp, dqp, QUOTA_NL_BHARDWARN); | 653 | xfs_quota_warn(mp, dqp, QUOTA_NL_BHARDWARN); |
| 654 | goto error_return; | 654 | goto error_return; |
| 655 | } | 655 | } |
| 656 | if (softlimit > 0ULL && | 656 | if (softlimit > 0ULL && |
| 657 | softlimit <= nblks + *resbcountp) { | 657 | softlimit < nblks + *resbcountp) { |
| 658 | if ((timer != 0 && get_seconds() > timer) || | 658 | if ((timer != 0 && get_seconds() > timer) || |
| 659 | (warns != 0 && warns >= warnlimit)) { | 659 | (warns != 0 && warns >= warnlimit)) { |
| 660 | xfs_quota_warn(mp, dqp, | 660 | xfs_quota_warn(mp, dqp, |
| @@ -677,11 +677,13 @@ xfs_trans_dqresv( | |||
| 677 | if (!softlimit) | 677 | if (!softlimit) |
| 678 | softlimit = q->qi_isoftlimit; | 678 | softlimit = q->qi_isoftlimit; |
| 679 | 679 | ||
| 680 | if (hardlimit > 0ULL && count >= hardlimit) { | 680 | if (hardlimit > 0ULL && |
| 681 | hardlimit < ninos + count) { | ||
| 681 | xfs_quota_warn(mp, dqp, QUOTA_NL_IHARDWARN); | 682 | xfs_quota_warn(mp, dqp, QUOTA_NL_IHARDWARN); |
| 682 | goto error_return; | 683 | goto error_return; |
| 683 | } | 684 | } |
| 684 | if (softlimit > 0ULL && count >= softlimit) { | 685 | if (softlimit > 0ULL && |
| 686 | softlimit < ninos + count) { | ||
| 685 | if ((timer != 0 && get_seconds() > timer) || | 687 | if ((timer != 0 && get_seconds() > timer) || |
| 686 | (warns != 0 && warns >= warnlimit)) { | 688 | (warns != 0 && warns >= warnlimit)) { |
| 687 | xfs_quota_warn(mp, dqp, | 689 | xfs_quota_warn(mp, dqp, |
