Subject: PEBKACs I can't see with quotas and (unrelated) vserver init PID
From: Grzegorz Nosek <grzegorz.nosek@gmail.com>
Date: Tue, 27 Jul 2010 16:06:48 +0200

Hi,

Call me stupid but I can't get quotactl to change quotas inside
vservers (it used to work some time ago, possibly on vserver 2.2? It's
been broken for me for ages but I finally got to report it). vroots
are set up properly, I can read quotas without problems but every
attempt to modify quotas fails with -EPERM.

host# cat /proc/virtual/2002/status
UseCnt:	272
Tasks:	60
Flags:	00000016020e0310
BCaps:	00000000344c05ff
CCaps:	0000000000100101 <-- 0x100000 is QUOTA_CTL
Spaces:	1c020200 00000000

guest# strace setquota -g somebody 0 2000000 0 0 /dev/hdv1 2>&1 | grep quotactl
quotactl(Q_XGETQSTAT|USRQUOTA, NULL, 0, NULL) = -1 EFAULT (Bad address)
quotactl(Q_XGETQSTAT|USRQUOTA, "/dev/hdv1", 0, {983041, 131, 57,
566935683128, 231928233984, 227633266688, 2597596220620937,
2597596221225600}) = 0
quotactl(Q_XGETQSTAT|GRPQUOTA, "/dev/hdv1", 0, {983041, 131, 57,
566935683128, 231928233984, 227633266688, 2597596220620937,
2597596221225600}) = 0
quotactl(Q_XGETQSTAT|USRQUOTA, "/dev/hdv1", 0, {983041, 131, 57,
566935683128, 231928233984, 227633266688, 2597596220620937,
2597596221225600}) = 0
quotactl(Q_XGETQUOTA|GRPQUOTA, "/dev/hdv1", 200203, {859865337562113,
0, 0, 0, 0, 301808, 19809, 0}) = 0
quotactl(Q_XSETQLIM|GRPQUOTA, "/dev/hdv1", 200203, {4128768, 4000000,
0, 0, 0, 301808, 19809, 0}) = -1 EPERM (Operation not permitted)

Kernel is 2.6.27 with latest vserver patch (2.3 branch). util-vserver
userspace is ancient (0.30.213) but at this stage it should not matter
(it seems to work fine anyway).

A quick google does not return anything relevant (except for enabling
QUOTA_CTL ccapability but as far as I can tell, it's enabled). What
did I miss?

Also:

host# grep -h ^Init /proc/virtual/*/info | uniq
Init:	0

IOW, every vserver reports its init PID as zero. Is it expected behaviour?

Best regards,
 Grzegorz Nosek