diff options
-rw-r--r-- | fs/xfs/quota/xfs_trans_dquot.c | 49 |
1 files changed, 39 insertions, 10 deletions
diff --git a/fs/xfs/quota/xfs_trans_dquot.c b/fs/xfs/quota/xfs_trans_dquot.c index b9db6f781cd6..c3ab75cb1d9a 100644 --- a/fs/xfs/quota/xfs_trans_dquot.c +++ b/fs/xfs/quota/xfs_trans_dquot.c | |||
@@ -589,6 +589,20 @@ xfs_trans_unreserve_and_mod_dquots( | |||
589 | } | 589 | } |
590 | } | 590 | } |
591 | 591 | ||
592 | STATIC void | ||
593 | xfs_quota_warn( | ||
594 | struct xfs_mount *mp, | ||
595 | struct xfs_dquot *dqp, | ||
596 | int type) | ||
597 | { | ||
598 | /* no warnings for project quotas - we just return ENOSPC later */ | ||
599 | if (dqp->dq_flags & XFS_DQ_PROJ) | ||
600 | return; | ||
601 | quota_send_warning((dqp->dq_flags & XFS_DQ_USER) ? USRQUOTA : GRPQUOTA, | ||
602 | be32_to_cpu(dqp->q_core.d_id), mp->m_super->s_dev, | ||
603 | type); | ||
604 | } | ||
605 | |||
592 | /* | 606 | /* |
593 | * This reserves disk blocks and inodes against a dquot. | 607 | * This reserves disk blocks and inodes against a dquot. |
594 | * Flags indicate if the dquot is to be locked here and also | 608 | * Flags indicate if the dquot is to be locked here and also |
@@ -657,13 +671,21 @@ xfs_trans_dqresv( | |||
657 | * nblks. | 671 | * nblks. |
658 | */ | 672 | */ |
659 | if (hardlimit > 0ULL && | 673 | if (hardlimit > 0ULL && |
660 | hardlimit <= nblks + *resbcountp) | 674 | hardlimit <= nblks + *resbcountp) { |
675 | xfs_quota_warn(mp, dqp, QUOTA_NL_BHARDWARN); | ||
661 | goto error_return; | 676 | goto error_return; |
677 | } | ||
662 | if (softlimit > 0ULL && | 678 | if (softlimit > 0ULL && |
663 | softlimit <= nblks + *resbcountp && | 679 | softlimit <= nblks + *resbcountp) { |
664 | ((timer != 0 && get_seconds() > timer) || | 680 | if ((timer != 0 && get_seconds() > timer) || |
665 | (warns != 0 && warns >= warnlimit))) | 681 | (warns != 0 && warns >= warnlimit)) { |
666 | goto error_return; | 682 | xfs_quota_warn(mp, dqp, |
683 | QUOTA_NL_BSOFTLONGWARN); | ||
684 | goto error_return; | ||
685 | } | ||
686 | |||
687 | xfs_quota_warn(mp, dqp, QUOTA_NL_BSOFTWARN); | ||
688 | } | ||
667 | } | 689 | } |
668 | if (ninos > 0) { | 690 | if (ninos > 0) { |
669 | count = be64_to_cpu(dqp->q_core.d_icount); | 691 | count = be64_to_cpu(dqp->q_core.d_icount); |
@@ -677,12 +699,19 @@ xfs_trans_dqresv( | |||
677 | if (!softlimit) | 699 | if (!softlimit) |
678 | softlimit = q->qi_isoftlimit; | 700 | softlimit = q->qi_isoftlimit; |
679 | 701 | ||
680 | if (hardlimit > 0ULL && count >= hardlimit) | 702 | if (hardlimit > 0ULL && count >= hardlimit) { |
681 | goto error_return; | 703 | xfs_quota_warn(mp, dqp, QUOTA_NL_IHARDWARN); |
682 | if (softlimit > 0ULL && count >= softlimit && | ||
683 | ((timer != 0 && get_seconds() > timer) || | ||
684 | (warns != 0 && warns >= warnlimit))) | ||
685 | goto error_return; | 704 | goto error_return; |
705 | } | ||
706 | if (softlimit > 0ULL && count >= softlimit) { | ||
707 | if ((timer != 0 && get_seconds() > timer) || | ||
708 | (warns != 0 && warns >= warnlimit)) { | ||
709 | xfs_quota_warn(mp, dqp, | ||
710 | QUOTA_NL_ISOFTLONGWARN); | ||
711 | goto error_return; | ||
712 | } | ||
713 | xfs_quota_warn(mp, dqp, QUOTA_NL_ISOFTWARN); | ||
714 | } | ||
686 | } | 715 | } |
687 | } | 716 | } |
688 | 717 | ||