2002-09-12 02:19:29

by NeilBrown

[permalink] [raw]
Subject: Lock recovery doesn't work in debian statd/lockd ordering


Hi Chip and NFSers.

I just noticed that lock recovery doesn't work with a Debian NFS
server.
i.e. server shuts down, restarts, and the client *Doesn't* reclaim
the locks.

The problem is that statd starts before lockd.

What happens is that:
statd starts
it moves everything from /var/lib/nfs/sm to /var/lib/nfs/sm.bak
it notifies each host listed in /var/lib/nfs/sm.bak that the
server has restarted
statd on the client gets the notification and tells it's local
lockd to reclaim locks.
lockd on client asked portmap on server for port number for lockd,
but lockd hasn't started on the server so there isn't one. So
lockd on the client gives up (maybe it should persist, I'm not
sure).
Finally lockd on the server starts, but it is too late.


I fixed this for myself by moving /etc/rc2.d/S19nfs-common to S21 so
that it starts after nfsd and lockd which are started in
S20nfs-kernel-server.

There should be no problem with statd starting after lockd and lockd
doesn't try to talk to statd until it gets the first lock request.

NeilBrown


-------------------------------------------------------
In remembrance
http://www.osdn.com/911/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs


2002-09-12 04:00:43

by Adrian Phillips

[permalink] [raw]
Subject: Re: Lock recovery doesn't work in debian statd/lockd ordering

>>>>> "Neil" == Neil Brown <[email protected]> writes:

Neil> I just noticed that lock recovery doesn't work with a
Neil> Debian NFS server. i.e. server shuts down, restarts, and
Neil> the client *Doesn't* reclaim the locks.

Um, which version ? On my woody box lockd is started in nfs-common
after statd still though :-

#!/bin/sh
#
# nfs-common This shell script takes care of starting and stopping
# common daemons required for NFS clients and servers.
#
# chkconfig: 345 20 80
# description: NFS is a popular protocol for file sharing across \
# TCP/IP networks. This service provides NFS file \
# locking functionality.
#

PREFIX=

NEED_LOCKD=yes
if test -f /proc/ksyms
then
# We need to be conservative and run lockd,
# unless we can prove that it isn't required.
grep -q lockdctl /proc/ksyms || NEED_LOCKD=no
fi

[ -x $PREFIX/sbin/rpc.statd ] || exit 0
[ -x $PREFIX/sbin/rpc.lockd ] || [ "$NEED_LOCKD" = no ] || exit 0

# What is this?
DESC="NFS common utilities"

# See how we were called.
case "$1" in
start)
cd / # daemons should have root dir as cwd
printf "Starting $DESC:"
printf " statd"
start-stop-daemon --start --quiet \
--exec $PREFIX/sbin/rpc.statd
if [ "$NEED_LOCKD" = yes ]
then
printf " lockd"
start-stop-daemon --start --quiet \
--exec $PREFIX/sbin/rpc.lockd
fi
echo "."
;;

stop)
printf "Stopping $DESC:"
if [ "$NEED_LOCKD" = yes ]
then
printf " lockd"
start-stop-daemon --stop --oknodo --quiet \
--exec $PREFIX/sbin/rpc.lockd
fi
printf " statd"
start-stop-daemon --stop --oknodo --quiet \
--exec $PREFIX/sbin/rpc.statd
echo "."
;;

restart | force-reload)
$0 stop
sleep 1
$0 start
;;

*)
echo "Usage: nfs-common {start|stop|restart}"
exit 1
;;
esac

exit 0

Sincerely,

Adrian Phillips

--
Your mouse has moved.
Windows NT must be restarted for the change to take effect.
Reboot now? [OK]


-------------------------------------------------------
In remembrance
http://www.osdn.com/911/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

2002-09-13 19:22:31

by Philippe Troin

[permalink] [raw]
Subject: Re: Lock recovery doesn't work in debian statd/lockd ordering

Neil Brown <[email protected]> writes:

> Hi Chip and NFSers.
>
> I just noticed that lock recovery doesn't work with a Debian NFS
> server.
> i.e. server shuts down, restarts, and the client *Doesn't* reclaim
> the locks.
>
> The problem is that statd starts before lockd.
>
> What happens is that:
> statd starts
> it moves everything from /var/lib/nfs/sm to /var/lib/nfs/sm.bak
> it notifies each host listed in /var/lib/nfs/sm.bak that the
> server has restarted
> statd on the client gets the notification and tells it's local
> lockd to reclaim locks.
> lockd on client asked portmap on server for port number for lockd,
> but lockd hasn't started on the server so there isn't one. So
> lockd on the client gives up (maybe it should persist, I'm not
> sure).
> Finally lockd on the server starts, but it is too late.
>
>
> I fixed this for myself by moving /etc/rc2.d/S19nfs-common to S21 so
> that it starts after nfsd and lockd which are started in
> S20nfs-kernel-server.
>
> There should be no problem with statd starting after lockd and lockd
> doesn't try to talk to statd until it gets the first lock request.

I've opened a debian bug (# 160800) about this.

-> http://bugs.debian.org/160800

Phil.


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

2002-09-15 21:45:10

by Chip Salzenberg

[permalink] [raw]
Subject: Re: Lock recovery doesn't work in debian statd/lockd ordering

Since Neil is the bug reporter and no one has disagreed with his
analysis, I'm making the change he recommends for Debian unstable.
If it proves OK, I'll issue a fix for Debian stable.
--
Chip Salzenberg - a.k.a. - <[email protected]>
"It furthers one to have somewhere to go."


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

2002-09-16 01:31:10

by Will Stowe

[permalink] [raw]
Subject: unsubcribe






-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs