linux (but not samba) quotas

David Lee T.D.Lee at durham.ac.uk
Wed Mar 28 09:20:34 GMT 2001


On Tue, 27 Mar 2001, Jim McDonough wrote:

> Some time ago, someone presented an interesting situation...suppose the
> local fs quotas, but not samba quota support, are enabled.  When an NT
> client tries to write a file too large (say 1MB) to fit within the user's
> quota (say 4K remaining), the file size is set, then the file is written.
> An error is returned that the disk is full, but a (sort of) inconsistency
> arises: the file size appears to be 1MB, but only 4K worth of data is in
> the file.  Yeah yeah, sparse files and all that, but we've got folks
> complaining about that.  Since quota support isn't enabled, we can't detect
> that it won't fit, and we end up with this improper state.  I'd like to
> propose the following patch that checks to see if the file write failed due
> to quota limits and truncate the file at the current position.  I don't
> feel that this is the "right" thing to do, although there may not be a
> "right" answer.  [...]

I agree with your last sentence.  This doesn't feel right.  When that
happens, I pause and try to look deeper, rather than painting over the
crack. 

We use quotas extensively on our Solaris system (~700 simultaneous Samba
connections + lots of NFS) so we so have some experience in the this
general area.  But...

Disclaimer 1:  I know nothing about linux, even less of its quotas.
Disclaimer 2:  I may well have misunderstood the problem you describe.

So what follows may be partially or totally bananas... 

I think the _real_ problem lies in your first sentence:
   "suppose the local fs quotas, but not samba quota support, are enabled"

Quotas on the filesystem should either be on, or be off.  Period.  If your
local filesystem quotas are on, then your samba installation should use
"--with-quotas".  Repeat period.

Note that the semantics of "--with-quotas" are "if a quota applies on this
paricular query, use it in preference to the default, df-like figures". 
That is, it is basically safe to apply.

Now if you choose to have quotas on at the UNIX/filesystem level, but then
you also choose, inconsistently, to configure your samba to ignore your
own earlier choice, then this (I humbly submit!) would seem to be your
problem, not Samba's.  (Insert smiley face.) 

It seems that your configuration choices are inherently inconsistent. 

Have I mis-understood?  My apologies if I have. 

In fact, I would suggest that if you have any quotas on any of your
filesystems anywhere in sight (or even if you don't), you should strongly
consider using "--with-quotas"  all the time.  Samba's quota support is
designed to be safe:  if a particular filesystem has quotas, Samba will
use them;  if it doesn't, then the Samba code will safely "fall through" 
to its usual usage of the "df"-like numbers of your diskspace.

That is what we do.  Most of our filesystems are quota'd: a few (same
fileserver, same smbd binary) are not.  The client/PC end sees quota-based
figures, where present, on quota'd filesystems, and sees df-based figures
on non-quota'd ones.  Clean, consistent with UNIX, and expected.

Hope I understood.  Hope that helps.


A more general point to the samba team.  Now that quota support is so well
established in Samba, shouldn't "--with-quotas" simply default to "on"?
Even remove the unnecessary option?  The transition from the 2.0.x series
to the 2.2 series seems like an ideal point to introduce such a tweak. 
As I understand it, this change should be entirely transparent for the
majority (although there may be one or two portability glitches on
little-tried platforms). 

-- 

:  David Lee                                I.T. Service          :
:  Systems Programmer                       Computer Centre       :
:                                           University of Durham  :
:  http://www.dur.ac.uk/t.d.lee/            South Road            :
:                                           Durham                :
:  Phone: +44 191 374 2882                  U.K.                  :





More information about the samba-technical mailing list