









|
[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
[NMLUG] Samba + NFS
I did a test and I'm able to see two way traffic by tcpdumping my server's
lockd port in my case 32799. Perhaps a firewall issue? If not you could try
running my code snippit below to see if NFS locking is working. I ran it
once, then suspended it and ran it again. One gets the lock and one doesn't.
This was on my test NFS volume. I also found a reference to 'strict
locking = yes' in the smb.conf file, that causes samba to check for a lock
before every read/write at the cost of performance. I want to think that
samba honors advisory locks. j
# This is run on the nfs client
jamesh@test:~$ ./fcntltest
Got lock on /home/jamesh/file
^Z
[2]+ Stopped ./fcntltest
jamesh@test:~$ ./fcntltest
!! /home/jamesh/file is already locked
Here's my output from the above test.
# tcpdump -n port 32799
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
00:24:28.445061 IP 192.168.5.2.799 > 192.168.5.5.32799: UDP, length: 164
00:24:28.445195 IP 192.168.5.5.32799 > 192.168.5.2.799: UDP, length: 36
00:24:28.446031 IP 192.168.5.2.799 > 192.168.5.5.32799: UDP, length: 180
00:24:28.446284 IP 192.168.5.5.32799 > 192.168.5.2.799: UDP, length: 36
00:24:33.369224 IP 192.168.5.2.799 > 192.168.5.5.32799: UDP, length: 164
00:24:33.369325 IP 192.168.5.5.32799 > 192.168.5.2.799: UDP, length: 36
00:24:33.370386 IP 192.168.5.2.799 > 192.168.5.5.32799: UDP, length: 180
00:24:33.370494 IP 192.168.5.5.32799 > 192.168.5.2.799: UDP, length: 36
------------
#!/usr/bin/perl
use Fcntl;
# Make this be a file on your nfs mounted volume
$file = '/home/jamesh/file';
$lock = pack('sslls',&F_WRLCK,0,0,0,0);
open(TEST, "> $file") || die "Unable to open file: $!\n";
# Prepare to do some work on it by locking it
if(fcntl(TEST, F_SETLK, $lock)) {
print "Got lock on $file\n";
} else {
print "!! $file is already locked\n";
}
exit;
------------
On Mon, Jan 10, 2005 at 08:01:13PM -0700, Mars DeLapp wrote:
> James Hamilton wrote:
> >On Thu, Dec 30, 2004 at 01:48:47PM -0700, Mars DeLapp wrote:
> >
> >>James Hamilton wrote:
> >>
> >>>Perhaps samba and your nfs server are using different locking mechanisms.
> >>>There's always a race condition with nfs but I think in this case if your
> >>>samba server and your nfs server use the same lock mechanism things would
> >>>probably work like you want.
> >>>
> >>
> >>I don't think NFS is using file locking.
> >
> >
> >Ahh, so that is probably the issue. Running lockd on the nfs client and
> >server will give you nfs's locking.
>
> lockd and statd *are* running on both the client and server.
>
> rpcinfo -p shows both nlockmgr and status.
>
> After lots of searching and rereading the nfs howto several times, I am
> still stumped.
>
> Mars
>
> --
> =============================================================
> J. Marsden DeLapp, PE
> President
> DeLapp & Associates, Inc. dba DeLapp Engineering
> Providing lighting and power planning, design and analysis services
> for commercial, industrial and large residential facilities.
> 1300 Luisa St Ste 23
> Santa Fe NM 87505
> (505) 983-5557
> http://DeLapp.com
> =============================================================
>
> _______________________________________________
> NMLUG mailing list
> NMLUG@nmlug.org
> http://www.nmlug.org/mailman/listinfo/nmlug
--
James Hamilton
Southwest Cyberport
http://www.swcp.com
505-232-7992
|
|