[Samba] silent file truncation on ext3 with linux quota v0

Johannes Niess j.niess at uni-bonn.de
Fri Jul 25 08:34:52 GMT 2003


Hi John,

the issue has evolved since Monday. Steve Langasek already knows about
it. How can we keep a single thread of communication?

John H Terpstra <jht at samba.org> writes:

> On Mon, 21 Jul 2003, Johannes Niess wrote:
> 
> > The following message is a courtesy copy of an article
> > that has been posted to comp.protocols.smb as well.
> >
> > Hi,
> >
> > I'm trying to implement file system quotas on a Debian Woody Linux
> > box. My problem is that W2k Explorer silently truncates files when
> > going over quota by copying files. Other applications work as
> > expected and show a "disk full" error message.
> 
> Which applications are working OK?

E. g. Word. We didn't do much tests because IMO correct support for
Explorer is a must. Steve Langasek has an explanation in Debian Bug
report #202396:

>On Tue, Jul 22, 2003 at 11:17:35AM +0200, Johannes Niess wrote:
>> something seems terribly wrong with disk full error handling. Howto
>> reproduce:
>
>> 1) mke2fs /dev/fd0 (with a 1.44 MB floppy)
>> 2) mount /floppy
>> 3) create writeabe [floppy] share in smb.conf:
>> [floppy]
>> path = /floppy
>> writable = yes
>> force user = root ; to shortcut problems with user mount options
>
>> 4) use Windows 200 explorer to copy a 2MB file to [floppy] share
>> 4) No error message on windows client. File truncation for file
>> exceeding disk size. Zero byte length for following files.
>
>> Behavior seen from client varies with file system used:
>> ext2 shows full lenght under windows and linux.
>> vfat shows truncated length.
>
>> I'm afraid that this happens on "real" shares, too.
>
>There is a fundamental disconnect due to the Unix concept of "sparse
>files" (something Windows lacks).  Windows applications sometimes open a
>file for writing, seek to the "end" and write a byte as a means of
>checking whether space is available for the whole file, and then never
>do any more error checking for the duration of the file write.  This
>works passing well when the server is a Windows machine; when the server
>is a Unix machine, it's possible to have a file whose total length is
>greater than the available storage size, since unwritten blocks of
>zeroes in the middle of a file don't use space on the disk.
>
>You can find further discussion of this problem in the archives of the
>samba-technical mailing list.  I think there may be a fix for this in
>Samba 3.0; but even if there isn't, I don't intend to deviate from the
>upstream source to correct what is, ultimately, a *client* bug (since
>AFAIK it's Windows, not Samba, which is failing to check for errors when
>writing).

Further experiments show that "strict allocate = yes" IN SMB.CONF does
not help.

Windows starts using sparse files, too:

http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q231/3/88.ASP&NoWebContent=1

I've read about a registry setting on a windows server to account
sparse files with their physical size. Unfortunately I've lost the
link. It would be very interesting to see how they handle their own
clients.

> 
> >
> > To me it looks like the error code for "over quota" is not propagated
> > back from samba to Windows Explorer.

In the Debian bug report it turned out that this is wrong. It even
happens with a full device without any quota involved. I've just found
it testing quotas.

> >
> > I've tried with all combinations of Linux kernel 2.4.18, latest
> > 2.4-ac, samba-2.2.3a-12 (from woody) and a debian source package
> > 2.2.8a reconfigured --with-quota. I've not yet used a newer quota
> > package.
> >
> > I've found some descriptions of the problem, but no workaround. I
> > understand that samba supports only v2 version quotas (from the -ac
> > kernel series and maybe latest 2.4-marcelo's-pre). I'm not asking for
> > support of network drives size set to quotas. A "dfree command" can
> > easily do that.

The "pie chart" on windows clients is even supported for v0 quotas (at
least for the Debian package).

> >
> > BTW: What's the status of quota support in Samba 3? What I really want
> > are quotas per samba share, independend of the OS.
> 
> Samba does not implement quotas. Quotas are an OS issue. There is no way
> for samba to implement quotas without massive overheads the performance
> hit will be too high. The only way in which samba interacts with OS quotas
> is in reporting remaining quota capacity.

So changing an internal equivalent of "dfree command" is all
"configure --with-quota" does?

> If you believe that the file trucation problem is an abnormal behaviour
> then you will need to capture a level 5 debug log and post a bug report
> with it at https://bugzilla.samba.org

The (generalized) file truncation problem is abnormal and harmfull
behavior compared to a Windows server. So it is percieved as a Samba
bug. It would be very difficult to convince everybody that it is
_not_ Samba's fault.

Do you still need the log?

Johannes Nieß



More information about the samba mailing list