[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How do I get NFS locking to work?



On Wed, 2007-01-03 at 11:40 -0500, hendrik@topoi.pooq.com wrote:
> On Sat, Dec 23, 2006 at 04:53:28PM +0100, Michelle Konzack wrote:
> > Am 2006-12-14 12:42:13, schrieb hendrik@topoi.pooq.com:
> > > On Thu, Dec 14, 2006 at 12:18:27PM -0500, hendrik@topoi.pooq.com
> wrote:
> > > > How do I get NFS locking to work?  (And why doesn't it "just
> work" 
> > > > anyway?)
> > > > 
> > > > I am unable to use monotone properly over an NFS mount because
> it very 
> > > > sensibly tries to lock its repository before modifying it.
> > 
> > You NEEED to mount your NFS-Share HARD in your /etc/fstab with:
> > 
> > nfsserver:/directory   /datadir nfs
> rw,bg,hard,intr,tcp,vers=3,wsize=8192,rsize=8192 0 0
> >                                           ^^^^      ^^^ ^^^^^^
> > 
> > and it seems, that some things are working only correctly,
> > if you use "tcp" and "vers=3".  Be sure, you have compiled
> > this options into your kernel or kernel-module.
> > 
> > Thanks, Greetings and nice Day
> 
> Thanks.  I finally had the chance to do that.  But it still doesn't 
> work.  Could the following error messages be a clue? 
> 
> hendrik@lovesong:~/dv/lang/frith$ mtn commit
> lockd: cannot monitor 172.25.1.11
> lockd: failed to monitor 172.25.1.11
> mtn: error: sqlite error: database is locked
> hendrik@lovesong:~/dv/lang/frith$
> 
> I also occasionally get similar messages from fam
> 
> The /etc/fstab entry for /farhome is
> 
> 172.25.1.11:/farhome  /farhome nfs
> noauto,user,defaults,rw,hard,tcp,lock,vers=3,exec,nodev 1 1
> 
> And the /etc/exports entry on 172.25.1.11 is
> 
> /farhome         172.25.1.2(rw,sync,no_root_squash,map_identity)
> 172.25.1.3(rw,sync,no_root_squash,map_identity)
> 172.25.1.4(rw,sync,no_root_squash,map_identity)
> 172.25.1.9(rw,sync,no_root_squash,map_identity)
> 172.25.1.12(rw,sync,no_root_squash,map_identity)
> 172.25.1.32(rw,sync,no_root_squash,map_identity)
> 172.25.1.33(rw,sync,no_root_squash,map_identity)
> 172.25.1.6(rw,sync,no_root_squash,map_identity)
> 172.25.1.8(rw,sync,no_root_squash,map_identity)
> 172.25.1.9(rw,sync,no_root_squash,map_identity)
> 
> The machine I ran the mtn commit from was 172.25.1.4 (the third entry
> on 
> the above list)

Why not just export the /farhome with this:

/farhome 172.25.1.0/255.255.255.0(rw,sync,no_root_squash,map_identity)

or what ever your netmask is.

Also on you client machine add the option "lock" to the fstab setup.

BTW, I've never really used anything but defaults in fstab besides
"hard,tcp"

With NFSv4, there comes a new set of options I've added to my fstab:

	duke:/stor /stor nfs defaults,rsize=32768,wsize=32768 0 0

On my server I use:

	/stor 192.168.1.0/255.255.255.0(sync,no_root_squash,rw,subtree_check)
	
I get locking and everything.

On the "server" 

linux-image-2.6.18-3-k7   2.6.18-7  Linux 2.6.18 image on AMD K7
libnfsidmap2              0.18-0    An nfs idmapping library
nfs-common                1.0.10-4  NFS support files common to client
nfs-kernel-server         1.0.10-4  Kernel NFS server support
portmap                   5-21      The RPC portmapper

On the "client" side

linux-image-2.6.18-3-k7   2.6.18-8  Linux 2.6.18 image on AMD K7
libnfsidmap2              0.18-0    An nfs idmapping library
nfs-common                1.0.10-5  NFS support files common to client
nfs-kernel-server         1.0.10-5  Kernel NFS server support
portmap                   5-25      The RPC portmapper

AND here is the kicker, edit "/etc/default/nfs-common" changing
NEED_LOCKD=
to 
NEED_LOCKD="yes"

Just in case your kernel doesn't support proper locking (if it is a
stock Debian Kernel it should)
-- 
greg, greg@gregfolkert.net

The technology that is
Stronger, better, faster:  Linux

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: