From 9ae79363c480537a31e6f8abe5707bdd74125b37 Mon Sep 17 00:00:00 2001 From: mckusick Date: Fri, 28 Apr 2000 06:12:56 +0000 Subject: When files are given to users by root, the quota system failed to reset their grace timer as their ownership crossed the soft limit threshhold. Thus if they had been over their limit in the past, they were suddenly penalized as if they had been over their limit ever since. The fix is to check when root gives away files, that when the receiving user crosses their soft limit, their grace timer is reset. See the PR report for a detailed method of reproducing the bug. PR: kern/17128 Submitted by: Andre Albsmeier Reviewed by: Kirk McKusick --- sys/ufs/ufs/ufs_quota.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'sys/ufs/ufs') diff --git a/sys/ufs/ufs/ufs_quota.c b/sys/ufs/ufs/ufs_quota.c index 1baf165..18cbcd3 100644 --- a/sys/ufs/ufs/ufs_quota.c +++ b/sys/ufs/ufs/ufs_quota.c @@ -164,6 +164,11 @@ chkdq(ip, change, cred, flags) dq->dq_flags |= DQ_WANT; (void) tsleep((caddr_t)dq, PINOD+1, "chkdq2", 0); } + /* Reset timer when crossing soft limit */ + if (dq->dq_curblocks + change >= dq->dq_bsoftlimit && + dq->dq_curblocks < dq->dq_bsoftlimit) + dq->dq_btime = time_second + + VFSTOUFS(ITOV(ip)->v_mount)->um_btime[i]; dq->dq_curblocks += change; dq->dq_flags |= DQ_MOD; } @@ -280,6 +285,11 @@ chkiq(ip, change, cred, flags) dq->dq_flags |= DQ_WANT; (void) tsleep((caddr_t)dq, PINOD+1, "chkiq2", 0); } + /* Reset timer when crossing soft limit */ + if (dq->dq_curinodes + change >= dq->dq_isoftlimit && + dq->dq_curinodes < dq->dq_isoftlimit) + dq->dq_itime = time_second + + VFSTOUFS(ITOV(ip)->v_mount)->um_itime[i]; dq->dq_curinodes += change; dq->dq_flags |= DQ_MOD; } -- cgit v1.1