[Samba] File deleted while locked

nipponunited.keithrob91 at spamgourmet.com nipponunited.keithrob91 at spamgourmet.com
Wed May 29 02:51:49 MDT 2013

Sorry for slow reply, having trouble with my email!
I don't think updating is the answer, the reason I say that is because stock RHEL 6.4 comes with Samba 3.6.9 (I think) and this did exactly the same thing and where I originally noticed the behaviour. I discovered RHEL had a more recent version and updated to that (4.0.0). Therefore what I am describing appears to have been around for a while now. Additionally, my preference (for various reasons) is to stick with a supported RHEL version of Samba and not build my own.

Happy to post smb.conf if required.

----- Original Message -----
From: Nico Kadel-Garcia - nkadel at gmail.com
Sent: 05/26/13 02:08 PM
To: nipponunited.keithrob91 at spamgourmet.com
Subject: Re: [Samba] File deleted while locked

On Thu, May 23, 2013 at 11:56 AM, <nipponunited.keithrob91 at spamgourmet.com> wrote: > Hi, > > I'm running Samba 4.0.0 on a RHEL 6.4 machine and have created a simple share with all the default configuration options. I've also created an application (running on the RHEL box) that does the following: Update, definitely. My published toolchain for building Samba 4.0.5 as SRPM's, and with the option of acting as a domain controller, is at https://github.com/nkadel/samba-4.0.5-srpm. > - detects a file appearing in the share (using Inotify looking for the IN_CLOSE_WRITE event) > - open and fcntl lock the file > - do some processing > - move the file to somewhere else in the filesystem > > When I use a Windows 7 machine to copy a file to the share (using explorer) my app works fine. However if I copy a file as before, but then while my app is processing the file if I copy the file to the share again, I get a dialog in Windows stating the file is locked, 'Try Again' or 'Cancel'. If I 
 press Cancel, the dialog goes away but so does the file within the share. When my app tries to move the file it fails because it no longer exists. > > Looking at the wireshark output on the Windows machine I see that a SetInfo request is made with a SMB2_FILE_DISPOSITION_INFO and 'Delete on close set', followed by a success response. I assume this is the cause of the file deletion? I have to admit to being a novice at both SMB and Samba so apologies in advance if I'm a little vague. > > Is the above expected even though I have locked the file? > > For further info, I disabled oplocks for my share with no change in behaviour. Update first, then be ready to publish your smb.conf.

More information about the samba mailing list