[Samba] locks cooperating with a server side process
Chris Green
cmg at dok.org
Mon Jul 19 17:39:18 GMT 2004
Good day folks,
I'm using Samba 2.2.8a [1] on Slackware 9.1 with 2000/XP clients.
I'm attempting to have a process by which a user drags a file using
Windows Explorer into a share. On the server side, I have a unix
process that polls the directory for new files and then reads them and
deletes them.
I'm having a problem where I can gain the lock but the process is
still writing to the file.
Python code:
import fcntl
# open file in rw so I gain exclusive lock
f = open("cygwin.tar","r+")
# if this doesn't raise an IOError, the lock is acquired
fcntl.lockf(f,fcntl.LOCK_EX|fcntl.LOCK_NB)
which maps into a fcntl exclusive lock with 0 as the start,
end, and whence arguments in the flock structure.
In smb.conf, "locking = yes" had no effect on my process. The next
thing I tried was "strict locking = yes". This had the effect that
as soon as my code performs the lock, a windows dialog appears:
``Cannot copy cygwin: The process cannot access the file because
another process has locked a portion of the file''
This leads me to suspect that either Windows Explorer or samba doesn't
gain a lock on the file on creation. Is there a way to tell samba to
set that lock?
Thanks,
Chris
Footnotes:
[1] Samba is compiled:
--with-fhs \
--prefix=/usr \
--localstatedir=/var \
--bindir=/usr/bin \
--sbindir=/usr/sbin \
--with-lockdir=/var/cache/samba \
--sysconfdir=/etc \
--with-configdir=/etc/samba \
--with-privatedir=/etc/samba/private \
--with-codepagedir=/etc/codepages \
--with-smbmount \
--with-quotas \
--with-syslog \
--with-utmp \
--with-sambabook=/usr/share/swat/using_samba \
--with-ssl \
--with-sslinc=/usr/include/openssl \
--with-ssllib=/usr \
--with-msdfs \
--with-vfs \
--with-libsmbclient \
i386-slackware-linux
--
Chris Green <cmg at dok.org>
To err is human, to moo bovine.
More information about the samba
mailing list