[Samba] File locking problems - v2.2.6

Brian W Spoor bwspoor at fcs.eu.com
Wed Oct 30 11:27:01 GMT 2002


Hi,

I have been going crazy over the last few weeks trying to install a new
Samba server (using v2.2.1, v2.2.5 and v2.2.6) to replace a old system.
Problem seems to be with file locking on the new server - works
perfectly on old server!!

Attached are configuration files for Samba for old (smb205.conf) and new
(smb226.conf) servers, plus the source of a Cobol test program
(samtest.cbl) that demonstrates the problem. Also included is a program
(samdata.cbl) that creates the test file. I can supply binary versions
if required - not sending .EXE for anti-virus purposes.

I have tried various variations on the parameters, but doesn't seem to
make a lot of difference. Am I missing something?

Old Server - FreeBSD 3.2 + Samba 2.0.5 - P2/300 with 128Mb RAM

New Server - RedHat Linux 7.2 + Samba 2.2.6 - Duron 1200 with 768Mb RAM

Workstations - MS-DOS 6.22 + MS-Client v3.0 - P200MMX/P233MMX with 64Mb

Problem: simulating multi-user access to a file, when program hits a
locked record (cobol reply 9/68 - record locked) both machines freeze
for some considerable time (15 - 30 mins) before they continue. Program
reply test has a delay loop built in such that it will wait before
re-trying the locked record (have tried making delay 10 times longer to
no effect). Also under 2.2.1, it seems that one workstation runs for
several seconds, locking the other out. They them swap. Doesn't seem as
bad under 2.2.5, but still happens to some extent depending on the
parameters.

  From the release notes, I had hoped that 2.2.6 cures this problem. Am I
missing something?

Regards,

Brian


-----------------------------------------------------------------------
Brian W Spoor MBCS
Chartered Information Systems Practitioner

Phone: +44-(0)1803 852625
Email: bwspoor at fcs.eu.com
-----------------------------------------------------------------------



******************************************************************************
 This email has been virus checked by the Eclipse Internet MAILsafe service
******************************************************************************
 www: http://www.eclipse.net.uk/                email: eclipse at eclipse.net.uk 
******************************************************************************
-------------- next part --------------
       identification division.
       program-id.            samdata.
      *
      *
       environment division.
       configuration section.
       input-output section.
       file-control.
           select f00  assign       to "samdata.dat"
                       organization is indexed
                       access mode  is sequential
                       lock mode    is exclusive
                       record key   is f00-test-key.
      *
      *
       data division.
       file section.
       fd          f00.
       01          f00-test-rec.
         03        f00-test-key                pic 9(4).
         03        f00-test-text               pic x(20).
         03        f00-test-count              pic 9(6).
         03        filler                      pic x(224).
      *
      *
       working-storage section.
       77          mod                         pic 9(6)  comp.
      *
      *
       procedure division.
           open output f00.
           move spaces to f00-test-rec.
           move 1      to f00-test-count. 
           perform varying mod from 1
                                 by 1
                              until mod > 9999
               move mod to f00-test-key
               write f00-test-rec
           end-perform.
           close f00.
           stop run.
      /
       end program samdata.

-------------- next part --------------
       identification division.
       program-id.            samtest.
      *author.                B W Spoor.
      *
      *
       environment division.
       configuration section.
       input-output section.
       file-control.
           select f00  assign       to "samdata.dat"
                       organization  is indexed
                       access mode   is dynamic
                       lock mode     is automatic
                       record key    is f00-test-key
                       file status   is f-status.
      *
      *
       data division.
       file section.
       fd          f00.
       01          f00-test-rec.
         03        f00-test-key                pic 9(4).
         03        f00-test-text               pic x(20).
         03        f00-test-count              pic 9(6).
         03        filler                      pic x(224).
      *
      *
       working-storage section.
       77          f-mode                      pic x(1).
       77          f-reply                     pic 9(1).
       77          mod                         pic s9(6) comp.
       77          mod1                        pic s9(2) comp.
       77          mod2                        pic s9(2) comp.
       77          modw                        pic s9(6) comp.
      *
       01          f-disp                      pic 9(5).
       01          filler                      redefines f-disp.
         03        f-disp-9                    pic 9(1).
         03        filler                      pic x(4).
      *
       01          f-status.
         03        f-stat-1                    pic x(1).
         03        f-stat-2                    pic x(1).
       01          f-stat-n                    pic 9(2)
                                               redefines f-status.
       01          f-stat-bin                  pic 9(4)  comp
                                               redefines f-status.
      *
      *
       screen section.
       01          screen-f1       highlight
                                   background-color 4
                                   foreground-color 6.
         03        line 23 col  1  value "Disc Reply - Mode=".
         03        line 23 col 19  pic X(1)  from f-mode.
         03        line 23 col 20  value "  Reply=".
         03        line 23 col 28  pic z(4)9 from f-disp.
         03        line 23 col 33  value "   Key=".
         03        line 23 col 40  pic 9(4) from f00-test-key.
      *
       01          screen-l1       highlight
                                   background-color 1
                                   foreground-color 6.
         03        line 20 col  1  value "Record ".
         03        line 20 col  8  pic 9(4) from f00-test-key.
         03        line 20 col 12  value " Locked".
      *
      *
       procedure division.
           move zero to f00-test-key.
           move "O" to f-mode.
           move  2  to f-reply.
           perform until f-reply = zero
               open i-o f00
               perform check-status
           end-perform.
           perform varying mod2 from 1
                                  by 1
                               until mod2 > 9
               perform varying mod from 10
                                     by 10
                                  until mod > 9999
                   perform varying mod1 from 9
                                          by -1
                                       until mod1 < 1
                       add  mod mod1 giving f00-test-key
                       move "R" to f-mode
                       move  2  to f-reply
                       perform until f-reply = zero
                           read f00 record
                           end-read
                           perform check-status
                       end-perform
                       add  1   to f00-test-count
                       move "W" to f-mode
                       move  2  to f-reply
                       perform until f-reply = zero
                           rewrite f00-test-rec
                           end-rewrite
                           perform check-status
                       end-perform
                   end-perform
               end-perform
           end-perform.
           close f00.
           stop run.
      *
      *
       check-status.
           if f-stat-1 = "0"
               move f-stat-n to f-disp
               move zero     to f-reply
           else
               if f-stat-1 = "9"
                   move low-values to f-stat-1
                   move f-stat-bin to f-disp
                   move 9          to f-disp-9
                   if f-stat-bin = 65 or
                      f-stat-bin = 68
                       perform lock-wait
                       move 1    to f-reply
                   else
                       move 2    to f-reply
                   end-if
               else
                   move f-stat-n to f-disp
                   move 2        to f-reply
               end-if
           end-if.
           display screen-f1.
           if f-reply > 1
               stop run
           end-if.
      *
      *
       lock-wait.
           display screen-l1.
           perform varying modw from 1
                                  by 1
                               until modw > 999
               continue
           end-perform.
      /
       end program samtest.

-------------- next part --------------
[global]
   workgroup = FCS
   server string = FCS44
   hosts allow = 192.168.8. 127.
   guest account = samba
   load printers = yes
   printing = bsd
   min print space = 2000
   log file = /var/log/log.%m
   max log size = 50
   security = share
   socket options = TCP_NODELAY 
   dns proxy = no 

[printers]
   comment = All Printers
   path = /var/spool/output/samba
   printcap name = /etc/printcap
   print command = /usr/bin/lpr -P%p -r %s
   lpq command = /usr/bin/lpq -P%p
   lprm command = /usr/bin/lprm -P%p %j
   lppause command = /usr/sbin/lpc stop %p
   lpresume command = /usr/sbin/lpc start %p
   public = yes
   guest ok = yes
   writable = no
   printable = yes

[public]
   path = /home/samba/public
   public = yes
   writable = yes
   printable = no


-------------- next part --------------
[global]
	workgroup = FCS
	server string = FCS0
	hosts allow = 192.168.8. 127.
	guest account = samba
	load printers = no
	log file = /var/log/log.%m
	max log size = 50
	security = share
	socket options = TCP_NODELAY
	dns proxy = no

[public]
	path = /home/samba/public
	public = yes
	guest ok = yes
	browsable = yes
	printable = no
	writable = yes
#
	share modes = yes
	locking = yes
	strict locking = no
	oplocks = no
	level2 oplocks = no
	blocking locks = yes




More information about the samba mailing list