Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Oct 1998 13:16:06 +0200 (CEST)
From:      tobez@plab.ku.dk
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   bin/8164: repquota incorrectly reports quotas larger than 4Gbytes
Message-ID:  <199810061116.NAA21040@lion.plab.ku.dk>

next in thread | raw e-mail | index | archive | help

>Number:         8164
>Category:       bin
>Synopsis:       repquota incorrectly reports quotas larger than 4Gbytes
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Oct  6 04:20:01 PDT 1998
>Last-Modified:
>Originator:     Anton Berezin
>Organization:
The Protein Laboratory, University of Copenhagen
>Release:        FreeBSD 2.2.7-RELEASE i386
>Environment:

	"$Id: repquota.c,v 1.3.6.3 1998/03/09 13:52:17 jkh Exp $"

>Description:

	repquota reports softlimits, hardlimits and ``used'' field
incorrectly, namely those numbers get wrapped modulo 4Gbytes.

>How-To-Repeat:

	The easiest way is to create files owned by particular
user/group with total sizes exceeding 4Gbytes, and look at the
repquota-generated output.

>Fix:
	
--- repquota.c.orig	Mon Oct  5 20:07:59 1998
+++ repquota.c	Mon Oct  5 20:50:10 1998
@@ -64,6 +64,18 @@
 #include <string.h>
 #include <unistd.h>
 
+/* Let's be paranoid about block size */
+#if 10 > DEV_BSHIFT
+#define dbtokb(db) \
+        ((off_t)(db) >> (10-DEV_BSHIFT))
+#elif 10 < DEV_BSHIFT
+#define dbtokb(db) \
+        ((off_t)(db) << (DEV_BSHIFT-10))
+#else
+#define dbtokb(db)	(db)
+#endif
+
+
 char *qfname = QUOTAFILENAME;
 char *qfextension[] = INITQFNAMES;
 
@@ -233,9 +245,9 @@
 			fup->fu_dqblk.dqb_isoftlimit &&
 			    fup->fu_dqblk.dqb_curinodes >=
 			    fup->fu_dqblk.dqb_isoftlimit ? '+' : '-',
-			(u_long)(dbtob(fup->fu_dqblk.dqb_curblocks) / 1024),
-			(u_long)(dbtob(fup->fu_dqblk.dqb_bsoftlimit) / 1024),
-			(u_long)(dbtob(fup->fu_dqblk.dqb_bhardlimit) / 1024),
+			(u_long)(dbtokb(fup->fu_dqblk.dqb_curblocks)),
+			(u_long)(dbtokb(fup->fu_dqblk.dqb_bsoftlimit)),
+			(u_long)(dbtokb(fup->fu_dqblk.dqb_bhardlimit)),
 			fup->fu_dqblk.dqb_bsoftlimit &&
 			    fup->fu_dqblk.dqb_curblocks >=
 			    fup->fu_dqblk.dqb_bsoftlimit ?
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199810061116.NAA21040>