limit jail disk space

Jone Jas jas_arlerr at yahoo.com.cn
Thu Jul 14 06:37:58 GMT 2005


Alex Lyashkov <shadow at psoft.net> дµÀ£º
§£ §³§â§Õ, 13.07.2005, §Ó 18:46, Jone Jas §á§Ú§ê§Ö§ä:
> Alex Lyashkov дµÀ£º 
> §£ §³§â§Õ, 13.07.2005, §Ó 16:22, Jone Jas §á§Ú§ê§Ö§ä:
> > Alex Lyashkov дµÀ£º 
> > > >option QUOTA? or jail disklimit? 
> > > I mean jail disk limit
> > > 
> > > >for jail disklimit more easy create tools who controled
> all
> > > limits >for jail.
> > > >Look to LinuxVServer project (www.linux-vserver.org) or
> > > >FreeVPS.
> > > Sure. The tools may control all limits such as cpu time,
> > > memory, bandwidth, disk space, etc. I have read the Linux
> > > VServer dlimit code. But I am not very sure where to put
> the
> > > hooks for inode/blocks control of jail in FreeBSD. This is
> > why
> > > I open this thread. Vlad GALU said I can look to the quota
> > > method. I will try. Thanks.
> > > -- 
> > >If you look into quota function you can see it called from
> > >inode/blocks allocation/deallocation code at same points
> you> >can install disklimits hooks. 
> > >I can`t find any benefit add new quota type (total size
> used
> > at >jail) - this way was used at early version Linux VServer
> > but >have are one problem - more difficult create separated
> > per jail >diskquota. 
> > 
> > I am really not aware of this. Are there some conflicts?
> > 
> >In case of undivided diskquota hash you will have to make
> >superfluous comparisons at searching. It may be too many
> >objects with the same uid/gid, but different jid. If you will
> divide >diskquota hash, you need to add parameter in macro
> >DQHASH.
> I understand.
>look into ufs_quota.c:dqget().
>I say about situation with same uid/gid at different jails. For >me more right map disk device id then map uid to different >value. 

>At you way you need modify
>LIST_FOREACH(dq, dqh, dq_hash) {
>if (dq->dq_id != id ||
>dq->dq_ump->um_quotas[dq->dq_type] != dqvp)
>continue;
>to
>LIST_FOREACH(dq, dqh, dq_hash) {
>if (dq->dq_id != id || dq->dq_jid != jid ||
>dq->dq_ump->um_quotas[dq->dq_type] != dqvp)
>continue;
>..
>but at my way (used at freevps and last linux-vserver)
>need only
>- dqh = DQHASH(dqvp, id);
>+ dqh = DQHASH(map_dqvp, id);
Sounds good! Seems more simple and efficient than my way. Btw, which FreeBSD version is your patch against? 5.3 or 5.4?

> > 
> > >If you create disklimit separated from quota code you can
> > >easy add quota hash ptr into prison structure and switch
> > >hashes when work.
> > >Next problem - where store jail id for dinode struct.
> > >rwantson@ say we need use xattr for this, but my opinion >
> >usereserved fields in dinode.
> > 
> > Yes. My opinion is the same with yours.
> > 
> >You want add reference pointer to prison struct from a inode
> >struct or store at inode struct prison id?
> I mean just jid. I think that is enough.
> 
> 
> >PS
> >if interested, i tried to port freevps structure to freebsd
> jail -
> >resulting patch available
> >http://www.freevps.com/download/freebsd/. It
> >have same functionality with jail and add only total process
> >limit in jail.
> 
> Thanks for your patch. I have taken a glance and I will read
> it carefully in my spare time. I think it will help me a lot.
> 

-- 
FreeVPS Developers Team http://www.freevps.com




		
---------------------------------
DO YOU YAHOO!?
  ÑÅ»¢Ãâ·ÑGÓÊÏ䣭ÖйúµÚÒ»¾øÎÞÀ¬»øÓʼþɧÈų¬´óÓÊÏä 


More information about the freebsd-hackers mailing list