2.2.5pre1: unlink design flaw

jd at epcnet.de jd at epcnet.de
Thu Jun 13 11:07:02 GMT 2002


> This changes are not good for a normal samba installation.

They do not change anything on a "normal" installation. On a "normal" installation
unlink() and rmdir() never return ETXTBSY.

> First of all, Samba has been built to be run on posix file systems, and
> is not guaranteed to work 100% ok with underlying non posix file
> systems.

You dont want to produce a better system? Which can do more?

> Your modifications make samba vulnerable to unacceptable race
> conditions.

I think these race conditions are only theoretical: ETXTBSY is just
returned by smbfs on a unlink operation.

> The race stay in the fact that you may rename the file and create a link
> to an important file between the close and the second unlink, with very
> bad results.

On smbfs you cannot create links. Nor on fatfs.

> And samba is not the only application that do this kind of operation,
> the proper fix would be to make smbfs driver able to "hide" a file if it
> is unlilnked but yet open by some process, and then silently unlink it
> when the last process closes it.

Thats not so easy. If the file is only hidden by the client (smbfs), you cannot create a file
with the same name if e.g. the smbserver itself has the file open.

On smbfs a rename on a open file fails too, so no chance...

> Making this thing at kernel level with proper atomicity will make
> everything better (and more posix compliant).

smbfs cannot be posix compliant. It's just a client to a smb server
and it only offers what a smb server can do. And a smb server
cannot a) unlink open files b) unlink open directorys. 

So its the best solution for that problem. There could be a better
solution for close_directory(), cause i just look if it fails and don't
look after the errno. And there is a issue an notify_kernel, because
it looses the last notification (which should be send manually) -
but if the Samba Team disagrees i don't do any further changes.

Another solution would be if Urban Widmark has THE idea to make
smbfs unlink and rmdir fully posix compliant. But i bet not.

Greetings

  Jochen Dolze
--- 
EPCNet GmbH
ISP & Web Design
Bleichstrasse 24
89077 Ulm

Tel.  +49 731 1416 0
Fax  +49 731 1416 120






More information about the samba-technical mailing list