Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 754002b4 authored by Nathan Scott's avatar Nathan Scott
Browse files

[XFS] Merge a few minor fixes to the quota warning code.



SGI-PV: 938145
SGI-Modid: xfs-linux:xfs-kern:22901a

Signed-off-by: default avatarNathan Scott <nathans@sgi.com>
parent 06d10dd9
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -286,7 +286,9 @@ xfs_qm_adjust_dqlimits(
 * We also return 0 as the values of the timers in Q_GETQUOTA calls, when
 * enforcement's off.
 * In contrast, warnings are a little different in that they don't
 * 'automatically' get started when limits get exceeded.
 * 'automatically' get started when limits get exceeded.  They do
 * get reset to zero, however, when we find the count to be under
 * the soft limit (they are only ever set non-zero via userspace).
 */
void
xfs_qm_adjust_dqtimers(
@@ -315,6 +317,8 @@ xfs_qm_adjust_dqtimers(
				INT_GET(d->d_blk_hardlimit, ARCH_CONVERT)))) {
			INT_SET(d->d_btimer, ARCH_CONVERT,
				get_seconds() + XFS_QI_BTIMELIMIT(mp));
		} else {
			d->d_bwarns = 0;
		}
	} else {
		if ((!d->d_blk_softlimit ||
@@ -336,6 +340,8 @@ xfs_qm_adjust_dqtimers(
				INT_GET(d->d_ino_hardlimit, ARCH_CONVERT)))) {
			INT_SET(d->d_itimer, ARCH_CONVERT,
				get_seconds() + XFS_QI_ITIMELIMIT(mp));
		} else {
			d->d_iwarns = 0;
		}
	} else {
		if ((!d->d_ino_softlimit ||
@@ -357,6 +363,8 @@ xfs_qm_adjust_dqtimers(
				INT_GET(d->d_rtb_hardlimit, ARCH_CONVERT)))) {
			INT_SET(d->d_rtbtimer, ARCH_CONVERT,
				get_seconds() + XFS_QI_RTBTIMELIMIT(mp));
		} else {
			d->d_rtbwarns = 0;
		}
	} else {
		if ((!d->d_rtb_softlimit ||
+2 −0
Original line number Diff line number Diff line
@@ -1550,8 +1550,10 @@ xfs_qm_reset_dqcounts(
		INT_SET(ddq->d_rtbcount, ARCH_CONVERT, 0ULL);
		INT_SET(ddq->d_btimer, ARCH_CONVERT, (time_t)0);
		INT_SET(ddq->d_itimer, ARCH_CONVERT, (time_t)0);
		INT_SET(ddq->d_rtbtimer, ARCH_CONVERT, (time_t)0);
		INT_SET(ddq->d_bwarns, ARCH_CONVERT, 0UL);
		INT_SET(ddq->d_iwarns, ARCH_CONVERT, 0UL);
		INT_SET(ddq->d_rtbwarns, ARCH_CONVERT, 0UL);
		ddq = (xfs_disk_dquot_t *) ((xfs_dqblk_t *)ddq + 1);
	}

+21 −3
Original line number Diff line number Diff line
@@ -617,7 +617,8 @@ xfs_qm_scall_setqlim(
	if (!capable(CAP_SYS_ADMIN))
		return XFS_ERROR(EPERM);

	if ((newlim->d_fieldmask & (FS_DQ_LIMIT_MASK|FS_DQ_TIMER_MASK)) == 0)
	if ((newlim->d_fieldmask &
	    (FS_DQ_LIMIT_MASK|FS_DQ_TIMER_MASK|FS_DQ_WARNS_MASK)) == 0)
		return (0);

	tp = xfs_trans_alloc(mp, XFS_TRANS_QM_SETQLIM);
@@ -702,12 +703,23 @@ xfs_qm_scall_setqlim(
		qdprintk("ihard %Ld < isoft %Ld\n", hard, soft);
	}

	/*
	 * Update warnings counter(s) if requested
	 */
	if (newlim->d_fieldmask & FS_DQ_BWARNS)
		INT_SET(ddq->d_bwarns, ARCH_CONVERT, newlim->d_bwarns);
	if (newlim->d_fieldmask & FS_DQ_IWARNS)
		INT_SET(ddq->d_iwarns, ARCH_CONVERT, newlim->d_iwarns);
	if (newlim->d_fieldmask & FS_DQ_RTBWARNS)
		INT_SET(ddq->d_rtbwarns, ARCH_CONVERT, newlim->d_rtbwarns);

	if (id == 0) {
		/*
		 * Timelimits for the super user set the relative time
		 * the other users can be over quota for this file system.
		 * If it is zero a default is used.  Ditto for the default
		 * soft and hard limit values (already done, above).
		 * soft and hard limit values (already done, above), and
		 * for warnings.
		 */
		if (newlim->d_fieldmask & FS_DQ_BTIMER) {
			mp->m_quotainfo->qi_btimelimit = newlim->d_btimer;
@@ -721,7 +733,13 @@ xfs_qm_scall_setqlim(
			mp->m_quotainfo->qi_rtbtimelimit = newlim->d_rtbtimer;
			INT_SET(ddq->d_rtbtimer, ARCH_CONVERT, newlim->d_rtbtimer);
		}
	} else /* if (XFS_IS_QUOTA_ENFORCED(mp)) */ {
		if (newlim->d_fieldmask & FS_DQ_BWARNS)
			mp->m_quotainfo->qi_bwarnlimit = newlim->d_bwarns;
		if (newlim->d_fieldmask & FS_DQ_IWARNS)
			mp->m_quotainfo->qi_iwarnlimit = newlim->d_iwarns;
		if (newlim->d_fieldmask & FS_DQ_RTBWARNS)
			mp->m_quotainfo->qi_rtbwarnlimit = newlim->d_rtbwarns;
	} else {
		/*
		 * If the user is now over quota, start the timelimit.
		 * The user will not be 'warned'.