[Samba] Difference in Samba and CIFS interms of keeping the deleted files opened

Jeremy Allison jra at samba.org
Mon Jul 20 12:42:28 MDT 2009


On Mon, Jul 20, 2009 at 10:14:49PM +0530, Nikhil wrote:
>  Hi,
> 
> We have a CIFS server running on a NetApp server and a Solaris host running
> Samba-3.3.2.
> 
> When we mount both the filesystems to a Drive on a Windows using the net use
> command and then try to run a java program which basically does nothing but
> continuosly writes a data chunk to a file. On a side note, these same
> filesystems are accessible on a Solaris (unix) host too.
> 
> When the java program is run and a file is being generated, I go to my unix
> terminal and happen to delete the file generated by the java program.
> Interestingly, there is an IOexception caught in the java program running on
> the Windows machine, when the file is deleted on the CIFS based filesystem
> (available on Solaris as a NFS filesystems) but there is no exception caught
> when the filesystem happens to be Samba (available on Solaris as /var , a
> regular partition).
> 
> I delete the file from Unix as the process demands, but also there is no way
> to delete a in-use-file in Windows.
> 
> I would like to understand the differences in Samba and CIFS in this context
> especially why is that so there is an IOexception for a CIFS based
> filesystem but not on the samba filesystem. This is reproducible at will.
> What could be wrong? What could be made to make samba filesystem also behave
> the same way to throw exceptions (Exceptions are good than that not at all
> knowing there is a file that is deleted but being still written onto.)

Ok, I think the reason that you're having this problem is that
you're running Samba on Solaris in this case, sad to say.

I don't believe Sun have exposed kernel level oplock (lease) capability
to user space processes, so Samba on Solaris has no way of knowing
that a unix user deleted the file.

Samba running on Linux, (or SGI Irix) has kernel level oplocks,
so can detect access from the local filesystem. As the NetApp
runs a custom kernel (derived a long time ago from FreeBSD I
believe) then their CIFS implementation (like Samba on Linux)
knows when a NFS user has modified the file.

Jeremy.


More information about the samba mailing list