Bug 166840 - [quota] used block count increases but does not decrease
Summary: [quota] used block count increases but does not decrease
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 9.0-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-11 13:10 UTC by Johan Bergs
Modified: 2012-12-06 16:40 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Johan Bergs 2012-04-11 13:10:14 UTC
We have user quotas enabled on an amd64 system. The filesystem that has quotas enabled is mounted using the following options: (ufs, NFS exported, local, with quotas, journaled soft-updates)

When we check the user quotas using repquota, we can see all user quota. If a user adds new files to the filesystem, repquota does indeed reflect this: the used block count goes up. However, if a user deletes files, the used block count does not go down.

Running quotacheck recalculates the used block count, but afterwards the situation remains the same: used block count can increase, but does not decrease.

The system has recently been upgraded from FreeBSD 8.2. Quotas were working fine when running 8.2.

Fix: 

None
How-To-Repeat: Enable quotas on a FreeBSD 9.0 system, on a partition with soft updates and soft update journaling enabled. Create files and the used block count increases. Delete some files and the used block count remains the same.
Comment 1 Erwin Van de Velde 2012-05-07 10:26:51 UTC
Found another problem report pointing to this (Thanks to koobs, Barnerd
from IRC :-) ):
- PR Kern/164734


Potential patch (
http://tips.paddyonline.net/index.php/FreeBSD_9.0_issues_with_Quota):

diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c
index 5b4b6b9..ed2db79 100644
--- a/sys/ufs/ffs/ffs_softdep.c
+++ b/sys/ufs/ffs/ffs_softdep.c
@@ -43,6 +43,7 @@
 __FBSDID("$FreeBSD$");

 #include "opt_ffs.h"
+#include "opt_quota.h"
 #include "opt_ddb.h"

 /*
@@ -6428,7 +6429,7 @@ softdep_setup_freeblocks(ip, length, flags)
  }
 #ifdef QUOTA
  /* Reference the quotas in case the block count is wrong in the end. */
- quotaref(vp, freeblks->fb_quota);
+ quotaref(ITOV(ip), freeblks->fb_quota);
  (void) chkdq(ip, -datablocks, NOCRED, 0);
 #endif
  freeblks->fb_chkcnt = -datablocks;


Did not test it myself yet.
Comment 2 atp99 2012-07-20 09:21:17 UTC
Hi,

This is a follow-up to the problem report kern/166840: [quota] used 
block count increases but does not decrease.

We tested the reported potential patch 
(http://tips.paddyonline.net/index.php/FreeBSD_9.0_issues_with_Quota 
<http://tips.paddyonline.net/index.php/FreeBSD_9.0_issues_with_Quota%29:>) 
on our 64bit Freebsd 9.0 system (running on VMWare ESXi). We applied the 
patch over 2 months ago and the system has been running without any 
problems since we applied the patch. Now the used block count increases 
and decreases correctly (the partition has quota, soft updates and 
softupdate journaling enabled).

Environment:
FreeBSD koala 9.0-RELEASE-p2 FreeBSD 9.0-RELEASE-p2 #0: Sat Jun  2 
07:16:04 EEST 2012     hfvk@koala:/usr/obj/usr/src/sys/ELIZABETH amd64

- Antti
Comment 3 Winston Weinert 2012-12-06 16:31:43 UTC
I'd like to ask for a status update on PR kern/166840. This bug affects
a VPS used for shell accounts I administrate.
Comment 4 Gavin Atkinson freebsd_committer freebsd_triage 2012-12-06 16:37:44 UTC
State Changed
From-To: open->closed

Fixed in r231091, merged to stable/9 as r231581.