Subject: Re: [vserver] vdlimit limited to 32-bit integer
From: Andre Timmermann <vserver.lists@darktim.de>
Date: Thu, 19 Nov 2009 09:41:15 +0100

Hello Herbert, hello list,

Am Samstag, den 14.11.2009, 17:11 +0100 schrieb Herbert Poetzl:

> > As far, as I can see, space_total is limited to 2^32 - 1 = 4294967295
> 
> correct, that is not only a limitation of vdlimit,
> but also of the kernel interface (which uses uint32_t too)
> 
> > On line 85 of 
> > http://svn.linux-vserver.org/projects/util-vserver/browser/trunk/src/vdlimit.c
> > I see an "uint32_t"  which seemes to be the limiting factor.
> 
> > I can't write C so I can't fix it, but perhaps this helps ;)
> 
> the question is, do you really need more?
> 
> space_total and space_used is in kilobyte, so 2^10 bytes
> that makes a total max of 2^41 (there are some special values)
> or 2TB, which usually should suffice for guest limits
> 
> present a case why you need more than that and we might
> extend the interface to cover all 2^64 accounted bytes
> (i.e. 16EB, exa bytes)

The case is very simple, we have got a vserverguest which needs more
than 2 TB diskspace ;) We are using a vserverguest in favour of a
dedicated machine to be independent from the hardware itself. The quota
is a very easy way to monitor the diskspace.

I have seen, that there seemes to be an inconsitence between the
kernelinterface and vdlimit. I am able to set 4 TB quota (2^32-1):

/usr/sbin/vdlimit --xid 60144 --set space_used=2069262452     \
 --set space_total=4294967295 --set inodes_used=1185528       \
 --set inodes_total=286501273 /var/lib/vservers/vguest/

The vdlimit shows a negative value:

/usr/sbin/vdlimit --xid 60144 /var/lib/vservers/vguest/

60144 /var/lib/vservers/vguest/
space_used=-2045859808
space_total=-1
inodes_used=7230176
inodes_total=286501273
reserved=5

The vguest shows the correct values:
# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/hdv1             4.5T  2.1T  2.2T  50% /


I understand, that the kernel ist using uint32, too, but I think this
should be raised in future as diskspace is pretty cheap and there will
be other users hit by this limitation.

As I am not a kernelhacker, I cant evaluate the drawbacks of raising
this value within the kernel and the vserver-tools. Perhaps you can give
me a hint.


Best regards,
Andre