file locking

MCCALL,DON (HP-USA,ex1) don_mccall at hp.com
Fri Mar 16 22:20:38 GMT 2001


Ok Robin,
Well, Robin, I'm using CIFS/9000 SERVER (SAMBA 2.0.7) on HP-UX 11.0, and 
it works for me with your same global and share parameters, with the
exception
of kernel oplocks = yes, because HP-UX doesn't support oplocks in the
kernel.
HOWEVER, I ran a test on Debian/GNU Linux with Samba2.0.7 that comes off of
their
distribution, and I DO get the same problem.  Looking at the log files, what
appears to
be happening is that at the point that the rename is supposed to occur, it
checks to 
see if there are any dos share mode locks on the file, and discover that
indeed there are,
and the rename fails.  What happens on my system is as a part of the file
being closed, the specific share mode entry for that file is deleted, and
then (since the share mode entry count for that file is 0), the share mode
for that file is deleted.  So when I go to rename it, it works.
On the Debian system I am seeing the specific share mode entry deleted, but
the share mode for the file is NOT, and when the rename happens, it fails
because of this; check_file_sharing() is called, and recognizes that there
is still a share mode entry for the file that denies it.  At this point the
question really is why is there still a share mode entry for the file?
Looking at the smb sequence, on MY system, every SMBntcreate is paired with
an SMBclose (it works there).  On the Debian system, right before the
failure, there are TWO SMBntcreate calls, without an SMBclose between them;
since the share_mode deletion is handled as a part of the SMBclose code, I
suspect this is the issue.  SOMETHING returned in one of the SMB replys
between the two SMBntcreate&X calls made the client decide that it did not
explicitly need to close the file; there are a number of smbtransact
requests, including some findfirst's that may be the culprit.
I apologize, but I don't have any more time to look at this right now...

Does any of this ring a bell with anyone else on the list?????

Sorry,
Don


-----Original Message-----
From: Robin P. Blanchard [mailto:Robin_Blanchard at gactr.uga.edu]
Sent: Friday, March 16, 2001 2:22 PM
To: MCCALL,DON (HP-USA,ex1)
Cc: samba at us5.samba.org
Subject: Re: file locking


Don -

Thanks for taking the time to hopefully crack this one...

server environment:
SGI Origin 2000 running IRIS 6.5.11m
Samba-2.0.7 (samba-team binary, as the 'official' SGI
	release didn't support kernel oplocks)

client environment:
win2k sp1

now to reset appropriate file permissions to a known,
base standard:

find /export/fs2/mp3 -type f -exec chmod 664 {} \;
find /export/fs2/mp3 -type d -exec chmod 2775 {} \;


ok...here's my smb.conf. you can see the few comment
lines of things i've been tinkering with.

[global]
   comment = SGI Origin 2000
   workgroup = GACTR
   netbios name = NOC
   security = server
   password server = 10.10.10.11
   locking = Yes
   lock directory = /usr/samba/var/locks
   share modes = Yes
   encrypt passwords = Yes
   null passwords = Yes
   username map = /usr/samba/lib/smbusers
   os level = 0
   preferred master = No
   domain master = No
   local master = No
   wins support = No
   wins server =  10.10.10.11
   preserve case = yes
   short preserve case = yes
   ;fstype = NTFS
   fstype = Samba
   socket options = TCP_NODELAY
   kernel oplocks = yes

[MP3]
   comment = MP3
   path = /export/fs2/mp3
   guest ok = no
   browseable = no
   writable = yes
   write list = @noc
   create mask = 0664
   directory mask = 2775
   force user = service
   force group = noc
   ;locking = no
   ;strict locking = yes
   ;inherit permissions = yes



> "MCCALL,DON (HP-USA,ex1)" wrote:
> 
> Hi Robin,
> you can go into the 'tools/folder options/file types' and remove the link
> beteen
> the .mp3 filetype and the program that windows will launch to play it, but
I
> don't
> think you really want to do that - this problem is going to come up with
> other file
> types as well, like .wav files.  Really need to understand WHY you are not
> being able
> to rename a file for which YOU have the lock in the first place.  For that
> we need to
> understand your environment better.  What os are you running samba on top
> of; what version
> of samba are you running.  Also, do an ll -d on each directory from the
root
> down to the directory the .mp3 files are in so we can verify execute
access
> all the way down the tree.
> Finally if you could post (sans comments) your entire smb.conf file, maybe
> there is a
> parameter there that is causing this behavior.  If you do this, perhaps I
> can reproduce a little portion of your environment here, and see if I can
> duplicate the behavior.
> Hope this helps,
> Don
> 
> -----Original Message-----
> From: Robin P. Blanchard [mailto:Robin_Blanchard at gactr.uga.edu]
> Sent: Friday, March 16, 2001 11:53 AM
> To: MCCALL,DON (HP-USA,ex1)
> Cc: samba at lists.samba.org
> Subject: Re: file locking
> 
> Hey Don -
> 
> Thanks for the reply...
> Here goes with my attempt at recreating your test:
> 
> on win2k client:
> create z:\Pop\U2\test.txt
> 
> on samba-server:
> database 1# ls -ald /export/fs2/mp3/Pop/U2/test.txt
> -rw-rw-r--    1 service  noc            4 Mar 16 10:41
> /export/fs2/mp3/Pop/U2/test.txt
> 
> file permissions are correct.
> 
> now, test the locking problem:
> right-click on test.txt on win2k, then check smbstatus:
> 
> database 3# /usr/samba/bin/smbstatus
> 
> Samba version 2.0.7
> Service      uid      gid      pid     machine
> ----------------------------------------------
> MP3          service  noc      31988   robin    (10.10.100.126) Thu Mar 15
> 11:09:23 2001
> 
> No locked files
> 
> so, seems you're right. one more test:
> 
> database 6# cp -a U2-Always.mp3 U2-Always.txt
> 
> right-click on each, and check smbstatus:
> 
> (U2-Always.mp3)
> Samba version 2.0.7
> Service      uid      gid      pid     machine
> ----------------------------------------------
> MP3          service  noc      31988   robin    (10.10.100.126) Thu Mar 15
> 11:09:23 2001
> 
> Locked files:
> Pid    DenyMode   R/W        Oplock           Name
> --------------------------------------------------
> 31988  DENY_WRITE RDONLY     EXCLUSIVE+BATCH
> /export/fs2/mp3/Pop/U2/U2-Always.mp3   Fri Mar 16 10:52:00 2001
> 
> annoying as suspected.
> 
> (U2-Always.txt)
> Samba version 2.0.7
> Service      uid      gid      pid     machine
> ----------------------------------------------
> MP3          service  noc      31988   robin    (10.10.100.126) Thu Mar 15
> 11:09:23 2001
> 
> Locked files:
> Pid    DenyMode   R/W        Oplock           Name
> --------------------------------------------------
> 31988  DENY_WRITE RDONLY     EXCLUSIVE+BATCH
> /export/fs2/mp3/Pop/U2/U2-Always.mp3   Fri Mar 16 10:52:00 2001
> 
> So, yes, it seems you've nailed this one. Changing an mp3 file to a txt
file
> causes it to no longer get locked, thus allowing operation on that file
(in
> particular, I am able to rename/move that file).
> I am, however, still unable to rename/move mp3 files; why you seem to
> be able to do so is mysterious.
> I would tend to agree with you that this stems from win2k giving the
option
> to play those files. It would seem then that the answer would be to
prevent
> windows from 'queueing-up' audio files. You wouldn't happen to know how
> to accomplish that would you? :)
> 
> Thanks and all further input is greatly appreciated.
> 
> > Don't know WHY this is happening, but it appears to have to do with the
> mp3
> > file type; I can duplicate this if I create a simple .txt file, and
rename
> > it
> > to something.mp3; when it's a .txt file, right clicking does NOT lock
it,
> > but as soon as I rename it to .mp3, then I get the behavior you
describe.
> > I suspect this is because of the additional options you see that
Microsoft
> > is presenting because its an mp3 file (like 'play', etc.).
> > However, I AM able to rename it without any problem; try something for
me;
> > go into that same directory where the .mp3 file is, and create a .txt
> file;
> > now check you unix permissions - is the ownership and group and
> permissions
> > what you expect?  I am wondering if your unix umask may be interfering
> with
> > the way the files are getting created/moved.  you might need FORCE
create
> > mode
> > instead of just create mode...
> > Hope this helps,
> > Don
> >
> > -----Original Message-----
> > From: Robin P. Blanchard [mailto:Robin_Blanchard at gactr.uga.edu]
> > Sent: Thursday, March 15, 2001 12:00 PM
> > To: samba at lists.samba.org
> > Subject: file locking
> >
> > i have having the most annoying file locking problems given the
following
> > setup:
> >
> > server: IRIX 6.5.11 + samba-2.0.7 irix binary (from samba website)
> > client: win2k
> >
> > when on the client, simply right-clicking on the file causes samba to
lock
> > it, thus making it impossible to rename/move that file. all file
> permissions
> > seem correct.
> >
> > reset directory/file permissions to be sure this is accurate:
> >
> > find /export/fs2/mp3 -type f -exec chmod 664 {} \;
> > find /export/fs2/mp3 -type d -exec chmod 2775 {} \;
> >
> > database 22# pwd
> > /export/fs2/mp3/Pop/U2
> > database 23# ls -ald .
> > drwxrwsr-x    5 service  noc         4096 Mar 12 13:25 .
> > database 24# ls -ald U2-Summer.Rain.mp3
> > -rw-rw-r--    1 service  noc       5962315 Oct 13 09:02
U2-Summer.Rain.mp3
> >
> > looks great so start up samba:
> >
> > database 25# /etc/init.d/samba start
> >
> > see what smbstatus has to say:
> >
> > database 26# /usr/samba/bin/smbstatus
> >
> > Samba version 2.0.7
> > Service      uid      gid      pid     machine
> > ----------------------------------------------
> >
> > No locked files
> >
> > go over to win2k and right click on a file and check smbstatus again:
> >
> > database 27# /usr/samba/bin/smbstatus
> >
> > Samba version 2.0.7
> > Service      uid      gid      pid     machine
> > ----------------------------------------------
> > MP3          service  noc      31988   robin    (10.10.100.126) Thu Mar
15
> > 11:09:23 2001
> >
> > Locked files:
> > Pid    DenyMode   R/W        Oplock           Name
> > --------------------------------------------------
> > 31988  DENY_WRITE RDONLY     EXCLUSIVE+BATCH
> > /export/fs2/mp3/Pop/U2/U2-Always.mp3   Thu Mar 15 11:09:31 2001
> >
> > so just for kicks see if we can rename that file in win2k:
> >
> > "cannot rename U2-Always: access is denied. make sure that
> > the disk is not full or write-protected and that the file
> > is not currently in use"
> >
> > i've been staring at this for days and have no idea as to
> > what the hell is going on. any suggestions are greatly appreciated.
> > here's my smb.conf stuff:
> > [MP3]
> >    comment = MP3
> >    path = /export/fs2/mp3
> >    guest ok = no
> >    browseable = no
> >    writable = yes
> >    write list = @noc
> >    create mask = 0664
> >    directory mask = 2775
> >    force user = service
> >    force group = noc
> >
> 
> --
> ------------------------------------
> Robin P. Blanchard
> IT Program Specialist
> Georgia Center for Continuing Ed.
> fon: 706.542.2404 fax: 706.542.6546
> email: Robin_Blanchard at gactr.uga.edu
> ------------------------------------
> 
> --
> To unsubscribe from this list go to the following URL and read the
> instructions:  http://lists.samba.org/mailman/listinfo/samba

-- 
------------------------------------
Robin P. Blanchard
IT Program Specialist
Georgia Center for Continuing Ed.
fon: 706.542.2404 fax: 706.542.6546
email: Robin_Blanchard at gactr.uga.edu
------------------------------------




More information about the samba mailing list