Kathy
2009-Feb-06 18:24 UTC
[Samba] File locking problem involving Samba, Clearcase, and Cygwin
We are having some problems in our company's test group that did not exist when our Clearcase 2003.06 server existed on a Solaris 8 machine. Now we are running on RHEL 5.2 with Clearcase 7.0.1.3 with Samba 3.0.28 (despite the fact that IBM has only blessed up to 3.0.24) and running into some file locking issues with some scripts our test group runs. I am hoping that someone might have some ideas. The environment is this: Our test group has a PC that runs VMWare virtual machines (Windows XP). They log into one of the virtual Win XP machines and pop several Cygwin windows running bash. They have several Clearcase views that they might use at the same time but each view used is in a different Cygwin window. The views are located on a RHEL 5.2 Clearcase server named Flint running Samba 3.0.28. So, in each Cygwin window, they will "cd //flint/views/<view_name>/vobs/c2test/C2Testsuite" and in there they run some scripts that write to logs called magellan.log and magellan.sum. They are essentially using the views as a file server for their test scripts. They often run these scripts from different views at the same time, and each script that runs runs multiple sequential tests. Inside the master script (simple bourne shell), after a test is complete, it closes out the magellan.log (and .sum) files and does a "mv" to rename the file so the next iteration can use the same name for the log file. (Yeah, it would be easier to just make them unique names for each run, but this is old legacy stuff that would be a pain in the kazoo to change, so for the moment we're trying to just fix it before redesigning it all). What's happening is at random times, the mv command fails and they get permission denied because another process is holding on to the script and sometimes in the Samba log I will see NT_STATUS_SHARING_VIOLATION, which can make sense if another process has a lock on the file. In our smb.conf file, I have oplocks turned off because IBM requires this for Clearcase: # first statement is old and may not be obsolete but we still keep it just in case oplocks = no kernel oplocks = no level2 oplocks = no However, as shown below, we're seeing oplocks reported and I have no idea whether this is normal or not. I asked a Clearcase support guy and he did not know (sigh). So hence I'm hoping someone here has some experience with this. Again, we ran this same sort of set up before with a Solaris Clearcase/Samba server and we didn't see these problems. This may not be related to Clearcase at all and simply and issue of how file locking is working between RHEL 5.2 and Samba. What exactly is a LEVEL_II oplock and why am I seeing these if I have Samba oplocks turned off? Other than this, Clearcase is operating normally and Samba is operating normally on Flint for all other applications. It's just this situation where we're running these sequential scripts sitting in side the Clearcase view via Samba. Thanks for any insight -- Kathy Locked files: Pid Uid DenyMode Access R/W Oplock Share Path Name Time -------------------------------------------------------------------------------- ------------------ 12825 20191 DENY_NONE 0x20196 WRONLY NONE /view turboS_verification_1/vobs/c2test/C2Testsuite/magellan.log Thu Jan 15 04:40 :30 2009 12825 20191 DENY_NONE 0x20196 WRONLY EXCLUSIVE+BATCH /view turboS_verification_2/vobs/c2test/C2Testsuite/cozushell.cvf Thu Jan 15 05:1 5:59 2009 12825 20191 DENY_NONE 0x20089 RDONLY NONE /view turboS_verification_4/vobs/c2test/C2Testsuite/magellan.she ll/S6_PU Wed Jan 14 18:00:20 2009 12825 20191 DENY_NONE 0x20089 RDONLY NONE /view turboS_verification_1/vobs/c2test/C2Testsuite/magellan.she ll/TURBOS_TESTSUITE Wed Jan 14 17:54:21 2009 12825 20191 DENY_NONE 0x20089 RDONLY LEVEL_II /view turboS_verification_1/vobs/c2test/C2Testsuite/magellan.she ll/TURBOS_TESTSUITE Wed Jan 14 17:56:41 2009 12825 20191 DENY_NONE 0x20089 RDONLY LEVEL_II /view turboS_verification_1/vobs/c2test/C2Testsuite/magellan.she ll/TURBOS_TESTSUITE Wed Jan 14 17:57:23 2009 12825 20191 DENY_NONE 0x20196 WRONLY NONE /view turboS_verification_4/vobs/c2test/C2Testsuite/cozushell.cv f Thu Jan 15 04:29:34 2009 12825 20191 DENY_NONE 0x20196 WRONLY NONE /view turboS_verification_4/vobs/c2test/C2Testsuite/magellan.sum Thu Jan 15 04:29:34 2009 12825 20191 DENY_NONE 0x20196 WRONLY NONE /view turboS_verification_1/vobs/c2test/C2Testsuite/magellan.sum Thu Jan 15 04:40:30 2009 12825 20191 DENY_NONE 0x20196 WRONLY NONE /view turboS_verification_2/vobs/c2test/C2Testsuite/magellan.log Thu Jan 15 05:15:59 2009 12825 20191 DENY_NONE 0x20196 WRONLY NONE /view turboS_verification_4/vobs/c2test/C2Testsuite/magellan.log Thu Jan 15 04:29:34 2009 12825 20191 DENY_NONE 0x20196 WRONLY NONE /view turboS_verification_2/vobs/c2test/C2Testsuite/magellan.sum Thu Jan 15 05:15:59 2009 12825 20191 DENY_NONE 0x20196 WRONLY EXCLUSIVE+BATCH /view turboS_verification_3/vobs/c2test/C2Testsuite/cozushell.cv f Thu Jan 15 06:30:22 2009 12825 20191 DENY_NONE 0x20196 WRONLY LEVEL_II /view turboS_verification_3/vobs/c2test/C2Testsuite/magellan.sum Thu Jan 15 06:30:22 2009 12825 20191 DENY_NONE 0x20196 WRONLY LEVEL_II /view turboS_verification_3/vobs/c2test/C2Testsuite/magellan.sum Thu Jan 15 04:40:31 2009 12825 20191 DENY_NONE 0x20196 WRONLY NONE /view turboS_verification_3/vobs/c2test/C2Testsuite/magellan.log Thu Jan 15 06:30:22 2009
Rob Shinn
2009-Feb-06 21:24 UTC
[Samba] File locking problem involving Samba, Clearcase, and Cygwin
On Fri, Feb 6, 2009 at 1:23 PM, Kathy <banshee135@gmail.com> wrote:> > # first statement is old and may not be obsolete but we still keep it > just in case > oplocks = no > kernel oplocks = no > level2 oplocks = no >If you have 'oplocks = no', then it doesn't matter what 'kernel oplocks' or 'level2 oplocks' are set to. Samba will ignore them. However, as shown below, we're seeing oplocks reported and I have no> idea whether this is normal or not. I asked a Clearcase support guy > and he did not know (sigh). So hence I'm hoping someone here has some > experience with this. Again, we ran this same sort of set up before > with a Solaris Clearcase/Samba server and we didn't see these > problems. This may not be related to Clearcase at all and simply and > issue of how file locking is working between RHEL 5.2 and Samba. What > exactly is a LEVEL_II oplock and why am I seeing these if I have Samba > oplocks turned off?level2 oplocks from smb.conf manpage: Level2, or read-only oplocks allow Windows NT clients that have an oplock on a file to downgrade from a read-write oplock to a read-only oplock once a second client opens the file (instead of releasing all oplocks on a second open, as in traditional, exclusive oplocks). This allows all openers of the file that support level2 oplocks to cache the file for read-ahead only (ie. they may not cache writes or lock requests) and increases performance for many accesses of files that are not commonly written (such as application .EXE files). if oplocks = no, then the 'level2 oplocks; doesn't do anything. Note that oplocks parameter should be set per share. Please post the output of your 'testparm' command.
Jeremy Allison
2009-Feb-07 01:26 UTC
[Samba] File locking problem involving Samba, Clearcase, and Cygwin
On Fri, Feb 06, 2009 at 10:23:57AM -0800, Kathy wrote:> We are having some problems in our company's test group that did not > exist when our Clearcase 2003.06 server existed on a Solaris 8 > machine. Now we are running on RHEL 5.2 with Clearcase 7.0.1.3 with > Samba 3.0.28 (despite the fact that IBM has only blessed up to 3.0.24) > and running into some file locking issues with some scripts our test > group runs. I am hoping that someone might have some ideas. > > The environment is this: Our test group has a PC that runs VMWare > virtual machines (Windows XP). They log into one of the virtual Win > XP machines and pop several Cygwin windows running bash. They have > several Clearcase views that they might use at the same time but each > view used is in a different Cygwin window. The views are located on a > RHEL 5.2 Clearcase server named Flint running Samba 3.0.28. So, in > each Cygwin window, they will "cd > //flint/views/<view_name>/vobs/c2test/C2Testsuite" and in there they > run some scripts that write to logs called magellan.log and > magellan.sum. They are essentially using the views as a file server > for their test scripts. > > They often run these scripts from different views at the same time, > and each script that runs runs multiple sequential tests. Inside the > master script (simple bourne shell), after a test is complete, it > closes out the magellan.log (and .sum) files and does a "mv" to rename > the file so the next iteration can use the same name for the log file. > (Yeah, it would be easier to just make them unique names for each > run, but this is old legacy stuff that would be a pain in the kazoo to > change, so for the moment we're trying to just fix it before > redesigning it all). > > What's happening is at random times, the mv command fails and they get > permission denied because another process is holding on to the script > and sometimes in the Samba log I will see NT_STATUS_SHARING_VIOLATION, > which can make sense if another process has a lock on the file. In > our smb.conf file, I have oplocks turned off because IBM requires this > for Clearcase:This is not oplock or lock releated, this is open share mode related. The three are completely different. I'd suggest trying 3.2.8 (3.3.0 is slightly better but there's an ACL issue we need to do a 3.3.1 release for on Feb 24th. If you don't care about ACLs then 3.3.0 might suit). 3.0.x is not under active development, only maintanence. Jeremy.