[Dovecot] RHEL 3 and quota issues.

Alan Premselaar alien at 12inch.com
Mon Jun 26 05:49:13 EEST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Thanks to code provided by Geo Carncross, I was able to determine what
the problem was with v2 quota support on RHEL 3 using ext3 filesystems.

I've included a patch file for quota-fs.c

<sys/quota.h> on RHEL 3 sets _LINUX_QUOTA_VERSION to 1 if it's not
defined by default.  I copied <sys/quota.h> to ./sysquota.h and edited
it to set _LINUX_QUOTA_VERSION to 2 if not defined since that's the
version i'm using on my machine.  I don't know if that's necessarily
appropriate so I'm not including that file. (I then modified quota-fs.h
to load "sysquota.h" instead of <sys/quota.h>)

I was able to get it to compile and properly show the quota information now.

I'd like to do more testing (like seeing if explicitly setting
_LINUX_QUOTA_VERSION to 2 is really necesssary) but my one and only RHEL
3 machine is my production mail server, so I can't really do that.

Anyways, since I figured out the problem and fixed it for myself, I
thought I would share :)

Timo, perhaps if you have the time to look at the patch and if the
modifications to the quota.h file are necessary or not and include it
into the next CVS update, I'm sure people would appreciate it.

Thanks,

Alan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEn0spE2gsBSKjZHQRAs/RAJ9DsqkhHYvRifZYkOcLo8DibQMS0gCdEPDD
A4CUiujssDVT5e+pjfuMWow=
=+6vU
-----END PGP SIGNATURE-----
-------------- next part --------------
--- quota-fs.c.orig	2006-06-26 11:23:30.000000000 +0900
+++ quota-fs.c	2006-06-26 11:27:52.000000000 +0900
@@ -191,7 +191,7 @@
 		     /* BSD, AIX */
 		     root->mount->device_path, QCMD(Q_GETQUOTA, USRQUOTA),
 #endif
-		     root->uid, (void *)&dqblk) < 0) {
+		     root->uid, (caddr_t)&dqblk) < 0) {
 		i_error("quotactl(Q_GETQUOTA, %s) failed: %m",
 			root->mount->device_path);
 		quota_set_error(_root->setup->quota, "Internal quota error");
@@ -211,8 +211,13 @@
 		return -1;
 	}
 #endif
+#if _LINUX_QUOTA_VERSION < 2
 	*value_r = (uint64_t)dqblk.dqb_curblocks *
 		(uint64_t)root->mount->blk_size / 1024 / 4096;
+#else
+	*value_r = (uint64_t)dqblk.dqb_curspace *
+		(uint64_t)root->mount->blk_size / 1024 / 4096;
+#endif
 	*limit_r = (uint64_t)dqblk.dqb_bsoftlimit *
 		(uint64_t)root->mount->blk_size / 1024 / 4;
 	return 1;


More information about the dovecot mailing list