nipponunited.keithrob91 at spamgourmet.com
2013-May-23 15:56 UTC
[Samba] File deleted while locked
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: - 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. Keith
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.
nipponunited.keithrob91 at spamgourmet.com
2013-May-29 08:51 UTC
[Samba] File deleted while locked
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. Keith ----- 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.
Reasonably Related Threads
- Replicate Excel's LOGEST worksheet function in R
- [Bug 83897] New: GK106 (GeForce GTX 660): Frequent GPU lockups
- Returned mail: see transcript for details (fwd)
- Display Multiple page lattice plots
- [Bug 79820] New: Strange readout on fan1_input when pwm1_min < 33